/*
 * LinkSight - Consolidated CSS
 * ============================================
 * Single source of truth for all UI styling
 * Last updated: 2026-01-04
 */

/* ============================================
 * 1. CSS VARIABLES & THEME
 * ============================================ */
:root {
    --bg-primary: #000;
    --bg-sidebar: rgba(2, 6, 23, 0.9);
    --bg-card: rgba(15, 23, 42, 0.7);
    --bg-input: rgba(15, 23, 42, 0.8);
    --border-primary: rgba(51, 65, 85, 0.7);
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
}

[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f1f5f9;
    --border-primary: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
}

/* Theme-based logo switching */
/* Default/Light theme: show light logo (black text) */
.logo-light {
    display: block;
}

.logo-dark {
    display: none;
}

/* Dark theme: show dark logo (white text) */
[data-theme="dark"] .logo-light {
    display: none;
}

[data-theme="dark"] .logo-dark {
    display: block;
}

/* ============================================
 * 2. BASE STYLES
 * ============================================ */
html {
    background: var(--bg-primary);
}

body {
    background: radial-gradient(ellipse at top center, #172554 0%, #020617 45%, #000 75%);
    background-attachment: fixed;
    background-size: 100% 100%;
    min-height: 100vh;
    color: #e5e7eb;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}

/* ============================================
 * 3. LIGHT THEME OVERRIDES
 * ============================================ */
[data-theme="light"] body {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    color: #334155;
}

[data-theme="light"] .card {
    background: white !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1) !important;
}

[data-theme="light"] #sidebar {
    background: white !important;
    border-color: #e2e8f0 !important;
}

[data-theme="light"] .nav-link {
    color: #334155;
}

[data-theme="light"] .nav-link:hover {
    background: rgba(234, 88, 12, 0.1);
    border-color: rgba(234, 88, 12, 0.4);
}

[data-theme="light"] .nav-link-active {
    background: rgba(234, 88, 12, 0.15) !important;
    border-color: rgba(234, 88, 12, 0.6) !important;
}

[data-theme="light"] .text-slate-50,
[data-theme="light"] .text-slate-100 {
    color: #0f172a !important;
}

[data-theme="light"] .text-slate-200 {
    color: #334155 !important;
}

[data-theme="light"] .text-slate-300,
[data-theme="light"] .text-slate-400 {
    color: #475569 !important;
}

[data-theme="light"] .text-sky-300,
[data-theme="light"] .text-sky-400 {
    color: #ea580c !important;
}

[data-theme="light"] .pill {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
}

[data-theme="light"] .bg-slate-900\/70,
[data-theme="light"] .bg-slate-900\/80,
[data-theme="light"] .bg-slate-900\/95,
[data-theme="light"] .bg-slate-950\/90 {
    background: #f1f5f9 !important;
}

[data-theme="light"] .border-slate-600\/70,
[data-theme="light"] .border-slate-600\/80,
[data-theme="light"] .border-slate-700\/70,
[data-theme="light"] .border-slate-800\/70 {
    border-color: #cbd5e1 !important;
}

[data-theme="light"] .bg-slate-800\/50,
[data-theme="light"] .hover\:bg-slate-800\/50:hover {
    background: #e2e8f0 !important;
}

[data-theme="light"] .bg-slate-800\/90 {
    background: #e2e8f0 !important;
}

[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
    color: #1e293b !important;
}

[data-theme="light"] input::placeholder,
[data-theme="light"] textarea::placeholder {
    color: #94a3b8 !important;
}

[data-theme="light"] #themeSelect {
    background: #f1f5f9 !important;
    color: #1e293b !important;
    border-color: #cbd5e1 !important;
}

/* ============================================
 * 4. CARD & PILL COMPONENTS
 * ============================================ */
.card {
    background: radial-gradient(circle at top left, rgba(59, 130, 246, 0.15), transparent 55%),
        radial-gradient(circle at bottom right, rgba(16, 185, 129, 0.1), transparent 60%),
        rgba(15, 23, 42, 0.96);
    border-radius: 1.25rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    padding: 1.25rem;
}

.pill {
    border-radius: 9999px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: radial-gradient(circle at top, rgba(59, 130, 246, 0.25), transparent 55%),
        rgba(15, 23, 42, 0.9);
}

