:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --border-color: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-glow: rgba(59, 130, 246, 0.25);
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --warning: #f59e0b;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
}

.app-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-badge {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: white;
    font-weight: 700;
    font-size: 18px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    letter-spacing: 0.5px;
    box-shadow: 0 0 15px var(--accent-glow);
}

.app-header h1 {
    font-size: 20px;
    font-weight: 600;
}

.subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.catalog-badge {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 13px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

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

.btn-primary:hover:not(:disabled) {
    background-color: var(--accent-hover);
    box-shadow: 0 0 12px var(--accent-glow);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-outline {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background-color: var(--border-color);
}

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

.btn-success:hover {
    background-color: #059669;
}

.btn-block {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    margin-top: 16px;
}

/* Grid Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 24px;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.panel {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--card-shadow);
}

.panel h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

/* Dropzone */
.dropzone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 28px 16px;
    text-align: center;
    cursor: pointer;
    background-color: rgba(15, 23, 42, 0.4);
    transition: all 0.2s;
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--accent);
    background-color: rgba(59, 130, 246, 0.05);
}

.dropzone-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.dropzone-text {
    font-size: 14px;
    margin-bottom: 4px;
}

.dropzone-hint {
    font-size: 11px;
    color: var(--text-secondary);
}

/* File List */
.file-list-container {
    margin-top: 16px;
}

.file-list-container h3 {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.file-list {
    list-style: none;
    max-height: 140px;
    overflow-y: auto;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background-color: rgba(15, 23, 42, 0.6);
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    font-size: 12px;
}

.file-item-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}

.file-item-size {
    color: var(--text-secondary);
}

.form-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 20px 0;
}

/* Form Controls */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    font-size: 13px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--accent);
}

.form-row {
    display: flex;
    gap: 12px;
}

.col-half {
    flex: 1;
}

/* Results Panel */
.results-panel {
    display: flex;
    flex-direction: column;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.actions-group {
    display: flex;
    gap: 10px;
}

/* Empty State */
.empty-state {
    padding: 80px 20px;
    text-align: center;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.6;
}

.empty-state h3 {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 6px;
}

/* Loader */
.loader-container {
    padding: 80px 20px;
    text-align: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(59, 130, 246, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

/* Metric Cards */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.metric-card {
    background-color: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
}

.metric-title {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.metric-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
}

/* Brand Tabs */
.brand-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    overflow-x: auto;
}

.brand-tab {
    background-color: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    padding: 6px 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.brand-tab:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

.brand-tab.active {
    background-color: var(--accent);
    color: white;
    font-weight: 500;
}

/* Table */
.table-container {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: auto;
    max-height: 520px;
}

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

.data-table th {
    background-color: #131d2e;
    padding: 10px 12px;
    font-weight: 600;
    color: var(--text-secondary);
    position: sticky;
    top: 0;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 9px 12px;
    border-bottom: 1px solid rgba(51, 65, 85, 0.4);
    white-space: nowrap;
}

.data-table tbody tr:hover {
    background-color: rgba(59, 130, 246, 0.04);
}

.scheme-badge {
    background-color: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 3px 8px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
}

.variant-id-badge {
    font-family: 'JetBrains Mono', monospace;
    color: #cbd5e1;
    font-weight: 500;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 480px;
    max-width: 90%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

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

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

.modal-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 30px;
    text-align: center;
    cursor: pointer;
    margin: 16px 0;
}

.modal-dropzone:hover {
    border-color: var(--accent);
}

.status-msg {
    font-size: 13px;
    margin-top: 10px;
}

.status-msg.success {
    color: var(--success);
}

.status-msg.error {
    color: #ef4444;
}

/* Downloads Section */
.downloads-section {
    background-color: rgba(31, 41, 55, 0.4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 24px;
}

.download-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.download-section-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.download-section-title h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.download-icon {
    font-size: 24px;
}

/* Tier 1: Big ZIP Download Card */
.zip-download-card {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.15) 0%, rgba(16, 185, 129, 0.15) 100%);
    border: 1px solid rgba(59, 130, 246, 0.4);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.zip-download-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.25);
}

.zip-card-content {
    flex: 1;
}

.zip-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    background-color: rgba(59, 130, 246, 0.25);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.4);
    padding: 2px 8px;
    border-radius: 9999px;
    margin-bottom: 6px;
}

.zip-title {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    font-family: monospace;
    margin-bottom: 4px;
}

.zip-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

.zip-download-btn {
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.file-size-pill {
    background: rgba(0, 0, 0, 0.25);
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 11px;
    font-family: monospace;
}

/* Tier 2: Single Files Section */
.single-files-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.single-files-header h4 {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin: 0;
}

.single-files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.single-file-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
    transition: transform 0.15s, border-color 0.15s;
}

.single-file-card:hover {
    border-color: rgba(59, 130, 246, 0.5);
    transform: translateY(-1px);
}

.single-file-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.single-file-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.format-badge {
    font-size: 10px;
    font-weight: 700;
    font-family: monospace;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.format-badge.xlsx {
    background-color: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.format-badge.csv {
    background-color: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.single-file-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-secondary);
}

.single-file-filename {
    font-family: monospace;
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
}

.btn-single-download {
    width: 100%;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
}

.btn-single-download.btn-xlsx {
    background-color: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.btn-single-download.btn-xlsx:hover {
    background-color: #10b981;
    color: #ffffff;
}

.btn-single-download.btn-csv {
    background-color: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.btn-single-download.btn-csv:hover {
    background-color: #3b82f6;
    color: #ffffff;
}

