/* Day-mode (light/theme-light) contrast fixes */
:root {
    --day-bg: #f0f2f5;
    --day-text: #1c1e21;
    --day-muted: #65676b;
    --day-card-bg: #ffffff;
    --day-card-border: #dcdfe6;
    --day-hover-bg: #f2f2f2;
}

body.theme-light,
body:not(.theme-dark),
html:not(.theme-dark) {
    background-color: var(--day-bg) !important;
    background-image: none !important;
    color: var(--day-text) !important;
}

/* Override all major layout components */
body.theme-light .app-shell,
body.theme-light .main,
body.theme-light .sidebar,
body.theme-light .login-page {
    background: var(--day-bg) !important;
    border-color: var(--day-card-border) !important;
}

body.theme-light .sidebar {
    background: #f8f9fa !important;
}


/* Override all panel/card/box variations */
body.theme-light .card,
body.theme-light .panel,
body.theme-light .box,
body.theme-light .login-card,
body.theme-light .person-section,
body.theme-light .person-info-card,
body.theme-light .modal-content,
body.theme-light .table,
body.theme-light .alert,
body.theme-light .list-group-item,
body.theme-light .dropdown-menu,
body.theme-light .age-card,
body.theme-light .age-tile,
body.theme-light .search-card,
body.theme-light .search-result,
body.theme-light .inspector-card,
body.theme-light .settings-hero,
body.theme-light .info-panel,
body.theme-light .stat-row,
body.theme-light .modal-card,
body.theme-light .table-modern thead th {
    background-color: var(--day-card-bg) !important;
    background-image: none !important;
    color: var(--day-text) !important;
    border-color: var(--day-card-border) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02) !important;
}

body.theme-light .table-modern tbody tr {
    background: var(--day-card-bg) !important;
    box-shadow: inset 0 0 0 1px var(--day-card-border) !important;
}

body.theme-light .table-modern tbody tr:hover,
body.theme-light .mahalla-chip:hover {
    background: var(--day-hover-bg) !important;
}


/* Ensure text, headings, and links are readable */
body.theme-light h1,
body.theme-light h2,
body.theme-light h3,
body.theme-light h4,
body.theme-light p,
body.theme-light a,
body.theme-light small,
body.theme-light .muted,
body.theme-light .text-muted,
body.theme-light .person-name,
body.theme-light .person-meta,
body.theme-light .search-result-meta,
body.theme-light .age-kpi-label,
body.theme-light .stat-label,
body.theme-light .stat-sub,
body.theme-light .stat-count,
body.theme-light .meta-label,
body.theme-light .meta-value,
body.theme-light .inspector-name,
body.theme-light .settings-name,
body.theme-light .alert-text {
    color: var(--day-text) !important;
}

body.theme-light .muted,
body.theme-light .text-muted,
body.theme-light .person-meta,
body.theme-light .search-result-meta,
body.theme-light .age-kpi-label,
body.theme-light .stat-sub,
body.theme-light .stat-count,
body.theme-light .meta-label,
body.theme-light .alert-text {
    color: var(--day-muted) !important;
}

body.theme-light .table-modern td a {
    color: var(--accent) !important;
}

body.theme-light .table-modern td a:hover {
    color: var(--accent-2) !important;
}


/* Form inputs */
body.theme-light input,
body.theme-light select,
body.theme-light textarea,
body.theme-light .file-input {
    background: #f0f2f5 !important;
    color: var(--day-text) !important;
    border-color: #ced4da !important;
}

body.theme-light input::placeholder,
body.theme-light textarea::placeholder {
    color: #6c757d !important;
}


/* Buttons and navigation */
body.theme-light .nav-item {
    color: var(--day-muted) !important;
}

body.theme-light .nav-item.active,
body.theme-light .nav-item:hover {
    background: rgba(0, 0, 0, 0.04) !important;
    color: var(--day-text) !important;
}

