/**
 * GT-Scolarix - Thème clair/sombre
 *
 * Bootstrap 5.3 gère nativement la majorité des composants (card, modal,
 * dropdown, alert, table, form-control...) dès que [data-bs-theme="dark"]
 * est posé sur <html> : ce fichier ne couvre QUE les éléments custom du
 * projet (couleurs codées en dur, hors variables Bootstrap) communs aux
 * 4 interfaces (backoffice/frontoffice, portail, console Giga, organization).
 */

/* ========================================
   Bouton de bascule (commun aux 4 interfaces)
   ======================================== */

.theme-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 1.1rem;
    color: inherit;
    transition: background-color 0.2s ease;
}

.theme-toggle-btn:hover {
    background-color: rgba(127, 127, 127, 0.15);
}

.theme-toggle-btn .theme-icon-dark,
.theme-toggle-btn .theme-icon-light {
    pointer-events: none;
}

.theme-toggle-btn .theme-icon-light {
    display: none;
}

[data-bs-theme="dark"] .theme-toggle-btn .theme-icon-dark {
    display: none;
}

[data-bs-theme="dark"] .theme-toggle-btn .theme-icon-light {
    display: inline;
}

/* ========================================
   Fond de page + variables custom (--gt-*)
   ======================================== */

[data-bs-theme="dark"] {
    --gt-light: #1c2431;
    --gt-dark: #e5e7eb;
    --gt-secondary: #9ca3af;
    --gt-border-color: #2e3948;
    color-scheme: dark;
}

[data-bs-theme="dark"] body,
[data-bs-theme="dark"] body.bg-light {
    background-color: #0f1420 !important;
    color: #e5e7eb;
}

[data-bs-theme="dark"] ::-webkit-scrollbar-track {
    background: #161d29;
}

[data-bs-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #3a4657;
}

[data-bs-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #4b5a6f;
}

/* ========================================
   Backoffice / frontoffice (base/base.html)
   ======================================== */

[data-bs-theme="dark"] .main-header {
    background: #151c28;
    border-bottom-color: #262f3d;
}

[data-bs-theme="dark"] .main-header .nav-link {
    color: #cbd5e1;
}

[data-bs-theme="dark"] .notification-dropdown .dropdown-item:hover {
    background-color: #1f2733;
}

[data-bs-theme="dark"] .notification-text {
    color: #9ca3af;
}

[data-bs-theme="dark"] nav[aria-label="breadcrumb"].bg-white {
    background-color: #151c28 !important;
    border-bottom-color: #262f3d !important;
}

[data-bs-theme="dark"] .card-header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .table th {
    background-color: #161d29;
    color: #cbd5e1;
}

[data-bs-theme="dark"] .table-hover tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

[data-bs-theme="dark"] .filter-panel {
    background: #151c28;
}

[data-bs-theme="dark"] .empty-state i {
    color: #2e3948;
}

[data-bs-theme="dark"] .empty-state h5 {
    color: #9ca3af;
}

[data-bs-theme="dark"] .empty-state p {
    color: #6b7280;
}

[data-bs-theme="dark"] .loading-overlay {
    background: rgba(15, 20, 32, 0.85);
}

[data-bs-theme="dark"] .stats-card .stats-label {
    color: #9ca3af;
}

/* Couleurs fixes de style.css qui court-circuiteraient sinon le thème natif
   Bootstrap (--bs-*) pour ces composants standards. */
[data-bs-theme="dark"] .form-control:disabled,
[data-bs-theme="dark"] .form-select:disabled {
    background-color: #1c2431;
}

[data-bs-theme="dark"] .input-group-text {
    background-color: #1c2431;
}

[data-bs-theme="dark"] .page-item.disabled .page-link {
    background-color: #10151f;
}

[data-bs-theme="dark"] .progress {
    background-color: #1c2431;
}

/* ========================================
   Portail parents/élèves (frontend/base.html)
   ======================================== */

[data-bs-theme="dark"] .portal-header {
    background: #151c28;
    border-bottom-color: #262f3d;
    box-shadow: none;
}

[data-bs-theme="dark"] .portal-header-icon {
    color: #cbd5e1;
}

[data-bs-theme="dark"] .portal-footer {
    background: #151c28;
    border-top-color: #262f3d;
}

[data-bs-theme="dark"] .portal-child-avatar {
    background: rgba(148, 163, 184, 0.15);
    color: #cbd5e1;
}
