/* Base layout – dark navy + cyan Delticom-style theme */
:root {
    --bg-body: #050814;
    --bg-sidebar: #0a1a2f;
    --bg-sidebar-dark: #07101f;
    --bg-main: #050b16;
    --bg-topbar: #0d2037;
    --bg-card: #101f33;
    --bg-card-alt: #13253b;

    --border-subtle: #1e3450;
    --border-strong: #14d0ff33;

    --accent: #14d0ff;
    --accent-soft: #6feaff;
    --accent-muted: #1b5166;

    --text-main: #e6e6e6;
    --text-muted: #9ba8c0;
    --text-soft: #6d7992;
    --text-danger: #ff7a7a;
    --text-success: #7df6c4;

    --danger: #842029;
    --danger-bg: #2a1115;
    --success-bg: #10271e;

    --radius-lg: 14px;
    --radius-md: 8px;
    --radius-sm: 4px;

    --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.55);
    --shadow-card: 0 12px 32px rgba(0, 0, 0, 0.45);

    --font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    color: var(--text-main);
}

/* ---------- Login ---------- */

.login-body {
    background: radial-gradient(circle at top, #12284a 0%, #050814 55%, #02030a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-wrapper {
    max-width: 380px;
    width: 100%;
    padding: 20px;
}

.login-card {
    background: linear-gradient(145deg, rgba(10, 26, 47, 0.96), rgba(5, 10, 24, 0.98));
    border-radius: 18px;
    padding: 26px 26px 22px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-strong);
}

.login-title {
    margin: 0 0 4px;
    font-size: 22px;
    letter-spacing: 0.03em;
}

.login-subtitle {
    margin: 0 0 18px;
    font-size: 13px;
    color: var(--text-muted);
}

.login-form {
    margin-top: 8px;
}

.form-label {
    display: block;
    font-size: 12px;
    color: var(--text-soft);
    margin-bottom: 4px;
}

.input-field {
    width: 100%;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: #050a16;
    color: var(--text-main);
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.input-field:focus {
    border-color: var(--accent);
    background: #050b19;
    box-shadow: 0 0 0 1px #14d0ff55;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 14px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
    background: #222;
    color: var(--text-main);
}

.btn-full {
    width: 100%;
    margin-top: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-soft) 100%);
    color: #02050a;
    border-color: #1be1ff;
    box-shadow: 0 0 0 1px rgba(20, 208, 255, 0.5), 0 14px 30px rgba(4, 30, 61, 0.7);
}

.btn-primary:hover {
    box-shadow: 0 0 0 1px rgba(20, 208, 255, 0.7), 0 18px 40px rgba(4, 30, 61, 0.95);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #0f1e33;
    border-color: var(--border-subtle);
    color: var(--text-main);
}

.btn-secondary:hover {
    border-color: var(--accent);
}

.btn-ghost {
    background: transparent;
    border-color: var(--border-subtle);
    color: var(--text-muted);
}

.btn-ghost:hover {
    border-color: var(--accent-soft);
    color: var(--accent-soft);
}

.btn-logout {
    padding: 5px 10px;
    font-size: 11px;
}

.btn-rename {
    padding: 4px 10px;
    font-size: 11px;
}

/* Upload busy */
.btn-upload-busy {
    opacity: 0.7;
    cursor: wait;
}

/* Alerts */

.alert {
    border-radius: var(--radius-md);
    padding: 7px 10px;
    font-size: 12px;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--success-bg);
    color: var(--text-success);
    border-color: rgba(125, 246, 196, 0.45);
}

.alert-error {
    background: var(--danger-bg);
    color: var(--text-danger);
    border-color: rgba(255, 122, 122, 0.45);
}

/* ---------- App shell ---------- */