/* Special components */
body.theme-light .login-logo-float,
body.theme-light .login-logo img {
    background: #ffffff !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1) !important;
}

body.theme-light .mahalla-chip {
    background: #f8f9fa !important;
    border-color: #e9ecef !important;
    color: var(--day-text) !important;
}

body.theme-light .pill,
body.theme-light .status,
body.theme-light .age-meta-item,
body.theme-light .stat-pill,
body.theme-light .name-chip,
body.theme-light .info-chip {
    color: #ffffff !important;
    background-color: rgba(0, 0, 0, 0.1) !important;
    border-color: rgba(83, 90, 102, 0.2) !important;
}

body.theme-light .age-kpi-value,
body.theme-light .mahalla-count {
    color: #97adce !important;
}


body.theme-light .status.green,
body.theme-light .info-chip.green {
    color: #198754 !important;
    background-color: rgba(25, 135, 84, 0.1) !important;
    border-color: rgba(25, 135, 84, 0.2) !important;
}

body.theme-light .status.yellow,
body.theme-light .info-chip-warn {
    color: #ffc107 !important;
    background-color: rgba(255, 193, 7, 0.1) !important;
    border-color: rgba(255, 193, 7, 0.2) !important;
}

body.theme-light .status.red {
    color: #dc3545 !important;
    background-color: rgba(220, 53, 69, 0.1) !important;
    border-color: rgba(220, 53, 69, 0.2) !important;
}

body.theme-light ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2) !important;
}