/* Device Detail page-specific styles */
.label-sm {
    font-size: 0.75rem;
    color: #94a3b8;
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.025em;
}

.value-lg {
    font-size: 1rem;
    font-weight: 400;
    color: #f1f5f9;
}

.value-muted {
    color: #cbd5e1;
}

[data-theme="light"] .label-sm {
    color: #64748b;
}

[data-theme="light"] .value-lg {
    color: #1e293b;
}

[data-theme="light"] .value-muted {
    color: #475569;
}

/* Status pills for device detail */
.pill-online {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.1));
    border-color: rgba(16, 185, 129, 0.4);
    color: #10b981;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.pill-offline {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.1));
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Table header styling */
.table-header {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

[data-theme="light"] .table-header {
    color: #475569;
    border-color: #e2e8f0;
}

/* History select dropdown */
.history-select {
    min-width: 8rem;
}

[data-theme="light"] .history-select {
    background: #f1f5f9 !important;
    color: #1e293b !important;
    border-color: #cbd5e1 !important;
}

/* ============================================
 * 5. NAVIGATION LINKS
 * ============================================ */
.nav-link {
    border-radius: 9999px;
    padding: 0.6rem 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: #e5e7eb;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}

.nav-link span.icon {
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

.nav-link:hover {
    background: radial-gradient(circle at left, rgba(59, 130, 246, 0.22), transparent 60%);
    border-color: rgba(56, 189, 248, 0.4);
    transform: translateX(1px);
}

.nav-link-active {
    background: radial-gradient(circle at left, rgba(56, 189, 248, 0.35), transparent 60%),
        rgba(15, 23, 42, 0.9);
    border-color: rgba(56, 189, 248, 0.8);
}

.nav-link-active span.icon {
    background: linear-gradient(to bottom right, #38bdf8, #6366f1);
}

/* ============================================
 * 6. STATUS INDICATORS
 * ============================================ */
.status-dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 9999px;
    display: inline-block;
}

/* ============================================
 * 7. SIDEBAR & MOBILE RESPONSIVE
 * ============================================ */
@media (max-width: 1023px) {
    #sidebar {
        position: fixed;
        inset: 0 45% 0 0;
        max-width: 17rem;
        transform: translateX(-100%);
        transition: transform 0.2s ease-out;
        z-index: 40;
    }

    #sidebar.open {
        transform: translateX(0);
    }

    #sidebarOverlay {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.7);
        backdrop-filter: blur(6px);
        z-index: 30;
        display: none;
    }

    #sidebarOverlay.open {
        display: block;
    }
}

/* ============================================
 * 8. TABLE STYLES
 * ============================================ */
.table-row {
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    cursor: pointer;
    transition: background 0.15s;
}

.table-row:hover {
    background: rgba(59, 130, 246, 0.12);
}

.table-row:nth-child(odd) {
    background: rgba(30, 41, 59, .25);
}

.table-row:nth-child(even) {
    background: transparent;
}

[data-theme="light"] .table-row:nth-child(odd) {
    background: #f8fafc;
}

[data-theme="light"] .table-row:nth-child(even) {
    background: #ffffff;
}

.table-row-hover:hover {
    background: radial-gradient(circle at left, rgba(59, 130, 246, 0.2), transparent 60%);
    cursor: pointer;
}

.table-row-hover:nth-child(odd) {
    background: rgba(30, 41, 59, .25);
}

[data-theme="light"] .table-row-hover:nth-child(odd) {
    background: #f8fafc;
}

[data-theme="light"] .table-row-hover:hover {
    background: rgba(234, 88, 12, 0.1);
}

.sort-header {
    cursor: pointer;
    user-select: none;
}

.sort-header:hover {
    color: #38bdf8;
}

[data-theme="light"] .sort-header:hover {
    color: #ea580c;
}

/* ============================================
 * 9. DROPDOWN STYLES
 * ============================================ */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 0.5rem;
    min-width: 140px;
    z-index: 50;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.dropdown-content.show {
    display: block;
}

.dropdown-item {
    padding: 0.5rem 1rem;
    color: #e5e7eb;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dropdown-item:hover {
    background: rgba(59, 130, 246, 0.2);
}

[data-theme="light"] .dropdown-content {
    background: white;
    border-color: #e2e8f0;
}

