/* Version Management System Theme - Tech/Pro Max Style */
:root {
    /* Color Palette - Deep Space & Neon */
    --bg-deep: #0b0e14;
    --bg-surface: #151b26;
    --bg-surface-hover: #1e2532;
    --bg-glass: rgba(21, 27, 38, 0.7);

    --primary-hue: 220;
    /* Blue/Indigo */
    --primary-color: hsl(var(--primary-hue), 90%, 60%);
    --primary-glow: hsl(var(--primary-hue), 90%, 60%, 0.4);
    --primary-dim: hsl(var(--primary-hue), 60%, 20%);

    --accent-color: #06b6d4;
    /* Cyan */
    --accent-glow: rgba(6, 182, 212, 0.3);

    --success-color: #10b981;
    --success-glow: rgba(16, 185, 129, 0.2);

    --text-main: #eff6ff;
    --text-muted: #94a3b8;
    --text-dim: #475569;

    --border-color: #2d3748;
    --border-highlight: #4a5568;

    --sidebar-width: 260px;
    --header-height: 70px;
}

body {
    background-color: var(--bg-deep);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    margin: 0;
    overflow-x: hidden;
    overflow-y: auto;
    height: auto;
    width: 100%;
}

/* Background Effects */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 15% 50%, rgba(56, 189, 248, 0.08) 0%, transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(99, 102, 241, 0.08) 0%, transparent 25%);
    z-index: -1;
    pointer-events: none;
}

/* Header - Tech Glass */
.header-std {
    height: var(--header-height);
    background: rgba(11, 14, 20, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-brand {
    display: flex;
    align-items: center;
}

.logo-icon {
    color: var(--primary-color);
    filter: drop-shadow(0 0 8px var(--primary-glow));
}

.logo-text {
    font-weight: 700;
    margin-left: 12px;
    font-size: 1.35rem;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.01em;
}

.header-actions-std .btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.header-actions-std .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border-color: var(--border-highlight);
}

/* Layout */
.version-layout {
    display: flex;
    max-width: 1600px;
    margin: 0 auto;
    min-height: calc(100vh - var(--header-height));
}

/* Sidebar */
.version-sidebar {
    width: var(--sidebar-width);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    background: rgba(11, 14, 20, 0.4);
    backdrop-filter: blur(5px);
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    margin-bottom: 1.25rem;
    padding-left: 0.75rem;
    font-weight: 600;
}

.app-nav-item {
    display: flex;
    align-items: center;
    padding: 0.85rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease-out;
    border: 1px solid transparent;
}

.app-nav-item:hover {
    background: var(--bg-surface-hover);
    color: var(--text-main);
}

.app-nav-item.active {
    background: linear-gradient(90deg, rgba(14, 165, 233, 0.15) 0%, rgba(14, 165, 233, 0.05) 100%);
    color: var(--primary-color);
    border-color: rgba(14, 165, 233, 0.2);
    box-shadow: 0 0 15px rgba(14, 165, 233, 0.05);
}

/* Main Content */
.version-main {
    flex: 1;
    padding: 3rem;
    overflow-x: hidden;
}

/* Hero Card (Latest Version) */
.version-card#latestCard {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0%, rgba(20, 30, 50, 0.9) 100%);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2.5rem;
    margin-bottom: 3rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.3);
}

/* Glow accent for latest card */
.version-card#latestCard::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle at top right, var(--primary-glow) 0%, transparent 60%);
    opacity: 0.4;
    pointer-events: none;
}

.hero-label {
    font-size: 0.875rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hero-label::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-color);
    box-shadow: 0 0 8px var(--accent-color);
}

.display-version {
    font-size: 4.5rem;
    font-weight: 800;
    margin: 0.5rem 0 1rem;
    letter-spacing: -0.02em;
    background: linear-gradient(180deg, #fff 20%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
}

.hero-meta {
    display: flex;
    gap: 2rem;
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    width: 100%;
}

.hero-btn {
    background: var(--text-main);
    color: var(--bg-deep);
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.15);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.hero-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 255, 255, 0.25);
    background: #fff;
}

/* Version List Header */
.version-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.version-header h2 {
    font-size: 1.5rem;
    color: var(--text-main);
    margin: 0;
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px var(--primary-dim);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary:hover {
    background: hsl(var(--primary-hue), 90%, 65%);
    box-shadow: 0 0 15px var(--primary-glow);
    transform: translateY(-1px);
}

/* Timeline/Table Style */
.version-card.table-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.version-table {
    width: 100%;
    border-collapse: collapse;
}

.version-table th {
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-dim);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    padding: 1rem 1.5rem;
    letter-spacing: 0.05em;
    text-align: left;
}

.version-table td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-muted);
    vertical-align: top;
}

.version-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.version-badge {
    background: var(--border-color);
    color: var(--text-main);
    padding: 4px 10px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.85rem;
    border: 1px solid transparent;
}

