/**
 * Tema Oscuro Global — Gestión SIPLG (camuweb.com)
 * Activo por defecto cuando <html> o <body> tiene la clase .cif-theme-dark
 */

/* Botón conmutador de tema (visible en ambos modos) */
.btn-theme-toggle {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 9px;
    padding: 5px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1.3;
    white-space: nowrap;
}

.btn-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.24);
    border-color: rgba(255, 255, 255, 0.4);
    color: #ffffff !important;
    transform: translateY(-1px);
}

.btn-theme-toggle i {
    font-size: 0.9rem;
}

.btn-theme-floating {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 1080;
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(8px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* =========================================================================
   VARIABLES Y FONDO GLOBAL EN MODO OSCURO
   ========================================================================= */
html.cif-theme-dark,
body.cif-theme-dark {
    color-scheme: dark;
    --light-blue: #1e293b;
    --dark-blue: #93c5fd;
}

html.cif-theme-dark body,
body.cif-theme-dark {
    background: linear-gradient(135deg, #0b1120 0%, #0f172a 100%) !important;
    color: #e2e8f0 !important;
}

/* =========================================================================
   BARRA DE NAVEGACIÓN Y MENÚS DESPLEGABLES
   ========================================================================= */
html.cif-theme-dark .navbar,
html.cif-theme-dark .navbar-cw,
body.cif-theme-dark .navbar,
body.cif-theme-dark .navbar-cw {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
    border-bottom: 1px solid #1e293b;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5) !important;
}

html.cif-theme-dark .dropdown-menu,
body.cif-theme-dark .dropdown-menu {
    background-color: #1e293b !important;
    border: 1px solid #334155 !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5) !important;
}

html.cif-theme-dark .dropdown-item,
body.cif-theme-dark .dropdown-item {
    color: #e2e8f0 !important;
}

html.cif-theme-dark .dropdown-item:hover,
html.cif-theme-dark .dropdown-item:focus,
body.cif-theme-dark .dropdown-item:hover,
body.cif-theme-dark .dropdown-item:focus {
    background-color: #334155 !important;
    color: #ffffff !important;
}

html.cif-theme-dark .dropdown-divider,
body.cif-theme-dark .dropdown-divider {
    border-top-color: #334155 !important;
}

/* =========================================================================
   PÁGINA DE LOGIN (index.php)
   ========================================================================= */
html.cif-theme-dark .login-container,
body.cif-theme-dark .login-container {
    background: rgba(15, 23, 42, 0.96) !important;
    border: 1px solid #334155 !important;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.65) !important;
    color: #e2e8f0 !important;
}

html.cif-theme-dark .login-header,
body.cif-theme-dark .login-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%) !important;
    border-bottom: 1px solid #334155;
}

html.cif-theme-dark .footer-text,
body.cif-theme-dark .footer-text {
    background: #0b1120 !important;
    border-top: 1px solid #1e293b !important;
    color: #94a3b8 !important;
}

html.cif-theme-dark .form-floating > label,
body.cif-theme-dark .form-floating > label {
    color: #94a3b8 !important;
}

html.cif-theme-dark .form-floating > .form-control:focus ~ label,
html.cif-theme-dark .form-floating > .form-control:not(:placeholder-shown) ~ label,
body.cif-theme-dark .form-floating > .form-control:focus ~ label,
body.cif-theme-dark .form-floating > .form-control:not(:placeholder-shown) ~ label {
    color: #93c5fd !important;
}

html.cif-theme-dark .form-floating > .form-control:focus ~ label::after,
html.cif-theme-dark .form-floating > .form-control:not(:placeholder-shown) ~ label::after,
body.cif-theme-dark .form-floating > .form-control:focus ~ label::after,
body.cif-theme-dark .form-floating > .form-control:not(:placeholder-shown) ~ label::after {
    background-color: transparent !important;
}

html.cif-theme-dark .password-toggle,
body.cif-theme-dark .password-toggle {
    color: #94a3b8 !important;
}

html.cif-theme-dark .password-toggle:hover,
body.cif-theme-dark .password-toggle:hover {
    color: #60a5fa !important;
}

/* =========================================================================
   TARJETAS DEL PANEL PRINCIPAL Y PANEL DE AGENTES
   ========================================================================= */
html.cif-theme-dark .welcome-card,
body.cif-theme-dark .welcome-card {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
    border: 1px solid #334155 !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45) !important;
}

html.cif-theme-dark .section-card,
body.cif-theme-dark .section-card {
    background: #111827 !important;
    border: 1px solid #1e293b !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
}

html.cif-theme-dark .section-card:hover,
body.cif-theme-dark .section-card:hover {
    background: #162033 !important;
    border-color: #334155 !important;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.55) !important;
}

html.cif-theme-dark .section-card .card-title,
body.cif-theme-dark .section-card .card-title {
    color: #f1f5f9 !important;
}

html.cif-theme-dark .section-card .card-description,
body.cif-theme-dark .section-card .card-description {
    color: #94a3b8 !important;
}

html.cif-theme-dark .stat-card,
html.cif-theme-dark .stats-card,
body.cif-theme-dark .stat-card,
body.cif-theme-dark .stats-card {
    background: #111827 !important;
    border: 1px solid #1e293b !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35) !important;
    color: #e2e8f0 !important;
}

html.cif-theme-dark .stat-number,
html.cif-theme-dark .stats-number,
body.cif-theme-dark .stat-number,
body.cif-theme-dark .stats-number {
    color: #60a5fa !important;
}

html.cif-theme-dark .stat-label,
body.cif-theme-dark .stat-label {
    color: #94a3b8 !important;
}

/* =========================================================================
   TARJETAS DE CONTENIDO, BUSCADORES Y FORMULARIOS
   ========================================================================= */
html.cif-theme-dark .content-card,
body.cif-theme-dark .content-card {
    background: #111827 !important;
    border: 1px solid #1e293b !important;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.5) !important;
    color: #e2e8f0 !important;
}

html.cif-theme-dark .content-header,
body.cif-theme-dark .content-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
    border-bottom: 1px solid #334155 !important;
}