[data-theme="light"] .dropdown-item {
    color: #334155;
}

[data-theme="light"] .dropdown-item:hover {
    background: rgba(234, 88, 12, 0.1);
}

[data-theme="light"] .dropdown button,
[data-theme="light"] #downloadBtn,
[data-theme="light"] #columnsBtn {
    background: white;
    border-color: #e2e8f0;
    color: #334155;
}

[data-theme="light"] .dropdown button:hover,
[data-theme="light"] #downloadBtn:hover,
[data-theme="light"] #columnsBtn:hover {
    background: #f8fafc;
}

[data-theme="light"] #limitSelect {
    background: white;
    border-color: #e2e8f0;
    color: #334155;
}

/* ============================================
 * 10. SCROLL SHADOWS
 * ============================================ */
.scroll-shadows::before,
.scroll-shadows::after {
    content: "";
    position: sticky;
    height: 1.5rem;
    pointer-events: none;
    z-index: 10;
}

.scroll-shadows::before {
    top: 0;
    background: linear-gradient(to bottom, rgba(15, 23, 42, 1), rgba(15, 23, 42, 0));
}

.scroll-shadows::after {
    bottom: 0;
    background: linear-gradient(to top, rgba(15, 23, 42, 1), rgba(15, 23, 42, 0));
}

[data-theme="light"] .scroll-shadows::before {
    background: linear-gradient(to bottom, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
}

[data-theme="light"] .scroll-shadows::after {
    background: linear-gradient(to top, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
}

/* ============================================
 * 11. FORM STYLES
 * ============================================ */
.form-input {
    width: 100%;
    border-radius: 0.75rem;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(51, 65, 85, 0.7);
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    color: #f1f5f9;
}

.form-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.7);
    border-color: #0ea5e9;
}

.form-input::placeholder {
    color: #64748b;
}

/* ============================================
 * 12. BUTTON STYLES
 * ============================================ */
