/* ============================================================
   TEMA GLOBAL - Componentes del shell
   Header, sidebar, notificaciones, usuario y dashboard.
   ============================================================ */

/* ---------- Header ---------- */
html[data-theme="dark"] .header,
html[data-theme="dark"] .apprentice-layout .header,
html[data-theme="dark"] .digitador-layout .header,
html[data-theme="dark"] .instructor-layout .header,
html[data-theme="dark"] .encabezado-subdireccion {
    background-color: var(--bg-header) !important;
    color: var(--text-primary) !important;
    border-bottom-color: var(--border-color) !important;
}

html[data-theme="dark"] .header .dashboard-header h1,
html[data-theme="dark"] .header .dashboard-header .title-dash,
html[data-theme="dark"] .header .title-dash {
    color: var(--text-primary) !important;
}

html[data-theme="dark"] .header .dashboard-header p,
html[data-theme="dark"] .header .dashboard-header .motivational {
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] .header .usuario-info,
html[data-theme="dark"] .content.cuerpo .usuario-info {
    background: var(--bg-surface-2) !important;
    border-color: var(--border-color) !important;
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] .header .usuario-info p,
html[data-theme="dark"] .header .usuario-info small,
html[data-theme="dark"] .header .usuario-info span {
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] .header .usuario-info:hover {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .header .usuario-info:hover p,
html[data-theme="dark"] .header .usuario-info:hover small,
html[data-theme="dark"] .header .usuario-info:hover span,
html[data-theme="dark"] .header .usuario-info:hover i {
    color: #ffffff !important;
}

/* ---------- Campana de notificaciones ---------- */
html[data-theme="dark"] .notification-bell {
    background: var(--bg-surface-2) !important;
    border-color: var(--border-color) !important;
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] .notification-bell:hover {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .notification-bell--alert {
    color: var(--danger) !important;
    border-color: var(--danger) !important;
}

html[data-theme="dark"] .notification-bell--alert:hover {
    background: var(--danger-bg) !important;
    color: var(--danger) !important;
    border-color: var(--danger) !important;
}

html[data-theme="dark"] .notifications-panel {
    background: var(--bg-elevated) !important;
    border-color: var(--border-color) !important;
    box-shadow: var(--shadow-lg) !important;
}

html[data-theme="dark"] .notifications-header {
    background: var(--bg-surface-2) !important;
    border-bottom-color: var(--border-color) !important;
}

html[data-theme="dark"] .notifications-header h3,
html[data-theme="dark"] .notification-title {
    color: var(--text-primary) !important;
}

html[data-theme="dark"] .mark-all-read {
    color: var(--accent-text) !important;
}

html[data-theme="dark"] .mark-all-read:hover {
    color: var(--accent-hover) !important;
}

html[data-theme="dark"] .notification-item {
    border-bottom-color: var(--border-color) !important;
}

html[data-theme="dark"] .notification-item:hover {
    background: var(--hover-bg) !important;
}

html[data-theme="dark"] .notification-item.urgent .notification-icon {
    background: rgba(220, 53, 69, 0.18) !important;
    color: #fca5a5 !important;
}

html[data-theme="dark"] .notification-item.warning .notification-icon {
    background: rgba(245, 158, 11, 0.18) !important;
    color: #fcd34d !important;
}

html[data-theme="dark"] .notification-item.success .notification-icon {
    background: rgba(34, 197, 94, 0.18) !important;
    color: #86efac !important;
}

html[data-theme="dark"] .notification-item.info .notification-icon {
    background: rgba(59, 130, 246, 0.18) !important;
    color: #93c5fd !important;
}

/* ---------- Sidebar ---------- */
html[data-theme="dark"] .sidebar,
html[data-theme="dark"] #sidebar.sidebar.collapsed,
html[data-theme="dark"] .sidebar.collapsed {
    background-color: var(--bg-sidebar) !important;
    border-right-color: rgba(255, 255, 255, 0.08) !important;
}

html[data-theme="dark"] .sidebar .logo {
    border-bottom-color: rgba(255, 255, 255, 0.12) !important;
}

html[data-theme="dark"] .sidebar .logo .texto-header {
    color: #f1f5f9 !important;
}

html[data-theme="dark"] .sidebar-menu > li > a.menu-toggle {
    color: #d7dee8 !important;
}

html[data-theme="dark"] .sidebar-menu > li > a.menu-toggle:hover,
html[data-theme="dark"] .sidebar-menu > li > a.menu-toggle.active {
    background-color: rgba(57, 169, 0, 0.18) !important;
    border-left-color: var(--verde-sena) !important;
}

html[data-theme="dark"] .menu-icon {
    color: #d7dee8 !important;
}

html[data-theme="dark"] .sidebar-menu li ul li a {
    color: #b8c2d0 !important;
}

html[data-theme="dark"] .sidebar-menu li ul li a:hover,
html[data-theme="dark"] .sidebar-menu li ul li a.active-link {
    background-color: rgba(57, 169, 0, 0.16) !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .sidebar.collapsed .sidebar-menu ul {
    background: #0b1220 !important;
    box-shadow: 3px 3px 14px rgba(0, 0, 0, 0.45) !important;
}

html[data-theme="dark"] .sidebar.collapsed .sidebar-menu li ul li a:hover,
html[data-theme="dark"] .sidebar.collapsed .sidebar-menu li ul li a.active-link {
    background-color: rgba(255, 255, 255, 0.12) !important;
}

html[data-theme="dark"] .logout-button {
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .logout-button:hover {
    background-color: rgba(57, 169, 0, 0.3) !important;
    color: #ffffff !important;
}

/* ---------- Dashboard ---------- */
html[data-theme="dark"] .contenedor-cards,
html[data-theme="dark"] .quick-actions,
html[data-theme="dark"] .right-content,
html[data-theme="dark"] .banner-noticias {
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    box-shadow: var(--shadow-md) !important;
}

html[data-theme="dark"] .stat-card {
    background: var(--bg-surface) !important;
    border-color: var(--border-color) !important;
    box-shadow: var(--shadow-sm) !important;
}

html[data-theme="dark"] .stat-card.border-orange {
    background: linear-gradient(180deg, rgba(199, 124, 27, 0.18) 0%, var(--bg-surface) 100%) !important;
}

html[data-theme="dark"] .stat-card.border-green {
    background: linear-gradient(180deg, rgba(57, 169, 0, 0.20) 0%, var(--bg-surface) 100%) !important;
}

html[data-theme="dark"] .stat-card.red-border {
    background: linear-gradient(180deg, rgba(146, 73, 198, 0.20) 0%, var(--bg-surface) 100%) !important;
}

html[data-theme="dark"] .stat-value {
    color: var(--text-primary) !important;
}

html[data-theme="dark"] .stat-label {
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] .card-icon i,
html[data-theme="dark"] .orange-icon-container i,
html[data-theme="dark"] .green-icon-container i,
html[data-theme="dark"] .red-icon-container i {
    background-color: var(--bg-surface-2) !important;
}

html[data-theme="dark"] .card-wave,
html[data-theme="dark"] .orange,
html[data-theme="dark"] .green-wave,
html[data-theme="dark"] .red {
    opacity: 0.22;
}

html[data-theme="dark"] .quick-actions h2,
html[data-theme="dark"] .action-label {
    color: var(--text-primary) !important;
}

html[data-theme="dark"] .action-btn {
    background-color: var(--bg-surface-2) !important;
    border-color: var(--border-color) !important;
    color: var(--text-secondary) !important;
    box-shadow: var(--shadow-sm) !important;
}

html[data-theme="dark"] .action-btn--primary {
    background-color: #2f7a00 !important;
    border-color: #2f7a00 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .action-btn:hover {
    border-color: var(--accent) !important;
    background-color: var(--bg-elevated) !important;
}

html[data-theme="dark"] .action-icon {
    background: var(--accent-soft) !important;
    color: var(--accent-text) !important;
}

html[data-theme="dark"] .action-btn:hover .action-icon {
    background: rgba(57, 169, 0, 0.28) !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .noticia {
    border-top-color: var(--border-color) !important;
}

html[data-theme="dark"] .noticia:hover {
    background-color: var(--hover-bg) !important;
}

html[data-theme="dark"] .noticia p {
    color: var(--text-secondary) !important;
}

/* ---------- Botón de tema ---------- */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    min-width: 46px;
    border-radius: 999px;
    border: 2px solid var(--border-color);
    background: var(--bg-surface-2);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.05rem;
    line-height: 1;
    padding: 0;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.theme-toggle:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    transform: scale(1.05);
}

.theme-toggle:focus-visible {
    outline: 3px solid rgba(57, 169, 0, 0.4);
    outline-offset: 2px;
}

.theme-toggle .theme-toggle__sun {
    display: none;
}

.theme-toggle .theme-toggle__moon {
    display: inline-block;
}

html[data-theme="dark"] .theme-toggle .theme-toggle__sun {
    display: inline-block;
}

html[data-theme="dark"] .theme-toggle .theme-toggle__moon {
    display: none;
}

.theme-toggle--floating {
    position: fixed;
    top: 20px;
    right: 22px;
    z-index: 10060;
    box-shadow: var(--shadow-md);
}

.theme-toggle--login {
    position: fixed;
    top: 22px;
    right: 24px;
    z-index: 10060;
    box-shadow: var(--shadow-md);
}

.theme-toggle--kiosk {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 10060;
    box-shadow: var(--shadow-md);
}

@media (max-width: 576px) {
    .theme-toggle {
        width: 40px;
        height: 40px;
        min-width: 40px;
        font-size: 0.95rem;
    }

    .theme-toggle--floating,
    .theme-toggle--login {
        top: 12px;
        right: 12px;
    }

    .theme-toggle--kiosk {
        right: 12px;
        bottom: 12px;
    }
}