.app-body {
    background: radial-gradient(circle at top right, #13294b 0%, #050814 50%, #02030a 100%);
    color: var(--text-main);
    min-height: 100vh;
}

.app-shell {
    display: flex;
    align-items: flex-start;
}

/* Sidebar */

.sidebar {
    width: 265px;
    background: radial-gradient(circle at top left, #173259 0%, #0a1a2f 40%, #050b15 100%);
    border-right: 1px solid var(--border-subtle);
    padding: 16px 14px 16px 16px;
    display: flex;
    flex-direction: column;
    box-shadow: 10px 0 35px rgba(0, 0, 0, 0.65);
    flex-shrink: 0;

    /* keep it fixed while content scrolls */
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
    gap: 10px;
}

.sidebar-logo {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 30% 20%, #6feaff 0%, #14d0ff 40%, #044b5f 100%);
    color: #02050a;
    font-size: 18px;
    box-shadow: 0 0 0 2px #14d0ff55;
}

.sidebar-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    margin-top: 4px;
}

.nav-item {
    display: flex;
    flex-direction: column;
    padding: 8px 10px;
    border-radius: 10px;
    color: var(--text-main);
    text-decoration: none;
    border: 1px solid transparent;
    margin-bottom: 6px;
    background: transparent;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
}

.nav-label {
    font-size: 13px;
}

.nav-sub {
    font-size: 11px;
    color: var(--text-soft);
}

.nav-item:hover {
    border-color: var(--border-subtle);
    background: rgba(11, 32, 59, 0.75);
}

.nav-item.active {
    border-color: #1be1ff;
    background: radial-gradient(circle at left, #17395e 0%, #0a1f3a 45%, #05101f 100%);
    box-shadow: 0 0 0 1px rgba(27, 225, 255, 0.6);
}

.sidebar-footer {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid rgba(22, 45, 77, 0.8);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.sidebar-meta {
    font-size: 11px;
    color: var(--text-soft);
}

/* Main */

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle at top right, #122948 0%, #050814 50%, #02030a 100%);
    min-width: 0;
}

/* Topbar */

.topbar {
    height: 58px;
    padding: 10px 22px 8px;
    border-bottom: 1px solid var(--border-subtle);
    background: linear-gradient(135deg, rgba(13, 32, 55, 0.98), rgba(7, 18, 33, 0.97));
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.topbar-left {
    display: flex;
    align-items: center;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-logo-circle {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 25% 20%, #6feaff 0%, #14d0ff 45%, #044b5f 100%);
    box-shadow: 0 0 0 2px rgba(20, 208, 255, 0.5);
}

.topbar-logo-icon {
    font-size: 18px;
    color: #02050a;
}

.topbar-text {
    display: flex;
    flex-direction: column;
}

.topbar-title {
    font-size: 16px;
    font-weight: 600;
}

.topbar-subtitle {
    font-size: 12px;
    color: var(--text-soft);
    margin-top: 2px;
}

.topbar-right {
    display: flex;
    align-items: center;
}

/* VU meter */

.vumeter {
    display: inline-flex;
    align-items: flex-end;
    gap: 3px;
    padding: 4px 8px;
    border-radius: 999px;
    background: radial-gradient(circle at top, rgba(32, 72, 94, 0.95), rgba(7, 25, 41, 0.95));
    box-shadow: 0 0 0 1px rgba(20, 208, 255, 0.45),
                0 8px 20px rgba(0, 0, 0, 0.6);
}

.vumeter-bar {
    width: 4px;
    border-radius: 999px;
    background: var(--accent-soft);
    animation: vumeter-pulse 0.7s infinite ease-in-out;
    transform-origin: bottom;
}

.vumeter-bar.bar1 { animation-delay: 0s; }
.vumeter-bar.bar2 { animation-delay: 0.12s; }
.vumeter-bar.bar3 { animation-delay: 0.24s; }
.vumeter-bar.bar4 { animation-delay: 0.36s; }

@keyframes vumeter-pulse {
    0%   { height: 4px; }
    25%  { height: 18px; }
    50%  { height: 10px; }
    75%  { height: 22px; }
    100% { height: 6px; }
}

/* Content */

.content {
    padding: 18px 22px 26px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1;
    overflow-y: auto; /* main scrolling area */
}

/* Cards */

.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.card-header {
    padding: 10px 14px 8px;
    border-bottom: 1px solid #152a42;
    background: linear-gradient(120deg, rgba(20, 38, 64, 0.85), rgba(9, 25, 44, 0.95));
}

.card-title {
    font-size: 14px;
    font-weight: 600;
}

.card-subtitle {
    font-size: 12px;
    color: var(--text-soft);
    margin-top: 2px;
}

.card-body {
    padding: 10px 14px 12px;
}

.card-table .card-body {
    padding: 4px 0 10px;
}

.card-editor {
    background: var(--bg-card-alt);
}

/* Toolbar */

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.toolbar-section {
    min-width: 260px;
    max-width: 360px;
}

.toolbar-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 4px;
}

.input-file {
    flex: 1;
    font-size: 12px;
    color: var(--text-main);
}

.form-help {
    font-size: 11px;
    color: var(--text-soft);
    margin-top: 4px;
}

/* Table */

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table th,
.table td {
    padding: 6px 10px;
    border-bottom: 1px solid rgba(18, 41, 73, 0.85);
}

.table th {
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-soft);
    background: #121f33;
}

.table tbody tr:nth-child(even) {
    background: rgba(8, 18, 34, 0.75);
}

.table tbody tr:hover {
    background: rgba(22, 52, 92, 0.8);
}

/* Icons + names */

.name-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.icon {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    opacity: 0.9;
}

/* base icons */
.icon-folder::before {
    content: "📁";
}

.icon-file::before {
    content: "📄";
}

.icon-up::before {
    content: "⤴";
}

/* custom per-type icons */
.icon-audio::before {
    content: "🎵";
}
.icon-playlist::before {
    content: "🎚";
}
.icon-config::before {
    content: "⚙";
}
.icon-xml::before {
    content: "🧾";
}
.icon-noext::before {
    content: "📦";
}
/* NEW: executables & archives */
.icon-exe::before {
    content: "⚡";
}
.icon-archive::before {
    content: "🗜";
}

/* subtle color accents per type */
.icon-audio {
    color: #6feaff;
}
.icon-playlist {
    color: #ffcf6f;
}
.icon-config {
    color: #9eff8f;
}
.icon-xml {
    color: #ff9d57;
}
.icon-noext {
    color: #e6e6e6;
}
.icon-exe {
    color: #ffd966; /* bright yellow for executables */
}
.icon-archive {
    color: #c28dff; /* purple-ish for compressed files */
}

.link-up .up-label {
    margin-left: 6px;
}

.file-name {
    word-break: break-word;
}

/* Links & chips */

a {
    color: var(--accent-soft);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.link-folder {
    font-weight: 500;
}

.link-action {
    font-size: 12px;
}

.link-danger {
    color: var(--text-danger);
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid rgba(99, 124, 148, 0.7);
    font-size: 11px;
}

.chip-small {
    margin-left: 6px;
}

.chip-muted {
    margin-left: 6px;
    color: var(--text-soft);
    border-color: rgba(130, 145, 169, 0.7);
}

/* Row actions */

.row-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
}

.action-sep {
    color: var(--text-soft);
    font-size: 11px;
}

.rename-form {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 0;
}

.input-rename {
    width: 140px;
    font-size: 12px;
    padding: 4px 6px;
}

/* Editor */

.editor-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.editor-textarea {
    width: 100%;
    min-height: 420px;
    resize: vertical;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: #050a16;
    color: var(--text-main);
    font-family: "JetBrains Mono", "Fira Code", monospace;
    font-size: 12px;
    padding: 8px 10px;
}

.editor-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 1px #14d0ff55;
}

.editor-actions {
    display: flex;
    gap: 8px;
}

/* Textarea in toolbar */

.input-textarea {
    width: 100%;
    margin-top: 4px;
    resize: vertical;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: #050a16;
    color: var(--text-main);
    font-size: 12px;
}

/* Responsive-ish */

@media (max-width: 900px) {
    .sidebar {
        display: none;
    }
    .main {
        width: 100%;
    }
}

/* CodeMirror integration – Delticom-dark flavor */
.CodeMirror {
    background: #050a16;
    color: var(--text-main);
    border-radius: 10px;
    border: 1px solid rgba(20, 208, 255, 0.35);
    font-size: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65);
}