.btn-primary {
    background: linear-gradient(to right, #0ea5e9, #6366f1);
    color: white;
    font-weight: 600;
    padding: 0.625rem 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    transition: all 0.2s;
}

.btn-primary:hover {
    background: linear-gradient(to right, #38bdf8, #818cf8);
}

.btn-secondary {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(51, 65, 85, 0.7);
    color: #e5e7eb;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: rgba(30, 41, 59, 0.8);
}

[data-theme="light"] .btn-secondary {
    background: white;
    border-color: #e2e8f0;
    color: #334155;
}

[data-theme="light"] .btn-secondary:hover {
    background: #f8fafc;
}

/* ============================================
 * 13. CHART CONTAINERS
 * ============================================ */
.chart-container {
    position: relative;
    width: 100%;
    height: 100%;
}

/* ============================================
 * 14. ALERT STYLES
 * ============================================ */
.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
}

.alert-error {
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: #f43f5e;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #f59e0b;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
}

/* ============================================
 * 15. LOADING & SKELETON STATES
 * ============================================ */
.skeleton {
    background: linear-gradient(90deg, rgba(30, 41, 59, 0.5) 25%, rgba(51, 65, 85, 0.5) 50%, rgba(30, 41, 59, 0.5) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 0.25rem;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

[data-theme="light"] .skeleton {
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
}

/* ============================================
 * 16. PAGINATION CONTROLS
 * ============================================ */
.pagination-btn {
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(71, 85, 105, 0.6);
    font-size: 0.875rem;
    color: #cbd5e1;
    transition: background 0.15s;
}

.pagination-btn:hover:not(:disabled) {
    background: rgba(30, 41, 59, 0.6);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

[data-theme="light"] .pagination-btn {
    border-color: #e2e8f0;
    color: #475569;
}

[data-theme="light"] .pagination-btn:hover:not(:disabled) {
    background: #f1f5f9;
}

/* ============================================
 * 17. MODAL STYLES
 * ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    max-width: 32rem;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

[data-theme="light"] .modal-content {
    background: white;
    border-color: #e2e8f0;
}

/* ============================================
 * 18. TOOLTIP STYLES
 * ============================================ */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background: rgba(15, 23, 42, 0.95);
    color: #f1f5f9;
    font-size: 0.75rem;
    border-radius: 0.375rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 100;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* ============================================
 * 19. BADGE STYLES
 * ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.65rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-error {
    background: rgba(244, 63, 94, 0.15);
    color: #f43f5e;
    border: 1px solid rgba(244, 63, 94, 0.3);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-info {
    background: rgba(14, 165, 233, 0.15);
    color: #0ea5e9;
    border: 1px solid rgba(14, 165, 233, 0.3);
}

/* ============================================
 * 20. AI CHAT STYLES
 * ============================================ */
.chat-message {
    padding: 1rem;
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
}

.chat-message-user {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.2), rgba(99, 102, 241, 0.2));
    border: 1px solid rgba(14, 165, 233, 0.3);
}

.chat-message-ai {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

[data-theme="light"] .chat-message-user {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.1), rgba(99, 102, 241, 0.1));
    border-color: rgba(14, 165, 233, 0.2);
}

[data-theme="light"] .chat-message-ai {
    background: #f8fafc;
    border-color: #e2e8f0;
}

/* ============================================
 * 21. TAB STYLES
 * ============================================ */
.tab-btn {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: #94a3b8;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.tab-btn:hover {
    color: #e5e7eb;
}

.tab-btn.active {
    color: #38bdf8;
    border-color: #38bdf8;
}

[data-theme="light"] .tab-btn:hover {
    color: #334155;
}

[data-theme="light"] .tab-btn.active {
    color: #ea580c;
    border-color: #ea580c;
}

/* ============================================
 * 22. TOGGLE SWITCH
 * ============================================ */
.toggle-switch {
    position: relative;
    width: 2.5rem;
    height: 1.25rem;
    background: rgba(71, 85, 105, 0.5);
    border-radius: 9999px;
    cursor: pointer;
    transition: background 0.2s;
}

.toggle-switch::after {
    content: "";
    position: absolute;
    top: 0.125rem;
    left: 0.125rem;
    width: 1rem;
    height: 1rem;
    background: white;
    border-radius: 9999px;
    transition: transform 0.2s;
}

.toggle-switch.active {
    background: linear-gradient(to right, #0ea5e9, #6366f1);
}

.toggle-switch.active::after {
    transform: translateX(1.25rem);
}

/* ============================================
 * 23. SELECT DROPDOWN OVERRIDES
 * ============================================ */
[data-theme="light"] #rfHeatmapPerPage,
[data-theme="light"] #disconnectsPerPage,
[data-theme="light"] #offendersPerPage {
    background: #f1f5f9 !important;
    color: #1e293b !important;
    border-color: #cbd5e1 !important;
}

/* ============================================
 * 24. DOWNLOAD DROPDOWN (Page-specific)
 * ============================================ */
.download-dropdown {
    position: relative;
    display: inline-block;
}

.download-dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.25rem;
    min-width: 140px;
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    z-index: 50;
    overflow: hidden;
}

.download-dropdown-content.show {
    display: block;
}

.download-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.6rem 0.85rem;
    font-size: 0.75rem;
    color: #e2e8f0;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.15s ease;
}

.download-dropdown-item:hover {
    background: rgba(59, 130, 246, 0.2);
}

.download-dropdown-item svg {
    width: 1rem;
    height: 1rem;
    opacity: 0.7;
}

[data-theme="light"] .download-dropdown-content {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .download-dropdown-item {
    color: #334155;
}

[data-theme="light"] .download-dropdown-item:hover {
    background: rgba(234, 88, 12, 0.1);
}

[data-theme="light"] .download-btn {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #334155 !important;
}

[data-theme="light"] .download-btn:hover {
    background: #e2e8f0 !important;
}

/* ============================================
 * 25. MAP CONTAINER (Device Locations)
 * ============================================ */
#map {
    height: calc(100vh - 320px);
    min-height: 400px;
    width: 100%;
    border-radius: 0.75rem;
    z-index: 1;
}

@media (min-width: 768px) {
    #map {
        height: calc(100vh - 260px);
        min-height: 500px;
    }
}

@media (min-width: 1024px) {
    #map {
        height: calc(100vh - 200px);
    }
}

/* Search toggle buttons for map */
.search-toggle {
    display: flex;
}

.toggle-btn {
    background: rgba(15, 23, 42, 0.7);
    color: #94a3b8;
    border: none;
}