.latest-badge {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.1);
}

.changelog-text {
    line-height: 1.6;
    max-width: 480px;
}

.file-meta {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 4px;
}

/* Upload Modal - Dark */
.modal {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
}

.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    color: var(--text-main);
    min-width: 600px;
    max-width: 800px;
    width: 90%;
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
}

.form-group label {
    color: var(--text-muted);
}

.form-group input,
.form-group textarea {
    background: var(--bg-deep);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 100%;
    box-sizing: border-box;
    padding: 0.75rem;
    border-radius: 0.375rem;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-dim);
    outline: none;
}

/* Upload Dropzone */
.upload-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(0, 0, 0, 0.2);
}

.upload-dropzone:hover {
    border-color: var(--primary-color);
    background: rgba(14, 165, 233, 0.05);
}

.upload-icon {
    width: 48px;
    height: 48px;
    color: var(--text-dim);
    margin-bottom: 1rem;
}

/* =================================================================
   Mobile / Responsive Adaptations
   ================================================================= */

@media (max-width: 768px) {

    /* Header Adjustments */
    .header-std {
        padding: 0 1rem;
    }

    .logo-text {
        font-size: 1.1rem;
    }

    .header-actions-std .btn-secondary {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    /* Layout */
    .version-layout {
        flex-direction: column;
        display: block;
    }

    /* Sidebar - Horizontal Scroll */
    .version-sidebar {
        width: 100%;
        height: auto;
        position: sticky;
        top: var(--header-height);
        z-index: 40;
        padding: 0.75rem 1rem;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        display: flex;
        overflow-x: auto;
        white-space: nowrap;
        background: rgba(11, 14, 20, 0.95);
        -webkit-overflow-scrolling: touch;
        gap: 0.5rem;
        box-sizing: border-box;
    }

    .version-sidebar::-webkit-scrollbar {
        height: 0px;
        /* Hide scrollbar for cleaner look, usually native works fine */
    }

    .sidebar-title {
        display: none;
    }

    .app-nav-item {
        margin-bottom: 0;
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        flex-shrink: 0;
    }

    /* Main Content */
    .version-main {
        padding: 1.5rem 1rem;
    }

    /* Hero Card */
    .version-card#latestCard {
        padding: 1.5rem;
        margin-bottom: 2rem;
    }

    .display-version {
        font-size: 3rem;
    }

    .hero-meta {
        flex-direction: column;
        gap: 1rem;
        padding-bottom: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .hero-btn {
        width: 100%;
        justify-content: center;
    }

    /* Header Actions */
    .version-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .version-header button {
        width: 100%;
        justify-content: center;
    }

    /* Table -> Cards */
    .version-table thead {
        display: none;
    }

    .version-table,
    .version-table tbody,
    .version-table tr,
    .version-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    .version-table tr {
        margin-bottom: 1.5rem;
        background: var(--bg-surface);
        border: 1px solid var(--border-color);
        border-radius: 12px;
        padding: 0;
        overflow: hidden;
    }

    .version-table td {
        padding: 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
    }

    .version-table td:last-child {
        border-bottom: none;
    }

    /* Card Info Mapping */

    /* 1. Version & App Name */
    .version-table td:nth-of-type(1) {
        background: rgba(0, 0, 0, 0.2);
        justify-content: flex-start;
    }

    .version-table td:nth-of-type(1)>div {
        flex-wrap: wrap;
    }

    /* 2. Changelog */
    .version-table td:nth-of-type(2) {
        display: block;
        text-align: left;
    }

    .version-table td:nth-of-type(2)::before {
        content: '发布说明';
        display: block;
        font-size: 0.75rem;
        color: var(--text-dim);
        margin-bottom: 0.5rem;
        text-transform: uppercase;
        font-weight: 600;
    }

    .changelog-text {
        max-width: 100%;
        white-space: pre-wrap;
    }

    /* 3. File */
    .version-table td:nth-of-type(3)::before {
        content: '固件包';
        color: var(--text-dim);
        font-size: 0.85rem;
        font-weight: 600;
        margin-right: 1rem;
    }

    /* 4. Time */
    .version-table td:nth-of-type(4)::before {
        content: '发布时间';
        color: var(--text-dim);
        font-size: 0.85rem;
        font-weight: 600;
        margin-right: 1rem;
    }

    /* 5. Actions */
    .version-table td:nth-of-type(5) {
        background: rgba(0, 0, 0, 0.1);
        justify-content: flex-end;
        padding: 0.75rem;
    }

    /* Modal */
    .modal-content {
        min-width: auto;
        width: 90%;
        margin: 1rem auto;
        max-height: 85vh;
        overflow-y: auto;
    }

    .modal-body form {
        display: flex;
        flex-direction: column;
    }

    /* Upload form grid to column */
    .modal-body form>div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
}