.CodeMirror-gutters {
    background: #050814;
    border-right: 1px solid rgba(27, 225, 255, 0.25);
}

.CodeMirror-linenumber {
    color: var(--text-soft);
}

.CodeMirror-cursor {
    border-left: 1px solid #6feaff !important;
}

.CodeMirror-selected {
    background: rgba(20, 208, 255, 0.25) !important;
}

.cm-property,
.cm-attribute,
.cm-def {
    color: #6feaff;
}

.cm-keyword,
.cm-tag {
    color: #ff9d57;
}

.cm-string,
.cm-string-2 {
    color: #9eff8f;
}

.cm-comment {
    color: #6d7992;
    font-style: italic;
}

/* -------- Upload overlay ---------- */

.upload-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 7, 16, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.upload-overlay-inner {
    background: linear-gradient(135deg, #101f33, #162b45);
    border-radius: var(--radius-lg);
    padding: 12px 18px;
    border: 1px solid rgba(20, 208, 255, 0.7);
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-soft);
}

.upload-spinner {
    width: 20px;
    height: 20px;
    border-radius: 999px;
    border: 3px solid rgba(20, 208, 255, 0.2);
    border-top-color: var(--accent-soft);
    animation: upload-spin 0.8s linear infinite;
}

@keyframes upload-spin {
    to { transform: rotate(360deg); }
}

.upload-overlay-title {
    font-size: 13px;
    font-weight: 600;
}

.upload-overlay-label {
    font-size: 12px;
    color: var(--text-soft);
}