html.cif-theme-dark .content-header .btn-light,
body.cif-theme-dark .content-header .btn-light {
    background: #2563eb !important;
    border-color: #3b82f6 !important;
    color: #ffffff !important;
}

html.cif-theme-dark .content-header .btn-light:hover,
body.cif-theme-dark .content-header .btn-light:hover {
    background: #1d4ed8 !important;
}

html.cif-theme-dark .search-filters,
body.cif-theme-dark .search-filters {
    background: #0f172a !important;
    border: 1px solid #1e293b !important;
}

html.cif-theme-dark .form-label,
body.cif-theme-dark .form-label {
    color: #cbd5e1 !important;
}

html.cif-theme-dark .form-control,
html.cif-theme-dark .form-select,
html.cif-theme-dark .search-box input,
body.cif-theme-dark .form-control,
body.cif-theme-dark .form-select,
body.cif-theme-dark .search-box input {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}

html.cif-theme-dark .form-control::placeholder,
html.cif-theme-dark .search-box input::placeholder,
body.cif-theme-dark .form-control::placeholder,
body.cif-theme-dark .search-box input::placeholder {
    color: #64748b !important;
}

html.cif-theme-dark .form-control:focus,
html.cif-theme-dark .form-select:focus,
html.cif-theme-dark .search-box input:focus,
body.cif-theme-dark .form-control:focus,
body.cif-theme-dark .form-select:focus,
body.cif-theme-dark .search-box input:focus {
    background-color: #1e293b !important;
    border-color: #3b82f6 !important;
    color: #ffffff !important;
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25) !important;
}

html.cif-theme-dark .form-control:disabled,
html.cif-theme-dark .form-control[readonly],
body.cif-theme-dark .form-control:disabled,
body.cif-theme-dark .form-control[readonly] {
    background-color: #0f172a !important;
    color: #94a3b8 !important;
}

html.cif-theme-dark .input-group-text,
body.cif-theme-dark .input-group-text {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #94a3b8 !important;
}

html.cif-theme-dark .form-text,
body.cif-theme-dark .form-text {
    color: #94a3b8 !important;
}

/* =========================================================================
   TABLAS Y LISTADOS
   ========================================================================= */
html.cif-theme-dark .table-container,
body.cif-theme-dark .table-container {
    background: #0f172a !important;
    border: 1px solid #1e293b !important;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.35) !important;
}

html.cif-theme-dark .table,
body.cif-theme-dark .table {
    --bs-table-bg: transparent !important;
    --bs-table-color: #e2e8f0 !important;
    --bs-table-border-color: #1e293b !important;
    --bs-table-striped-bg: rgba(30, 41, 59, 0.4) !important;
    --bs-table-striped-color: #e2e8f0 !important;
    --bs-table-hover-bg: rgba(59, 130, 246, 0.08) !important;
    --bs-table-hover-color: #ffffff !important;
    color: #e2e8f0 !important;
}

html.cif-theme-dark .table thead th,
body.cif-theme-dark .table thead th {
    background: #1e293b !important;
    color: #93c5fd !important;
    border-bottom: 1px solid #334155 !important;
}

html.cif-theme-dark .table tbody td,
body.cif-theme-dark .table tbody td {
    color: #e2e8f0 !important;
    border-color: #1e293b !important;
    background-color: transparent !important;
}