.toggle-btn:hover {
    background: rgba(30, 41, 59, 0.8);
    color: #e2e8f0;
}

.toggle-btn.toggle-active {
    background: linear-gradient(135deg, #0ea5e9, #6366f1);
    color: white;
}

[data-theme="light"] .toggle-btn {
    background: #f1f5f9;
    color: #64748b;
}

[data-theme="light"] .toggle-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

[data-theme="light"] .toggle-btn.toggle-active {
    background: linear-gradient(135deg, #ea580c, #f97316);
    color: white;
}

/* ============================================
 * 26. CONNECTIVITY MODAL (Device Detail)
 * ============================================ */
.inspect-connectivity-btn {
    background: rgba(30, 41, 59, 0.9);
}

[data-theme="light"] .inspect-connectivity-btn {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #334155 !important;
}

[data-theme="light"] .inspect-connectivity-btn:hover {
    background: #e2e8f0 !important;
}

/* Connectivity Modal overlay and content */
#connectivityModal {
    z-index: 9999;
}

/* Modal inner container - the actual popup box */
#connectivityModal .bg-slate-900 {
    background: rgba(15, 23, 42, 0.98) !important;
}

[data-theme="light"] #connectivityModal .bg-slate-900 {
    background: white !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
}

/* Modal section cards */
[data-theme="light"] #connectivityModal .bg-slate-800\/50 {
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
}

[data-theme="light"] #connectivityModal .text-slate-100,
[data-theme="light"] #connectivityModal .text-slate-50 {
    color: #1e293b !important;
}

[data-theme="light"] #connectivityModal .text-slate-200 {
    color: #334155 !important;
}

[data-theme="light"] #connectivityModal .text-slate-300,
[data-theme="light"] #connectivityModal .text-slate-400 {
    color: #64748b !important;
}

[data-theme="light"] #connectivityModal .border-slate-700,
[data-theme="light"] #connectivityModal .border-slate-700\/50,
[data-theme="light"] #connectivityModal .border-slate-600 {
    border-color: #e2e8f0 !important;
}

[data-theme="light"] #connectivityModal .bg-slate-800,
[data-theme="light"] #connectivityModal .bg-slate-800\/50 {
    background: #f8fafc !important;
}

/* ============================================
 * 27. 2FA MODAL (User Profile)
 * ============================================ */
#twoFactorModal>div {
    background: rgba(15, 23, 42, 0.98);
}

[data-theme="light"] #twoFactorModal>div {
    background: white !important;
    border-color: #e2e8f0 !important;
}

[data-theme="light"] #twoFactorModal .text-slate-100,
[data-theme="light"] #twoFactorModal .text-lg {
    color: #1e293b !important;
}

[data-theme="light"] #twoFactorModal .text-slate-400,
[data-theme="light"] #twoFactorModal .text-slate-300 {
    color: #64748b !important;
}

[data-theme="light"] #twoFactorModal .bg-slate-800,
[data-theme="light"] #twoFactorModal .bg-slate-700 {
    background: #f1f5f9 !important;
}

[data-theme="light"] #twoFactorModal .border-slate-700,
[data-theme="light"] #twoFactorModal .border-slate-600 {
    border-color: #e2e8f0 !important;
}

[data-theme="light"] #twoFactorModal input {
    background: #f8fafc !important;
    color: #1e293b !important;
    border-color: #cbd5e1 !important;
}

/* ============================================
 * 28. DROPDOWN BUTTON STYLES
 * ============================================ */
.dropdown-btn {
    background: rgba(30, 41, 59, 0.9);
}

[data-theme="light"] .dropdown-btn {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #334155 !important;
}

[data-theme="light"] .dropdown-btn:hover {
    background: #e2e8f0 !important;
}

[data-theme="light"] #downloadMenu,
[data-theme="light"] #columnsMenu {
    background: white !important;
    border-color: #e2e8f0 !important;
}

[data-theme="light"] #downloadMenu button,
[data-theme="light"] #columnsMenu label {
    color: #334155 !important;
}

[data-theme="light"] #downloadMenu button:hover,
[data-theme="light"] #columnsMenu label:hover {
    background: #f1f5f9 !important;
}

/* ============================================
 * 29. TIME RANGE SELECT DROPDOWN
 * ============================================ */
