html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
    position: relative;
    min-height: 100%;

}

body {
    margin-bottom: 10px;
    font-family: "Lato", sans-serif;
    display: flex;
    min-height: 100vh;
    overflow-x: hidden; /* Prevenir scroll horizontal */
}


.header {
    height: 20vh;
    background: linear-gradient(to right, #2b34bae3, #d1d4f1ea);
    clip-path: polygon(0 0, 100% 0, 100% 75%, 0 100%);
}

.heading-primary {
    font-weight: 900;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.50rem;
}


@media only screen and (max-width: 51.25rem) {
    .heading-primary {
        font-weight: 400;
        letter-spacing: 0.1rem;
    }

    .header {
        height: 13vh;
        background: linear-gradient(to right, #2b34bae3, #d1d4f1ea);
        clip-path: polygon(0 0, 100% 0, 100% 75%, 0 100%);
    }
}

@media only screen and (max-width: 57rem) {
    .heading-primary {
        font-weight: 400;
        letter-spacing: 0.1rem;
    }

    .header {
        height: 13vh;
        background: linear-gradient(to right, #2b34bae3, #d1d4f1ea);
        clip-path: polygon(0 0, 100% 0, 100% 75%, 0 100%);
    }
}

@media only screen and (max-width: 37.5rem) {
    .heading-primary {
        font-weight: 400;
        letter-spacing: 0.1rem;
    }

    .header {
        height: 13vh;
        background: linear-gradient(to right, #2b34bae3, #d1d4f1ea);
        clip-path: polygon(0 0, 100% 0, 100% 75%, 0 100%);
    }
}

@media only screen and (max-width: 25.9rem) {
    .heading-primary {
        font-weight: 400;
        font-size: 0.7rem;
        padding-top: 0.5rem;
        letter-spacing: 0.1rem;
    }

    .header {
        height: 10vh;
        background: linear-gradient(to right, #2b34bae3, #d1d4f1ea);
        clip-path: polygon(0 0, 100% 0, 100% 75%, 0 100%);
    }
}

@media only screen and (max-width: 23.5rem) {
    .heading-primary {
        font-weight: 400;
        font-size: 0.7rem;
        padding-top: 0.5rem;
        letter-spacing: 0.1rem;
    }

    .header {
        height: 10vh;
        background: linear-gradient(to right, #2b34bae3, #d1d4f1ea);
        clip-path: polygon(0 0, 100% 0, 100% 75%, 0 100%);
    }
}

/* Estilos para el layout principal */
.sidebar {
    width: 260px; /* Ancho del menú lateral */
    min-height: 100vh;
    background-color: #f8f9fa; /* Color de fondo claro */
    padding: 1.5rem 1rem;
    position: fixed; /* Fijar el sidebar */
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000; /* Asegurar que esté por encima */
    overflow-y: auto; /* Scroll si el contenido es largo */
    border-right: 1px solid #dee2e6;
    transition: width 0.2s ease; /* Transición suave al colapsar */
}

 .sidebar .nav-link {
    color: #495057; /* Color de texto de enlaces */
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
 }

.sidebar .nav-link i {
     margin-right: 0.75rem; /* Espacio entre icono y texto */
     width: 1.2em; /* Ancho fijo para alinear iconos */
     text-align: center;
 }

 .sidebar .nav-link:hover, .sidebar .nav-link.active {
     background-color: #e9ecef; /* Fondo al pasar el mouse o activo */
     color: #0d6efd; /* Color de texto activo/hover */
     border-radius: 0.375rem; /* Bordes redondeados */
 }

 .sidebar .sidebar-heading {
     font-size: 0.9rem;
     text-transform: uppercase;
     letter-spacing: .05rem;
     font-weight: bold;
     color: #6c757d; /* Color de los títulos de sección */
     padding: 0.5rem 1rem;
     margin-top: 1rem;
 }

.sidebar .logo {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
}
.sidebar .logo i {
    color: #0d6efd; /* Color del icono del logo */
    margin-right: 0.5rem;
}
.main-content {
    margin-left: 260px; /* Mismo ancho que el sidebar */
    flex-grow: 1; /* Ocupa el espacio restante */
    padding: 2rem;
    background-color: #ffffff; /* Fondo del contenido principal */
    min-width: 0; /* Necesario para que flex funcione correctamente */
}

/* Estado colapsado del sidebar (desktop) */
body.sidebar-collapsed .sidebar {
    width: 72px;
}
body.sidebar-collapsed .main-content {
    margin-left: 72px;
}
body.sidebar-collapsed .sidebar .logo span,
body.sidebar-collapsed .sidebar .sidebar-heading {
    display: none !important;
}
body.sidebar-collapsed .sidebar .nav-link {
    justify-content: center;
    font-size: 0; /* Oculta el texto del enlace conservando el ícono */
    padding-left: .5rem;
    padding-right: .5rem;
}
body.sidebar-collapsed .sidebar .nav-link i {
    margin-right: 0;
    font-size: 1.25rem; /* Restaura tamaño del ícono */
}
/* Botón de colapso visible solo en desktop */
.collapse-toggle {
    display: none;
    cursor: pointer;
    font-size: 1.25rem;
    margin-right: .5rem;
}
@media (min-width: 992px) {
    .collapse-toggle { display: inline-flex; align-items: center; }
}

.top-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fff; /* Fondo blanco */
    padding: 0.75rem 1.5rem; /* Padding ajustado */
    border-bottom: 1px solid #dee2e6; /* Borde inferior sutil */
    margin-bottom: 2rem; /* Espacio debajo de la barra superior */
     /* Mover la barra superior dentro de .main-content la hace fluir mejor */
     /* Ya no necesita ser fixed si el sidebar lo es */
}

 .top-navbar .search-form .form-control {
     border-radius: 20px; /* Input de búsqueda redondeado */
 }

 .top-navbar .notifications i {
     font-size: 1.5rem;
     margin-left: 1rem;
     cursor: pointer;
     color: #6c757d;
 }
 .top-navbar .notifications i:hover {
    color: #000;
 }

/* Estilos para el menú desplegable de usuario */
.dropdown-menu {
    padding: 0.5rem 0;
    font-size: 0.9rem;
}

.dropdown-item {
    padding: 0.5rem 1rem;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
}

.dropdown-item i {
    color: #6c757d;
}

.user-profile .dropdown-toggle::after {
    display: none;
}

/* Estilos mejorados para el menú de usuario */
.user-profile .dropdown-menu {
    min-width: 220px;
    margin-top: 10px;
}

.user-profile .dropdown-toggle {
    padding: 0;
}


        

       

        /* Ajustes para pantallas pequeñas (opcional, podrías ocultar el sidebar o hacerlo offcanvas) */
        @media (max-width: 991.98px) {
            .sidebar {
                /* Podrías ocultarlo o usar Offcanvas de Bootstrap aquí */
                /* Por ahora, lo dejamos fijo pero podría causar problemas */
                 width: 100%;
                 height: auto;
                 position: relative;
                 min-height: unset;
                 border-right: none;
                 border-bottom: 1px solid #dee2e6;
            }
            .main-content {
                margin-left: 0;
            }
            body {
                display: block; /* Cambiar flex a block */
            }
        }

        /* Implementación de sidebar offcanvas para dispositivos móviles */
        @media (max-width: 991.98px) {
            .sidebar {
                width: 260px;
                position: fixed;
                top: 0;
                left: -260px; /* Inicialmente oculto fuera de la pantalla */
                height: 100%;
                z-index: 1050;
                transition: all 0.3s ease;
                overflow-y: auto;
            }
            
            .sidebar.show {
                left: 0; /* Mostrar cuando tiene la clase .show */
            }
            
            .sidebar-backdrop {
                position: fixed;
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
                background-color: rgba(0, 0, 0, 0.5);
                z-index: 1040;
                display: none;
            }
            
            .sidebar-backdrop.show {
                display: block;
            }
            
            .sidebar-toggle {
                display: block;
                cursor: pointer;
                font-size: 1.5rem;
                margin-right: 1rem;
            }
            
            .main-content {
                width: 100%;
                margin-left: 0;
            }
            
            body {
                overflow-x: hidden;
            }
        }
        
        @media (min-width: 992px) {
            .sidebar-toggle {
                display: none;
            }
        }

        /* Ajustes adicionales para responsividad */
        @media (max-width: 767.98px) {
            .top-navbar {
                flex-direction: column;
                padding: 0.5rem;
            }
            
            .top-navbar .d-flex {
                width: 100%;
                margin-bottom: 0.5rem;
            }
            
            .search-form {
                width: 100%;
            }
            
            .search-form .input-group {
                width: 100%;
            }
        }
        
        @media (max-width: 575.98px) {
            .user-profile .dropdown-menu {
                min-width: 200px;
                right: -10px !important;
            }
            
            .notifications {
                margin-right: 0.5rem;
            }
            
            .main-content {
                padding: 1rem;
            }
            
            .top-navbar {
                margin-bottom: 1rem;
            }
            
            /* Ocultar la búsqueda en dispositivos muy pequeños y mostrarla solo cuando sea necesario */
            .search-form {
                display: none !important;
            }
            
            /* Opcional: Agregar un botón para mostrar/ocultar la búsqueda */
            .search-toggle {
                display: block !important;
            }
        }
        
        @media (min-width: 576px) {
            .search-toggle {
                display: none !important;
            }
        }
        
        /* Estilo para impedir scroll horizontal cuando el sidebar está abierto */
        body.sidebar-open {
            overflow: hidden;
        }

/* Estilos personalizados para las vistas de gestión de cuenta */

/* Estilos para las tarjetas de información */
.card {
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.card-header {
    border-radius: 10px 10px 0 0 !important;
    border-bottom: none;
}

.card-body {
    padding: 1.5rem;
}

/* Estilos para los badges de roles */
.badge {
    border-radius: 20px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.badge:hover {
    transform: scale(1.05);
}

/* Estilos para los formularios */
.form-floating {
    margin-bottom: 1rem;
}

.form-floating .form-control {
    border-radius: 8px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.form-floating .form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.25);
}

.form-floating .form-label {
    color: #6c757d;
    font-weight: 500;
}

/* Estilos para los botones */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
}

/* Estilos para la información del usuario */
.user-info-row {
    padding: 0.75rem 0;
    border-bottom: 1px solid #f8f9fa;
}

.user-info-row:last-child {
    border-bottom: none;
}

.user-info-label {
    font-weight: 600;
    color: #495057;
}

.user-info-value {
    color: #212529;
}

/* Estilos para los iconos */
.fas {
    width: 16px;
    text-align: center;
}

/* Estilos para los mensajes de estado */
.alert {
    border-radius: 8px;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Estilos para la navegación */
.nav-pills .nav-link {
    border-radius: 8px;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

.nav-pills .nav-link:hover {
    background-color: #f8f9fa;
    transform: translateX(5px);
}

.nav-pills .nav-link.active {
    background-color: #007bff;
    box-shadow: 0 2px 8px rgba(0,123,255,0.3);
}

/* Estilos para los consejos de seguridad */
.security-tips li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f8f9fa;
}

.security-tips li:last-child {
    border-bottom: none;
}

.security-tips .fas {
    color: #28a745;
}

/* Estilos responsivos */
@media (max-width: 768px) {
    .card-body {
        padding: 1rem;
    }
    
    .btn-lg {
        padding: 0.5rem 1rem;
        font-size: 1rem;
    }
    
    .user-info-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .user-info-label {
        margin-bottom: 0.25rem;
    }
}

/* Animaciones */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeInUp 0.6s ease-out;
}

/* Estilos para el contenedor principal */
.container-fluid {
    padding: 2rem 1rem;
}

/* Estilos para las tarjetas de información específicas */
.info-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.location-card {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
}

.roles-card {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
}

.update-card {
    background: linear-gradient(135deg, #e2e3e5 0%, #d6d8db 100%);
}

/* Estilos para los botones de acceso directo */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.btn-sm:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

/* Estilos específicos para botones de acción rápida */
.quick-action-btn {
    margin-top: 1rem;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.quick-action-btn:hover {
    border-color: currentColor;
    background-color: transparent;
    color: inherit;
}

/* Estilos para botones de navegación */
.nav-btn {
    font-weight: 500;
    letter-spacing: 0.5px;
}

.nav-btn:hover {
    transform: translateX(3px);
}

/* Estilos para el botón de regreso */
.back-btn {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
}

.back-btn:hover {
    background-color: #5a6268;
    border-color: #545b62;
    color: white;
}

/* Estilos para botones de acción principal */
.primary-action-btn {
    background: linear-gradient(45deg, #ffc107, #ffb300);
    border: none;
    color: #212529;
    font-weight: 600;
}

.primary-action-btn:hover {
    background: linear-gradient(45deg, #ffb300, #ffa000);
    color: #212529;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

/* Calendario simple */
.calendar-header-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: .5rem;
}
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: .5rem;
}
.calendar-grid .calendar-cell { height: 100%; }
.calendar-cell.empty { visibility: hidden; }
.calendar-day {
    border: 1px solid #e9ecef;
    border-radius: .5rem;
    padding: .5rem .5rem 1rem;
    min-height: 84px;
    background: #fff; /* quitar degradados */
    display: flex;
    flex-direction: column;
}
.calendar-day.today {
    border-color: #cfe2ff;
    background-color: #f1f8ff;
}
.calendar-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.calendar-day:hover {
    background-color: #f8f9fa;
}
.calendar-cell { min-height: 100%; }
.calendar-dot {
    width: 8px;
    height: 8px;
    background-color: #dc3545;
    border-radius: 50%;
    display: inline-block;
}

/* Dark theme variables and rules */
:root[data-theme='dark'] {
    --bg: #0f172a; /* slate-900 */
    --bg-elev: #111827; /* gray-900 */
    --text: #e5e7eb; /* gray-200 */
    --muted: #94a3b8; /* slate-400 */
    --border: #1f2937; /* gray-800 */
    --primary: #3b82f6; /* blue-500 */
}

:root[data-theme='dark'] body {
    background-color: var(--bg);
    color: var(--text);
}

:root[data-theme='dark'] .sidebar {
    background-color: var(--bg-elev);
    border-right-color: var(--border);
}

:root[data-theme='dark'] .sidebar .nav-link { color: var(--text); }
:root[data-theme='dark'] .sidebar .nav-link.active,
:root[data-theme='dark'] .sidebar .nav-link:hover { background-color: rgba(59,130,246,0.15); color: #fff; }

:root[data-theme='dark'] .main-content { background-color: var(--bg); }
:root[data-theme='dark'] .top-navbar { background-color: var(--bg-elev); border-bottom-color: var(--border); }

:root[data-theme='dark'] .card { background-color: var(--bg-elev); color: var(--text); }
:root[data-theme='dark'] .list-group-item { background-color: var(--bg-elev); color: var(--text); border-color: var(--border); }

:root[data-theme='dark'] .form-control { background-color: var(--bg); color: var(--text); border-color: var(--border); }
:root[data-theme='dark'] .input-group-text { background-color: var(--bg); color: var(--muted); border-color: var(--border); }

:root[data-theme='dark'] .dropdown-menu { background-color: var(--bg-elev); color: var(--text); border-color: var(--border); }
:root[data-theme='dark'] .dropdown-item:hover { background-color: #1f2937; }

:root[data-theme='dark'] .calendar-day { background-color: var(--bg-elev); border-color: var(--border); }
:root[data-theme='dark'] .calendar-day:hover { background-color: #1b2437; }
:root[data-theme='dark'] .calendar-day.today { background-color: #0b1220; border-color: #0b3470; }

:root[data-theme='dark'] .badge { color: #fff; }
:root[data-theme='dark'] .text-muted, :root[data-theme='dark'] .small { color: var(--muted) !important; }

/* DataTables Dark Mode Styles */
:root[data-theme='dark'] .dataTables_wrapper {
    color: var(--text);
}

:root[data-theme='dark'] .dataTables_length label,
:root[data-theme='dark'] .dataTables_filter label,
:root[data-theme='dark'] .dataTables_info {
    color: var(--muted);
}

:root[data-theme='dark'] .table > :not(caption) > * > * {
    background-color: transparent;
    color: var(--text);
    border-color: var(--border);
}

:root[data-theme='dark'] table.dataTable thead th,
:root[data-theme='dark'] table.dataTable thead td {
    border-bottom: 1px solid var(--border);
}

:root[data-theme='dark'] table.dataTable.no-footer {
    border-bottom: 1px solid var(--border);
}

:root[data-theme='dark'] .table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-accent-bg: rgba(255, 255, 255, 0.03);
}

:root[data-theme='dark'] .table-hover > tbody > tr:hover > * {
    --bs-table-accent-bg: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

:root[data-theme='dark'] .dataTables_paginate .page-link {
    background-color: var(--bg);
    border-color: var(--border);
    color: var(--text);
}

:root[data-theme='dark'] .dataTables_paginate .page-link:hover {
    background-color: var(--bg-elev);
    border-color: var(--border);
}

:root[data-theme='dark'] .dataTables_paginate .page-item.disabled .page-link {
    background-color: var(--bg);
    border-color: var(--border);
    color: var(--muted);
}

:root[data-theme='dark'] .dataTables_paginate .page-item.active .page-link {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* Styles for theme-aware panels and forms */
.themed-form-container, .themed-panel {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
}

:root[data-theme='dark'] .themed-form-container,
:root[data-theme='dark'] .themed-panel {
    background-color: var(--bg);
    border-color: var(--border);
}

:root[data-theme='dark'] .btn-secondary {
    background-color: #4a5568; /* A less prominent dark color */
    border-color: #4a5568;
    color: #fff;
}

:root[data-theme='dark'] .btn-secondary:hover {
    background-color: #2d3748;
    border-color: #2d3748;
}

:root[data-theme='dark'] .badge.text-bg-secondary {
    background-color: #4a5568 !important;
    color: #fff !important;
}

:root[data-theme='dark'] .list-group-item.active {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* --- Fixes for Form Controls in Dark Mode --- */
:root[data-theme='dark'] .form-control::placeholder {
    color: var(--muted);
    opacity: 0.6;
}

:root[data-theme='dark'] .form-text {
    color: var(--muted);
}


/* --- Redesign for Clinical System Index --- */
.cs-card {
    background-color: #fff;
    border: 1px solid #e9ecef;
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.cs-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
    border-color: var(--primary);
}

.cs-card .cs-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.cs-card .cs-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.cs-card .cs-description {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.cs-card .cs-link {
    text-decoration: none;
    font-weight: 500;
}

/* Dark mode for Clinical System Cards */
:root[data-theme='dark'] .cs-card {
    background-color: var(--bg-elev);
    border-color: var(--border);
}

:root[data-theme='dark'] .cs-card .cs-title {
    color: var(--text);
}

:root[data-theme='dark'] .cs-card .cs-description {
    color: var(--muted);
}

/* --- Dark Mode Fixes for Empleados Views & Layout --- */

/* Fix for form-select (dropdowns) in dark mode */
:root[data-theme='dark'] .form-select {
    background-color: var(--bg);
    color: var(--text);
    border-color: var(--border);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

/* Fix for card headers using .bg-light */
:root[data-theme='dark'] .card-header {
    border-bottom: 1px solid var(--border);
}

:root[data-theme='dark'] .card-header.bg-light {
    background-color: var(--bg) !important;
}

/* Fix for the main search bar in the top navbar */
:root[data-theme='dark'] .top-navbar .search-form .form-control {
    background-color: var(--bg) !important;
    border-color: var(--border) !important;
}

:root[data-theme='dark'] .top-navbar .input-group-text {
    background-color: var(--bg) !important;
    border-color: var(--border) !important;
}

/* Fix for the gradient header text color in dark mode if needed */
:root[data-theme='dark'] .card-header-gradient {
    background: linear-gradient(to right, #1e293b, #0f172a);
}

:root[data-theme='dark'] .card-header-gradient .btn-light {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

:root[data-theme='dark'] .card-header-gradient .btn-light:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

/* Fix for floating labels on select/date inputs */
:root[data-theme='dark'] .form-floating > .form-control:-webkit-autofill ~ label {
    background: var(--bg);
}

:root[data-theme='dark'] .form-floating > .form-select ~ label {
    color: var(--muted);
}

:root[data-theme='dark'] .form-floating > .form-control:focus ~ label,
:root[data-theme='dark'] .form-floating > .form-control:not(:placeholder-shown) ~ label,
:root[data-theme='dark'] .form-floating > .form-select ~ label {
    background: var(--bg);
}

/* Fix for form icons color in dark mode */
:root[data-theme='dark'] .card .input-group-text i {
    color: var(--muted);
}

/* Second Attempt at Dark Mode Form Fixes */

/* 1. Floating Labels on Date/Select Inputs */
:root[data-theme='dark'] .form-floating > .form-control:not(:-moz-placeholder-shown) ~ label,
:root[data-theme='dark'] .form-floating > .form-select ~ label,
:root[data-theme='dark'] .form-floating > input[type="date"]:not(:placeholder-shown) ~ label {
    background-color: var(--bg);
    border-radius: 5px;
    padding: 0 5px;
}

/* 2. Date Input Styling for Dark Mode */
:root[data-theme='dark'] input[type="date"] {
    color-scheme: dark;
}

:root[data-theme='dark'] input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

/* 3. Form Icons (more specific selector) */
:root[data-theme='dark'] .form-floating .input-group-text i {
    color: var(--muted) !important;
}

/* 4. General form-select fix (re-stating for clarity) */
:root[data-theme='dark'] .form-select {
    background-color: var(--bg);
    color: var(--text);
    border-color: var(--border);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

/* --- Dark Mode Fixes for User Profile Dropdown --- */

/* Ensure the dropdown has the right background and border */
:root[data-theme='dark'] .user-profile .dropdown-menu {
    background-color: var(--bg-elev);
    border-color: var(--border);
}

/* Style the header section of the dropdown */
:root[data-theme='dark'] .user-profile .dropdown-menu .border-bottom {
    border-bottom-color: var(--border) !important;
}

/* Style the user name text */
:root[data-theme='dark'] .user-profile .dropdown-menu .fw-semibold {
    color: var(--text);
}

/* Style the links and their icons */
:root[data-theme='dark'] .user-profile .dropdown-item {
    color: var(--text);
}

:root[data-theme='dark'] .user-profile .dropdown-item i {
    color: var(--muted);
}

/* Style the hover/focus state of dropdown items */
:root[data-theme='dark'] .user-profile .dropdown-item:hover,
:root[data-theme='dark'] .user-profile .dropdown-item:focus {
    background-color: rgba(59, 130, 246, 0.15); /* A subtle blue from --primary */
    color: var(--text);
}

/* Make the divider visible */
:root[data-theme='dark'] .dropdown-divider {
    border-top-color: var(--border);
}

/* --- Final Dark Mode Polish --- */

/* 1. Profile Page Info Rows */
:root[data-theme='dark'] .user-info-label {
    color: var(--muted) !important;
    font-weight: 500;
}

:root[data-theme='dark'] .user-info-value {
    color: var(--text) !important;
    font-weight: 600;
}

:root[data-theme='dark'] .user-info-row {
    border-bottom: 1px solid var(--border);
    padding-top: 1rem;
    padding-bottom: 1rem;
}
:root[data-theme='dark'] .user-info-row:last-child {
    border-bottom: none;
}


/* 2. Layout Toolbar Buttons */
:root[data-theme='dark'] .top-navbar .collapse-toggle,
:root[data-theme='dark'] .top-navbar #themeToggle {
    color: var(--muted);
}

:root[data-theme='dark'] .top-navbar .collapse-toggle:hover,
:root[data-theme='dark'] .top-navbar #themeToggle:hover {
    color: var(--text);
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 0.375rem;
}

:root[data-theme='dark'] .top-navbar .collapse-toggle i,
:root[data-theme='dark'] .top-navbar #themeToggle i {
    color: inherit !important; /* Inherit color from the button */
}

/* --- Auditoria Modal Dark Mode Styles --- */

/* Modal content */
:root[data-theme='dark'] .themed-modal-content {
    background-color: var(--bg-elev);
    color: var(--text);
    border: 1px solid var(--border);
}

/* Modal header */
:root[data-theme='dark'] .themed-modal-header {
    background-color: var(--bg);
    border-bottom: 1px solid var(--border);
}

:root[data-theme='dark'] .themed-modal-header .modal-title {
    color: var(--text);
}

/* Modal body */
:root[data-theme='dark'] .themed-modal-body {
    background-color: var(--bg-elev);
    color: var(--text);
}

/* Modal footer */
:root[data-theme='dark'] .themed-modal-footer {
    background-color: var(--bg);
    border-top: 1px solid var(--border);
}

/* Close button */
:root[data-theme='dark'] .themed-modal-close {
    filter: invert(1);
}

/* Cards */
:root[data-theme='dark'] .themed-card {
    background-color: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
}

:root[data-theme='dark'] .themed-card-header {
    background-color: var(--bg-elev);
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

:root[data-theme='dark'] .themed-card-body {
    background-color: var(--bg);
    color: var(--text);
}

/* List groups */
:root[data-theme='dark'] .themed-list-group {
    background-color: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
}

:root[data-theme='dark'] .themed-list-group-item {
    background-color: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
}

/* Tables */
:root[data-theme='dark'] .themed-table {
    color: var(--text);
}

:root[data-theme='dark'] .themed-table tr td:first-child {
    color: var(--muted);
}

/* Alerts */
:root[data-theme='dark'] .themed-alert {
    background-color: rgba(220, 53, 69, 0.15);
    border: 1px solid rgba(220, 53, 69, 0.3);
    color: var(--text);
}

/* Badges */
:root[data-theme='dark'] .themed-badge {
    color: #fff;
}

/* Buttons */
:root[data-theme='dark'] .themed-btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
    color: #fff;
}

:root[data-theme='dark'] .themed-btn-secondary:hover {
    background-color: #5c636a;
    border-color: #565e64;
}

/* Hero Section Styles - Minimalista Profesional */
.hero-section-minimal {
    background: #ffffff;
    border-bottom: 1px solid #e9ecef;
    padding: 2rem 0;
}

.hero-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    color: #0d6efd;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border: 1px solid #e9ecef;
}

.hero-title {
    font-size: 2.75rem;
    font-weight: 700;
    color: #212529;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.hero-subtitle {
    font-size: 1.125rem;
    color: #6c757d;
    line-height: 1.6;
    max-width: 540px;
}

/* Hero Buttons */
.btn-hero-primary {
    background: #0d6efd;
    color: white;
    border: none;
    padding: 0.875rem 1.75rem;
    font-weight: 600;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.15);
}

.btn-hero-primary:hover {
    background: #0b5ed7;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.25);
}

.btn-hero-secondary {
    background: transparent;
    color: #6c757d;
    border: 2px solid #dee2e6;
    padding: 0.875rem 1.75rem;
    font-weight: 600;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.btn-hero-secondary:hover {
    background: #f8f9fa;
    color: #495057;
    border-color: #adb5bd;
    transform: translateY(-2px);
}

/* Hero Stats Grid */
.hero-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.hero-stat-card {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 0.75rem;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
}

.hero-stat-card:hover {
    border-color: #0d6efd;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon i {
    font-size: 1.5rem;
    color: #0d6efd;
}

.stat-content {
    flex-grow: 1;
}

.stat-number {
    font-size: 1rem;
    font-weight: 700;
    color: #212529;
    margin: 0;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8125rem;
    color: #6c757d;
    margin: 0;
    margin-top: 0.25rem;
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
    .hero-title {
        font-size: 2.25rem;
    }

    .hero-stats-grid {
        margin-top: 2rem;
    }
}

@media (max-width: 575.98px) {
    .hero-title {
        font-size: 1.875rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .hero-stats-grid {
        grid-template-columns: 1fr;
    }

    .btn-hero-primary,
    .btn-hero-secondary {
        width: 100%;
        justify-content: center;
    }
}

/* Dark theme hero section - Minimalista */
:root[data-theme='dark'] .hero-section-minimal {
    background: var(--bg-elev);
    border-bottom-color: var(--border);
}

:root[data-theme='dark'] .hero-badge {
    background: rgba(13, 110, 253, 0.15);
    color: #3b82f6;
    border-color: var(--border);
}

:root[data-theme='dark'] .hero-title {
    color: var(--text);
}

:root[data-theme='dark'] .hero-subtitle {
    color: var(--muted);
}

:root[data-theme='dark'] .hero-stat-card {
    background: var(--bg);
    border-color: var(--border);
}

:root[data-theme='dark'] .hero-stat-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

:root[data-theme='dark'] .stat-icon {
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.1) 0%, rgba(13, 110, 253, 0.05) 100%);
}

:root[data-theme='dark'] .stat-icon i {
    color: var(--primary);
}

:root[data-theme='dark'] .stat-number {
    color: var(--text);
}

:root[data-theme='dark'] .stat-label {
    color: var(--muted);
}

:root[data-theme='dark'] .btn-hero-secondary {
    border-color: var(--border);
    color: var(--text);
}

:root[data-theme='dark'] .btn-hero-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary);
    color: var(--text);
}

/* Legacy Hero Section Styles (keeping for backward compatibility) */
.hero-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
    z-index: 1;
}

.hero-section .container-fluid {
    position: relative;
    z-index: 2;
}

.hero-section h1, .hero-section p {
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Dark theme hero section */
:root[data-theme='dark'] .hero-section {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid var(--border);
}

:root[data-theme='dark'] .hero-section::before {
    background: rgba(255, 255, 255, 0.05);
}

:root[data-theme='dark'] .hero-section h1,
:root[data-theme='dark'] .hero-section p {
    color: var(--text);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* User Avatar Styles */
.user-avatar {
    position: relative;
    width: 40px;
    height: 40px;
}

.user-avatar-img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border: 2px solid #eee;
    transition: all 0.2s ease;
}

.user-avatar-default {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    border: 2px solid #eee;
    transition: all 0.2s ease;
}

.user-avatar:hover .user-avatar-img,
.user-avatar:hover .user-avatar-default {
    border-color: #0d6efd;
    transform: scale(1.05);
}

/* Dark theme avatar styles */
:root[data-theme='dark'] .user-avatar-img {
    border-color: var(--border);
}

:root[data-theme='dark'] .user-avatar-default {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-color: var(--border);
    color: var(--text);
}

:root[data-theme='dark'] .user-avatar:hover .user-avatar-img,
:root[data-theme='dark'] .user-avatar:hover .user-avatar-default {
    border-color: var(--primary);
}