/* CSS Variables & Theme Definitions */
:root {
    /* Colors */
    --primary-bg: #EAEFF5; /* Premium soft blue-gray background */
    --sidebar-bg: #FFFFFF;
    --sidebar-text: #64748B;
    --sidebar-active-bg: #EEF2FF;
    --sidebar-active-text: #4F46E5; /* Indigo brand color */
    
    --card-bg: #FFFFFF;
    --text-main: #1E293B;
    --text-muted: #64748B;
    --border-color: #E2E8F0;
    
    --accent-blue: #3B82F6;
    --accent-indigo: #4F46E5;
    
    --success: #10B981;
    
    /* Effects */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    --shadow-card: 0 12px 24px -10px rgba(15, 23, 42, 0.05); /* Soft, luxurious shadow */
    
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    --transition-fast: 0.15s ease;
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--primary-bg);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ================== SIDEBAR ================== */
.sidebar {
    width: 270px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    z-index: 10;
    transition: width var(--transition-smooth), opacity var(--transition-smooth), transform var(--transition-smooth);
    overflow-x: hidden;
}

/* 侧边栏隐藏状态 */
.sidebar-hidden .sidebar {
    width: 0;
    border-right: none;
    opacity: 0;
    pointer-events: none;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
}

.logo-icon {
    font-size: 24px;
    color: var(--accent-indigo);
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
    margin-left: 36px;
    font-weight: 500;
}

.sidebar-nav {
    padding: 24px 16px;
    flex: 1;
    overflow-y: auto;
}

.nav-group {
    margin-bottom: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
    user-select: none;
}

.nav-item i:first-child {
    font-size: 18px;
    margin-right: 14px;
    width: 20px;
    text-align: center;
}

.toggle-icon {
    margin-left: auto;
    font-size: 12px!important;
    transition: transform var(--transition-smooth);
}

.nav-item:hover {
    background-color: #F8FAFC;
    color: var(--text-main);
}

.nav-item.active {
    background-color: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 60%;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background-color: var(--accent-indigo);
}

.nav-item.expanded .toggle-icon {
    transform: rotate(180deg);
}

.sub-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-smooth);
    margin-left: 21px; /* Center align with parent icon */
    padding-left: 17px;
    border-left: 1px solid var(--border-color);
}

.sub-menu.open {
    max-height: 200px; /* Arbitrary large enough height */
    padding-top: 4px;
    padding-bottom: 4px;
}

.sub-nav-item {
    padding: 10px 16px;
    font-size: 14px;
    color: var(--sidebar-text);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    margin-top: 2px;
}

.sub-nav-item i {
    margin-right: 10px;
    font-size: 14px;
    opacity: 0.7;
}

.sub-nav-item:hover {
    color: var(--text-main);
    background-color: #F8FAFC;
}

.sub-nav-item.active {
    color: var(--accent-indigo);
    background-color: var(--sidebar-active-bg);
    font-weight: 600;
}

/* ================== MAIN CONTENT ================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.topbar {
    height: 80px;
    padding: 0 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
    z-index: 5;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.sidebar-toggle-btn {
    background: white;
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--sidebar-text);
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.sidebar-toggle-btn:hover {
    color: var(--accent-indigo);
    background-color: var(--sidebar-active-bg);
    border-color: var(--accent-indigo);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card-bg);
    padding: 6px 16px 6px 6px;
    border-radius: 50px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: var(--transition-fast);
}

.user-profile:hover {
    box-shadow: var(--shadow-md);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

.user-role {
    font-size: 12px;
    color: var(--text-muted);
}

/* ================== CONTENT VIEWS ================== */
.content-area {
    flex: 1;
    padding: 0 40px 40px 40px;
    overflow-y: auto;
    position: relative;
}

.view-panel {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.view-panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ================== DOWNLOADS VIEW ================== */
.section-block {
    margin-bottom: 40px;
}

.section-header {
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
}

.section-header p {
    font-size: 14px;
    color: var(--text-muted);
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.resource-card {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-card);
    transition: var(--transition-smooth);
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
}

.card-header-flex {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}


.resource-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08); /* Elevated shadow */
    border-color: #E2E8F0;
}

.card-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
}


.card-icon.win11 { color: #0078D4; background: rgba(0, 120, 212, 0.1); }
.card-icon.win10 { color: #00A4EF; background: rgba(0, 164, 239, 0.1); }
.card-icon.soft { color: #8B5CF6; background: rgba(139, 92, 246, 0.1); }
.card-icon.driver { color: #F59E0B; background: rgba(245, 158, 11, 0.1); }

.card-info {
    flex: 1;
    margin-bottom: 24px;
}

.card-header-flex h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

.card-info p {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
}

.btn {
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
}

.btn-primary {
    background-color: var(--accent-indigo);
    color: white;
}

.btn-primary:hover {
    background-color: #4338CA;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-success:hover {
    background-color: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-secondary {
    background-color: #F1F5F9;
    color: var(--text-main);
}

.btn:disabled {
    background-color: #E2E8F0 !important;
    color: #94A3B8 !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
    opacity: 0.7;
}

/* ================== COMPACT MODE (FOR SOFTWARE) ================== */
#view-downloads-soft .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

#view-downloads-soft .resource-card {
    padding: 16px;
}

#view-downloads-soft .card-header-flex {
    gap: 12px;
    margin-bottom: 12px;
}

#view-downloads-soft .card-icon {
    width: 44px;
    height: 44px;
    font-size: 20px;
}

#view-downloads-soft .card-header-flex h3 {
    font-size: 15px;
}

#view-downloads-soft .card-info p {
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 12px;
}