[data-theme="light"] #timeRangeSelect,
[data-theme="light"] #samplesPerPage {
    background: #f1f5f9 !important;
    color: #1e293b !important;
    border-color: #cbd5e1 !important;
}

/* ============================================
 * 30. 2FA MODAL - BACKUP CODES SECTION
 * ============================================ */
/* Make 2FA modal popup visible in light theme */
[data-theme="light"] #twoFactorModal>div>div {
    background: white !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15) !important;
}

/* Backup codes warning box - better contrast in light mode */
[data-theme="light"] #twoFactorModal .bg-amber-500\/10 {
    background: #fffbeb !important;
    border-color: #fbbf24 !important;
}

[data-theme="light"] #twoFactorModal .text-amber-400 {
    color: #b45309 !important;
}

[data-theme="light"] #twoFactorModal .text-amber-300\/70 {
    color: #92400e !important;
}

/* Backup code grid items */
[data-theme="light"] #twoFactorModal .bg-slate-700 {
    background: #f1f5f9 !important;
}

[data-theme="light"] #twoFactorModal .bg-slate-700 code,
[data-theme="light"] #twoFactorModal code.text-slate-100 {
    color: #1e293b !important;
}

/* Modal text colors */
[data-theme="light"] #twoFactorModal .text-slate-100 {
    color: #1e293b !important;
}

[data-theme="light"] #twoFactorModal .text-slate-400,
[data-theme="light"] #twoFactorModal .text-slate-300 {
    color: #64748b !important;
}

/* Input fields in 2FA modal */
[data-theme="light"] #twoFactorModal input {
    background: #f8fafc !important;
    color: #1e293b !important;
    border-color: #cbd5e1 !important;
}

/* Secret key display */
[data-theme="light"] #twoFactorModal .bg-slate-800 {
    background: #e2e8f0 !important;
}

[data-theme="light"] #twoFactorModal .text-emerald-400 {
    color: #059669 !important;
}

/* Backup code boxes - light background with dark text */
[data-theme="light"] #backupCodesGrid code {
    background: #e2e8f0 !important;
    color: #1e293b !important;
    border: 1px solid #cbd5e1;
}

/* "I've saved my backup codes" button - keep dark for contrast */
[data-theme="light"] #twoFactorModal #doneSetupBtn {
    background: #1e293b !important;
    color: white !important;
}

[data-theme="light"] #twoFactorModal #doneSetupBtn:hover {
    background: #334155 !important;
}

/* ============================================
 * SWAGGER UI DARK MODE OVERRIDES
 * ============================================ */

/* Swagger UI base container */
.swagger-ui {
    color: #fff !important;
}

/* Main text and descriptions */
.swagger-ui .info .title,
.swagger-ui .info .description,
.swagger-ui .info .description p,
.swagger-ui .opblock-tag,
.swagger-ui .opblock-summary-description,
.swagger-ui .opblock-description-wrapper p,
.swagger-ui .opblock-description,
.swagger-ui .opblock-summary-path,
.swagger-ui .opblock-summary-path__deprecated,
.swagger-ui table thead tr th,
.swagger-ui table thead tr td,
.swagger-ui .parameter__name,
.swagger-ui .parameter__type,
.swagger-ui .parameter__deprecated,
.swagger-ui .parameter__in,
.swagger-ui .markdown p,
.swagger-ui .markdown code,
.swagger-ui .renderedMarkdown p {
    color: #fff !important;
}

/* Operation blocks backgrounds */
.swagger-ui .opblock {
    background: rgba(30, 41, 59, 0.8) !important;
    border-color: rgba(51, 65, 85, 0.7) !important;
}

.swagger-ui .opblock .opblock-summary {
    border-bottom-color: rgba(51, 65, 85, 0.5) !important;
}

.swagger-ui .opblock-tag {
    color: #fff !important;
    border-bottom-color: rgba(51, 65, 85, 0.5) !important;
}

/* Section headers */
.swagger-ui .opblock-tag-section h3.opblock-tag {
    background: transparent !important;
}

/* Models section */
.swagger-ui section.models {
    border-color: rgba(51, 65, 85, 0.5) !important;
}

.swagger-ui section.models .model-container {
    background: rgba(30, 41, 59, 0.6) !important;
}