html.cif-theme-dark .table tbody tr:hover,
html.cif-theme-dark .table tbody tr:hover td,
body.cif-theme-dark .table tbody tr:hover,
body.cif-theme-dark .table tbody tr:hover td {
    background-color: rgba(59, 130, 246, 0.1) !important;
    color: #ffffff !important;
}

html.cif-theme-dark .nfunc-badge,
body.cif-theme-dark .nfunc-badge {
    background: rgba(59, 130, 246, 0.18) !important;
    color: #93c5fd !important;
    border: 1px solid rgba(59, 130, 246, 0.35);
}

html.cif-theme-dark .default-photo,
body.cif-theme-dark .default-photo {
    background: linear-gradient(135deg, #1e293b, #334155) !important;
    color: #93c5fd !important;
    border-color: #334155 !important;
}

html.cif-theme-dark .agente-photo,
body.cif-theme-dark .agente-photo {
    border-color: #334155 !important;
}

/* =========================================================================
   PAGINACIÓN
   ========================================================================= */
html.cif-theme-dark .pagination .page-link,
body.cif-theme-dark .pagination .page-link {
    background-color: #1e293b !important;
    color: #93c5fd !important;
    border: 1px solid #334155 !important;
}

html.cif-theme-dark .pagination .page-link:hover,
body.cif-theme-dark .pagination .page-link:hover {
    background-color: #334155 !important;
    color: #ffffff !important;
}

html.cif-theme-dark .pagination .page-item.active .page-link,
body.cif-theme-dark .pagination .page-item.active .page-link {
    background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
    border-color: #3b82f6 !important;
    color: #ffffff !important;
}

html.cif-theme-dark .pagination .page-item.disabled .page-link,
body.cif-theme-dark .pagination .page-item.disabled .page-link {
    background-color: #0f172a !important;
    color: #475569 !important;
    border-color: #1e293b !important;
}

/* =========================================================================
   MODALES Y FICHAS DE DETALLE
   ========================================================================= */
html.cif-theme-dark .modal-content,
body.cif-theme-dark .modal-content {
    background-color: #111827 !important;
    color: #e2e8f0 !important;
    border: 1px solid #334155 !important;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.7) !important;
}

html.cif-theme-dark .modal-header,
body.cif-theme-dark .modal-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
    border-bottom: 1px solid #334155 !important;
    color: #ffffff !important;
}

html.cif-theme-dark .modal-footer,
body.cif-theme-dark .modal-footer {
    background-color: #0f172a !important;
    border-top: 1px solid #1e293b !important;
}

html.cif-theme-dark .ficha-item,
body.cif-theme-dark .ficha-item {
    background: #1e293b !important;
    border-color: #334155 !important;
}

html.cif-theme-dark .ficha-label,
body.cif-theme-dark .ficha-label {
    color: #94a3b8 !important;
}

html.cif-theme-dark .ficha-value,
body.cif-theme-dark .ficha-value {
    color: #f1f5f9 !important;
}

html.cif-theme-dark .section-divider,
body.cif-theme-dark .section-divider {
    color: #60a5fa !important;
    border-bottom-color: #1e293b !important;
}

html.cif-theme-dark .border-bottom,
body.cif-theme-dark .border-bottom {
    border-bottom-color: #334155 !important;
}

html.cif-theme-dark .text-muted,
body.cif-theme-dark .text-muted {
    color: #94a3b8 !important;
}

html.cif-theme-dark .bg-light,
body.cif-theme-dark .bg-light {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
}

html.cif-theme-dark .card:not(.welcome-card):not(.section-card):not(.content-card),
body.cif-theme-dark .card:not(.welcome-card):not(.section-card):not(.content-card) {
    background-color: #111827;
    border-color: #1e293b;
    color: #e2e8f0;
}

/* =========================================================================
   SWEETALERT2 EN MODO OSCURO
   ========================================================================= */
html.cif-theme-dark .swal2-popup,
body.cif-theme-dark .swal2-popup {
    background: #1e293b !important;
    color: #f1f5f9 !important;
    border: 1px solid #334155 !important;
}

html.cif-theme-dark .swal2-title,
html.cif-theme-dark .swal2-html-container,
body.cif-theme-dark .swal2-title,
body.cif-theme-dark .swal2-html-container {
    color: #e2e8f0 !important;
}

html.cif-theme-dark .swal2-input,
html.cif-theme-dark .swal2-textarea,
body.cif-theme-dark .swal2-input,
body.cif-theme-dark .swal2-textarea {
    background: #0f172a !important;
    color: #f1f5f9 !important;
    border-color: #334155 !important;
}
