/* ── Dark Theme ── */
html[data-theme="dark"] {
    color-scheme: dark;
}

/* Body & page backgrounds */
html[data-theme="dark"] body {
    background: #0f0f1a !important;
    color: #e0e0e0 !important;
}
html[data-theme="dark"] body.gradient-bg {
    background: linear-gradient(135deg, #1a1a3e 0%, #2d1b4e 100%) !important;
}

/* Containers / cards / panels */
html[data-theme="dark"] .container,
html[data-theme="dark"] .date-group,
html[data-theme="dark"] .url-check-panel,
html[data-theme="dark"] .result-card,
html[data-theme="dark"] .pincode-info,
html[data-theme="dark"] .filters,
html[data-theme="dark"] .login-card,
html[data-theme="dark"] .check-card,
html[data-theme="dark"] .info-card {
    background: #1e1e2e !important;
    color: #e0e0e0 !important;
}

/* White backgrounds */
html[data-theme="dark"] [style*="background: white"],
html[data-theme="dark"] [style*="background:white"],
html[data-theme="dark"] [style*="background:#fff"],
html[data-theme="dark"] [style*="background: #fff"] {
    background: #1e1e2e !important;
    color: #e0e0e0 !important;
}

/* Stat cards, variation bars, panels */
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .url-stat,
html[data-theme="dark"] .variation-bar,
html[data-theme="dark"] .report-viewer,
html[data-theme="dark"] .category-filter,
html[data-theme="dark"] .url-check-body,
html[data-theme="dark"] .url-section,
html[data-theme="dark"] .url-item {
    background: #252535 !important;
    border-color: #3a3a5c !important;
    color: #e0e0e0 !important;
}

html[data-theme="dark"] .variation-bar {
    background: #2a2410 !important;
    border-color: #5a4e20 !important;
}
html[data-theme="dark"] .variation-bar[style*="background:#e8f5e9"],
html[data-theme="dark"] .variation-bar[style*="background: #e8f5e9"] {
    background: #0d2e1a !important;
    border-color: #1a5c30 !important;
}

/* Table */
html[data-theme="dark"] table {
    background: #1e1e2e !important;
    color: #e0e0e0 !important;
}
html[data-theme="dark"] thead {
    background: linear-gradient(135deg, #3a3a7e 0%, #4a2a6e 100%) !important;
}
html[data-theme="dark"] .data-table th {
    background: #252540 !important;
    color: #c0c0e0 !important;
}
html[data-theme="dark"] td {
    border-bottom-color: #2d2d45 !important;
    color: #d0d0e8 !important;
}
html[data-theme="dark"] tbody tr:hover,
html[data-theme="dark"] .data-table tr:hover td {
    background: #252540 !important;
}
html[data-theme="dark"] .table-wrap {
    border-color: #3a3a5c !important;
}

/* Inputs, selects */
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
    background: #252535 !important;
    color: #e0e0e0 !important;
    border-color: #3a3a5c !important;
}
html[data-theme="dark"] input::placeholder {
    color: #666688 !important;
}
html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus {
    border-color: #667eea !important;
    outline: none !important;
}

/* File items */
html[data-theme="dark"] .file-item {
    border-bottom-color: #2d2d45 !important;
}
html[data-theme="dark"] .file-item:hover {
    background: #252540 !important;
}
html[data-theme="dark"] .file-name { color: #d0d0ee !important; }
html[data-theme="dark"] .file-meta { color: #7070aa !important; }

/* Text colors */
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4 {
    color: #b0b0ff !important;
}
html[data-theme="dark"] p,
html[data-theme="dark"] label,
html[data-theme="dark"] .results-count { color: #c0c0d8 !important; }
html[data-theme="dark"] strong { color: #b0b0ff !important; }
html[data-theme="dark"] .subtitle { color: rgba(255,255,255,0.75) !important; }

/* Links */
html[data-theme="dark"] a { color: #9090ff !important; }
html[data-theme="dark"] .product-link { color: #c0c0ff !important; border-bottom-color: #555 !important; }
html[data-theme="dark"] .product-link:hover { color: #9090ff !important; }
html[data-theme="dark"] .dl-filtered { color: #9090ff !important; }

/* Badges */
html[data-theme="dark"] .count-badge { background: #333355 !important; color: #c0c0e0 !important; }
html[data-theme="dark"] .cat-badge { background: #0d2e1a !important; color: #5dd897 !important; }
html[data-theme="dark"] .sheet-yes { background: #0d2e1a !important; color: #5dd897 !important; }
html[data-theme="dark"] .sheet-no { background: #2e0d0d !important; color: #ff8080 !important; }
html[data-theme="dark"] .sheet-mismatch { background: #2e2200 !important; color: #ffcc55 !important; }
html[data-theme="dark"] .sheet-na { background: #252535 !important; color: #8888aa !important; }
html[data-theme="dark"] .pin-tag { background: #252535 !important; border-color: #3a3a5c !important; color: #c0c0ff !important; }

/* Toggle buttons */
html[data-theme="dark"] .toggle-btn {
    background: #1e1e2e !important;
}
html[data-theme="dark"] .toggle-btn.active {
    color: white !important;
}

/* Error / success text */
html[data-theme="dark"] .url-check-ok { color: #5dd897 !important; }

/* Hover states on f8f9ff */
html[data-theme="dark"] [style*="#f8f9ff"],
html[data-theme="dark"] [style*="f8f9fa"] { background: #252535 !important; }

/* Scrollbar */
html[data-theme="dark"] ::-webkit-scrollbar { width: 8px; height: 8px; }
html[data-theme="dark"] ::-webkit-scrollbar-track { background: #1e1e2e; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #3a3a6c; border-radius: 4px; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #5555aa; }

/* Theme toggle button */
.theme-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1.3em;
    box-shadow: 0 4px 14px rgba(0,0,0,0.3);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}
.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