.swagger-ui section.models h4,
.swagger-ui .model-title,
.swagger-ui .model {
    color: #fff !important;
}

/* Table styling */
.swagger-ui table tbody tr td,
.swagger-ui .response-col_status,
.swagger-ui .response-col_description {
    color: #f1f5f9 !important;
}

/* Response section */
.swagger-ui .responses-table,
.swagger-ui .response-content-type.controls-accept-header {
    color: #fff !important;
}

.swagger-ui .responses-inner h4,
.swagger-ui .responses-inner h5 {
    color: #fff !important;
}

/* Input fields */
.swagger-ui input[type=text],
.swagger-ui input[type=email],
.swagger-ui input[type=password],
.swagger-ui textarea,
.swagger-ui select {
    background: rgba(15, 23, 42, 0.8) !important;
    border-color: rgba(51, 65, 85, 0.7) !important;
    color: #fff !important;
}

/* Buttons and actions */
.swagger-ui .btn {
    color: #fff !important;
    border-color: rgba(51, 65, 85, 0.7) !important;
}

/* Server dropdown */
.swagger-ui .scheme-container,
.swagger-ui .servers-title {
    background: transparent !important;
    color: #fff !important;
}

.swagger-ui .servers>label>select {
    background: rgba(15, 23, 42, 0.8) !important;
    border-color: rgba(51, 65, 85, 0.7) !important;
    color: #fff !important;
}

/* Expand/collapse arrows */
.swagger-ui .expand-operation svg,
.swagger-ui .arrow svg {
    fill: #e2e8f0 !important;
}

/* Modal/dialog backgrounds */
.swagger-ui .dialog-ux .modal-ux {
    background: #1e293b !important;
    color: #e2e8f0 !important;
}

.swagger-ui .dialog-ux .modal-ux-header h3 {
    color: #f1f5f9 !important;
}

/* Light theme - revert Swagger to default light styling */
[data-theme="light"] .swagger-ui,
[data-theme="light"] .swagger-ui .info .title,
[data-theme="light"] .swagger-ui .info .description,
[data-theme="light"] .swagger-ui .info .description p,
[data-theme="light"] .swagger-ui .opblock-tag,
[data-theme="light"] .swagger-ui .opblock-summary-description,
[data-theme="light"] .swagger-ui .opblock-description-wrapper p,
[data-theme="light"] .swagger-ui .opblock-description,
[data-theme="light"] .swagger-ui .opblock-summary-path,
[data-theme="light"] .swagger-ui table thead tr th,
[data-theme="light"] .swagger-ui table thead tr td,
[data-theme="light"] .swagger-ui .parameter__name,
[data-theme="light"] .swagger-ui .parameter__type,
[data-theme="light"] .swagger-ui .parameter__in,
[data-theme="light"] .swagger-ui .markdown p,
[data-theme="light"] .swagger-ui .renderedMarkdown p,
[data-theme="light"] .swagger-ui table tbody tr td,
[data-theme="light"] .swagger-ui .response-col_status,
[data-theme="light"] .swagger-ui .response-col_description,
[data-theme="light"] .swagger-ui .model-title,
[data-theme="light"] .swagger-ui .model,
[data-theme="light"] .swagger-ui section.models h4 {
    color: #334155 !important;
}

[data-theme="light"] .swagger-ui .opblock {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
}

[data-theme="light"] .swagger-ui .opblock .opblock-summary,
[data-theme="light"] .swagger-ui .opblock-tag,
[data-theme="light"] .swagger-ui section.models {
    border-color: #e2e8f0 !important;
}

[data-theme="light"] .swagger-ui section.models .model-container {
    background: #f8fafc !important;
}

[data-theme="light"] .swagger-ui input[type=text],
[data-theme="light"] .swagger-ui input[type=email],
[data-theme="light"] .swagger-ui input[type=password],
[data-theme="light"] .swagger-ui textarea,
[data-theme="light"] .swagger-ui select,
[data-theme="light"] .swagger-ui .servers>label>select {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    color: #334155 !important;
}

[data-theme="light"] .swagger-ui .btn {
    color: #334155 !important;
    border-color: #e2e8f0 !important;
}

[data-theme="light"] .swagger-ui .expand-operation svg,
[data-theme="light"] .swagger-ui .arrow svg {
    fill: #64748b !important;
}