body.theme-light .person-card {
    background: linear-gradient(150deg, #ffffff, #f7f9fc) !important;
    border-color: var(--day-card-border) !important;
}

body.theme-light .person-avatar {
    background: #e9ecef !important;
    border-color: #ced4da !important;
    color: #495057 !important;
}

/* Mobile responsive styles for day mode */
@media (max-width: 980px) {
    body.theme-light .sidebar {
        background: #ffffff !important;
        border-right: 1px solid var(--day-card-border) !important;
        box-shadow: 10px 0 35px rgba(0, 0, 0, 0.15) !important;
    }

    body.theme-light .topbar {
        background: rgba(255, 255, 255, 0.95) !important;
        border: 1px solid var(--day-card-border) !important;
    }

    body.theme-light .nav-item {
        background: #f8f9fa !important;
        border-color: var(--day-card-border) !important;
        color: var(--day-text) !important;
    }

    body.theme-light .nav-item.active {
        background: rgba(37, 99, 235, 0.12) !important;
        border-color: rgba(37, 99, 235, 0.3) !important;
    }

    body.theme-light .sidebar-toggle {
        border-color: rgba(37, 99, 235, 0.25) !important;
        background: rgba(37, 99, 235, 0.08) !important;
    }
}

@media (max-width: 640px) {
    body.theme-light .sidebar {
        background: #ffffff !important;
        border-right: 1px solid var(--day-card-border) !important;
    }

    body.theme-light .nav-item,
    body.theme-light .sidebar .nav-item {
        background: #f8f9fa !important;
        background-image: none !important;
        border-color: var(--day-card-border) !important;
        color: var(--day-text) !important;
    }

    body.theme-light .nav-item::before,
    body.theme-light .sidebar .nav-item::before {
        background: rgba(14, 15, 17, 0.9) !important;
        box-shadow: 0 0 10px rgba(37, 99, 235, 0.4) !important;
    }

    body.theme-light .nav-item.active,
    body.theme-light .sidebar .nav-item.active,
    body.theme-light .nav-item:hover,
    body.theme-light .sidebar .nav-item:hover {
        background: rgba(231, 231, 231, 0.15) !important;
        background-image: none !important;
        border-color: rgba(53, 58, 70, 0.4) !important;
        color: var(--day-text) !important;
    }

    body.theme-light .topbar {
        background: rgba(255, 255, 255, 0.95) !important;
        border-color: var(--day-card-border) !important;
    }

    /* Mobile table stacked view fixes */
    body.theme-light .table-stacked td::before {
        color: var(--day-muted) !important;
    }

    body.theme-light .table-stacked td {
        border-bottom: 1px solid var(--day-card-border) !important;
    }

    body.theme-light .table-stacked tr {
        background: var(--day-card-bg) !important;
        border: 1px solid var(--day-card-border) !important;
        margin-bottom: 8px !important;
    }

    /* Mobile cards */
    body.theme-light .card {
        background: var(--day-card-bg) !important;
        border-color: var(--day-card-border) !important;
    }

    /* Mobile forms */
    body.theme-light input,
    body.theme-light select,
    body.theme-light textarea {
        background: #f8f9fa !important;
        border-color: #ced4da !important;
        color: var(--day-text) !important;
    }

    /* Mobile sidebar brand */
    body.theme-light .sidebar .brand {
        background: #f8f9fa !important;
        border-color: var(--day-card-border) !important;
    }
}

/* White-only light mode: remove remaining blue tones */
body.theme-light {
    --accent: #111111 !important;
    --accent-2: #2f2f2f !important;
    --accent-bg: rgba(0, 0, 0, 0.04) !important;
    --accent-border: rgba(0, 0, 0, 0.12) !important;
    --accent-soft: rgba(0, 0, 0, 0.03) !important;
}

body.theme-light .table,
body.theme-light .table th,
body.theme-light .table td,
body.theme-light .table-modern thead th,
body.theme-light .table-modern tbody tr,
body.theme-light .table-modern tbody td,
body.theme-light .table-neo thead th,
body.theme-light .table-neo tbody tr,
body.theme-light .table-neo tbody td,
body.theme-light .table-stacked tr {
    background: #ffffff !important;
    color: var(--day-text) !important;
    border-color: var(--day-card-border) !important;
}

body.theme-light .table-modern tbody tr:hover,
body.theme-light .table-neo tbody tr:hover,
body.theme-light .table-stacked tr:hover,
body.theme-light .table tbody tr:hover {
    background: #f6f6f6 !important;
}

body.theme-light .table a,
body.theme-light .table-modern td a,
body.theme-light .table-neo td a,
body.theme-light .person-link,
body.theme-light .person-name,
body.theme-light .mahalla-count,
body.theme-light .age-kpi-value {
    color: var(--day-text) !important;
}

body.theme-light .pill,
body.theme-light .status,
body.theme-light .age-meta-item,
body.theme-light .stat-pill,
body.theme-light .name-chip,
body.theme-light .info-chip,
body.theme-light .badge {
    color: var(--day-text) !important;
    background: #ffffff !important;
    border-color: var(--day-card-border) !important;
}

body.theme-light .nav-item::before,
body.theme-light .sidebar .nav-item::before {
    background: rgba(0, 0, 0, 0.55) !important;
    box-shadow: none !important;
}

body.theme-light .nav-item.active,
body.theme-light .sidebar .nav-item.active,
body.theme-light .nav-item:hover,
body.theme-light .sidebar .nav-item:hover {
    background: rgba(0, 0, 0, 0.06) !important;
    border-color: rgba(0, 0, 0, 0.14) !important;
}

/* Person detail: categories section must stay white/readable in day mode */
body.theme-light .category-block,
body.theme-light details.category-block,
body.theme-light .category-block[open],
body.theme-light .category-block .category-body,
body.theme-light .category-block .category-answer-table,
body.theme-light .category-block .category-answer-table tbody,
body.theme-light .category-block .category-answer-table tr,
body.theme-light .category-block .category-answer-table td {
    background: #ffffff !important;
    color: var(--day-text) !important;
    border-color: var(--day-card-border) !important;
}

body.theme-light .category-block summary,
body.theme-light .category-block summary .muted {
    color: var(--day-text) !important;
}