#view-downloads-soft .btn {
    padding: 8px 12px;
    font-size: 13px;
}

/* ================== TABLE (SETTLEMENT) ================== */
.full-height {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-card);
}

.data-table-container {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th, .data-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background-color: #F8FAFC;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody tr:hover {
    background-color: #F8FAFC;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table td {
    font-size: 14px;
    color: var(--text-main);
}

.data-table td.amount {
    font-family: 'Inter', monospace;
    font-weight: 600;
    color: var(--text-main);
}

.status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status.success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

/* ================== TUTORIAL VIEWS ================== */
.tutorial-hero {
    border-radius: var(--radius-lg);
    padding: 60px 40px;
    color: white;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
}

.tutorial-hero h1 {
    font-size: 32px;
    margin-bottom: 12px;
    font-weight: 700;
}

.tutorial-hero p {
    font-size: 16px;
    opacity: 0.9;
}

.wepe-bg { background: linear-gradient(135deg, #0284C7, #2563EB); }
.rufus-bg { background: linear-gradient(135deg, #DF2A2A, #991B1B); }
.ultra-bg { background: linear-gradient(135deg, #059669, #047857); }

.card-container {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-card);
}

.card-container h2 {
    font-size: 20px;
    margin-bottom: 24px;
    color: var(--text-main);
    font-weight: 600;
}

.steps {
    list-style: none;
    counter-reset: step;
}

.steps li {
    position: relative;
    padding-left: 50px;
    margin-bottom: 24px;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-main);
}

.steps li::before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    left: 0;
    top: -2px;
    width: 32px;
    height: 32px;
    background-color: var(--sidebar-active-bg);
    color: var(--accent-indigo);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.steps li strong {
    color: var(--text-main);
    font-weight: 600;
}

.steps li code {
    background: #F1F5F9;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    color: #E11D48;
}

/* ================== FILTER BAR ================== */
.filter-bar {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    margin-bottom: 24px;
    padding: 20px;
    background: #F8FAFC;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.form-control {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-main);
    background: var(--card-bg);
    outline: none;
    transition: var(--transition-fast);
    min-width: 180px;
    font-family: inherit;
}

.form-control:focus {
    border-color: var(--accent-indigo);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.btn-search {
    padding: 10px 24px;
    height: 42px; /* aligns with input */
    margin-left: auto; /* Push to right slightly */
}

/* ================== EXTRA COMPONENTS ================== */
.header-with-badge {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-badge {
    display: inline-flex;
    align-items: center;
    background: #EEF2FF;
    border: 1px solid #C7D2FE;
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 13px;
    color: #4338CA;
    gap: 12px;
}

.badge-label {
    font-weight: 700;
}

.tier-item {
    opacity: 0.8;
}

.tier-item em {
    font-style: normal;
    font-weight: 700;
    margin: 0 2px;
    color: var(--accent-indigo);
}

.total-item {
    border-left: 1px solid #C7D2FE;
    padding-left: 12px;
}

.total-item strong {
    font-size: 15px;
    color: #1E1B4B;
}

/* Tags & Mini Table styles */
.tag {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.tag-blue { background: #E0E7FF; color: #4338CA; }
.tag-gray { background: #F1F5F9; color: #475569; }

.price-tier-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
}

.price-tier-info.inline {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
}

.price-tier-info span {
    background: #F8FAFC;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #EDF2F7;
}

.btn-text {
    background: none;
    border: none;
    color: var(--accent-indigo);
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 4px;
}

.btn-text:hover {
    background: #F3F4F6;
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent-indigo);
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    font-size: 14px;
}

.btn-link:hover {
    color: #4338CA;
}

/* ================== MODAL SYSTEM ================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    width: 650px;
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.95);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 24px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-body {
    padding: 30px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid var(--border-color);
    background: #F8FAFC;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Form layouts in modal */
.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

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

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.full-width { width: 100%; min-width: 0; }

.form-section {
    margin-top: 30px;
}

.form-section h4 {
    font-size: 14px;
    color: var(--text-main);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--border-color);
}

.price-config-box {
    background: #F8FAFC;
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.config-type-toggle {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
}

.radio-label {
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.tier-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.tier-row span {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

.input-with-unit {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-with-unit input {
    width: 100px;
    text-align: right;
}

.input-with-unit em {
    font-style: normal;
    font-size: 12px;
    color: var(--text-muted);
}

.filter-actions {
    margin-left: auto;
    display: flex;
    gap: 12px;
}

.btn-add {
    margin: 0;
}
