/* ============================================================================
   KIVVY - Custom Styles
   Estilos personalizados optimizados; se complementan con Tailwind (CDN).
   Clases de utilidad: .page-card (bloque contenido), .card-stat (tarjeta con hover).
   ============================================================================ */

/* Altura unificada barra superior (header blanco y logo amarillo del sidebar) */
:root {
    --header-height: 3.5rem; /* 56px, igual que Tailwind h-14 */
}
.app-header-bar,
.header-logo-part {
    height: var(--header-height);
    min-height: var(--header-height);
}

/* ============================================================================
   TRANSICIONES (solo elementos interactivos; evita conflicto con Tailwind)
   ============================================================================ */
a, button, input, select, textarea, .btn, .nav-item, .badge, [role="button"] {
    transition-property: background-color, border-color, color, opacity, transform, box-shadow;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 200ms;
}

/* ============================================================================
   BARRAS DE SCROLL OCULTAS (el contenido sigue siendo scrollable)
   ============================================================================ */
* {
    scrollbar-width: none;
    -ms-overflow-style: none;
}
*::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

/* ============================================================================
   NAVEGACIÓN Y SIDEBAR
   ============================================================================ */

/* Menú móvil (hamburguesa): sidebar visible y etiquetas mostradas */
body.mobile-menu-open #sidebar {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
}
body.mobile-menu-open #sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
}
body.mobile-menu-open #sidebar .nav-label,
body.mobile-menu-open #sidebar .section-label {
    display: inline !important;
}
body.mobile-menu-open #sidebar .section-label {
    display: block !important;
}
/* Evitar scroll del body cuando el menú está abierto en móvil */
@media (max-width: 767.98px) {
    body.mobile-menu-open {
        overflow: hidden;
    }
}

.nav-item {
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: #fbbf24;
    transform: scaleY(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item:hover::before,
.nav-item.active::before {
    transform: scaleY(1);
}

.nav-item:hover {
    transform: translateX(4px);
}

.nav-item.active {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* ============================================================================
   BOTONES Y ELEMENTOS INTERACTIVOS
   ============================================================================ */
button, .btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

button::after, .btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:hover::after, .btn:hover::after {
    width: 300px;
    height: 300px;
}

button:active, .btn:active {
    transform: scale(0.98);
}

.bg-blue-500, .bg-blue-600 {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.bg-blue-500:hover, .bg-blue-600:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.3), 0 4px 6px -2px rgba(59, 130, 246, 0.2);
}

/* ============================================================================
   CARDS Y TARJETAS
   ============================================================================ */
/* Clase reutilizable para bloques de contenido (evita repetir Tailwind en cada plantilla) */
.page-card {
    background-color: #fff;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}
.dark .page-card {
    background-color: #1f2937;
}

/* ============================================================================
   TABLAS
   ============================================================================ */
table tbody tr {
    transition: none !important;
    transform: none !important;
}

table tbody tr:hover {
    background-color: inherit !important;
    transform: none !important;
    box-shadow: none !important;
}

.dark table tbody tr:hover {
    background-color: inherit !important;
}

table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: inherit;
}

/* ============================================================================
   FORMULARIOS Y INPUTS - Aspecto unificado (igual que Choices.js)
   ============================================================================ */
/* Mismo aspecto que .choices__inner: altura, radio, borde, padding, focus */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="datetime-local"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="url"],
select,
textarea {
    display: block;
    width: 100%;
    min-height: 2.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: rgb(31 41 55);
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 0.5rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

input::placeholder,
textarea::placeholder {
    color: rgb(156 163 175);
    transition: opacity 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgb(59 130 246);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

input:focus::placeholder,
textarea:focus::placeholder {
    opacity: 0.6;
}

/* Textarea: altura mínima mayor, mismo resto */
textarea {
    min-height: 4rem;
    resize: vertical;
}

/* Select nativo (sin Choices): flecha alineada */
select:not(.no-choices) {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* Dark mode: mismos tonos que .choices__inner en dark */
.dark input[type="text"],
.dark input[type="email"],
.dark input[type="password"],
.dark input[type="date"],
.dark input[type="datetime-local"],
.dark input[type="number"],
.dark input[type="search"],
.dark input[type="tel"],
.dark input[type="url"],
.dark select,
.dark textarea {
    color: rgb(229 231 235);
    background-color: rgb(55 65 81);
    border-color: rgb(75 85 99);
}

.dark input::placeholder,
.dark textarea::placeholder {
    color: rgb(156 163 175);
}

.dark input:focus,
.dark select:focus,
.dark textarea:focus {
    border-color: rgb(96 165 250);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35);
}

.dark select:not(.no-choices) {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%239ca3af' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
}

/* Checkbox y radio: no aplicar altura/padding de bloque */
input[type="checkbox"],
input[type="radio"] {
    display: inline-block;
    width: auto;
    min-height: auto;
    padding: 0;
}

input[type="search"]:focus {
    width: 100%;
}

/* Input con icono a la izquierda: el icono va en el flujo (flex), no superpuesto */
.input-with-icon-left {
    min-height: 2.5rem;
}
.input-with-icon-left input {
    padding-left: 0.5rem;
    width: auto;
    min-width: 0;
}

/* Inputs de autenticación: integrar icono + campo visualmente */
.auth-field {
    overflow: hidden;
}

.auth-field-icon {
    align-self: stretch;
    display: flex;
    align-items: center;
}

.auth-input {
    height: 2.5rem;
    padding-right: 2rem; /* evita solape visual con controles del navegador */
    background-color: transparent;
}

/* Evita doble borde: el borde lo gestiona solo .auth-field */
.auth-field input.auth-input,
.dark .auth-field input.auth-input {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

.auth-field input.auth-input:focus,
.dark .auth-field input.auth-input:focus {
    border: 0;
    box-shadow: none;
    outline: none;
}

/* Oculta controles nativos de Edge/IE que se ven "despegados" del input */
.auth-input::-ms-reveal,
.auth-input::-ms-clear {
    display: none;
}

/* Algunos navegadores añaden botón de credenciales/autofill dentro del input */
.auth-input::-webkit-credentials-auto-fill-button {
    visibility: hidden;
    pointer-events: none;
    position: absolute;
    right: 0;
}

/* ============================================================================
   MENÚ DESPLEGABLE DE USUARIO
   ============================================================================ */
#user-menu {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#user-menu a {
    position: relative;
    transition: all 0.2s ease;
}

#user-menu a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: currentColor;
    transform: scaleY(0);
    transition: transform 0.2s ease;
}

#user-menu a:hover::before {
    transform: scaleY(1);
}

#user-menu-button {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#user-menu-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3), 0 2px 4px -1px rgba(59, 130, 246, 0.2);
}

/* ============================================================================
   THEME TOGGLE
   ============================================================================ */
#theme-toggle {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#theme-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

#theme-toggle:active {
    transform: scale(0.95) rotate(0deg);
}

/* ============================================================================
   ALERTAS Y NOTIFICACIONES
   ============================================================================ */
#alert-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
    width: 100%;
    display: none !important;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.alert {
    border-left: 4px solid;
    pointer-events: auto;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

@keyframes slideInRight {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.alert.alert-hiding {
    opacity: 0;
    transform: translateX(120%);
}

.alert-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-color: #10b981;
    color: #065f46;
}

.dark .alert-success {
    background: linear-gradient(135deg, #064e3b 0%, #047857 100%);
    border-color: #10b981;
    color: #d1fae5;
}

.alert-error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-color: #ef4444;
    color: #991b1b;
}

.dark .alert-error {
    background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%);
    border-color: #ef4444;
    color: #fee2e2;
}

.alert-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-color: #f59e0b;
    color: #92400e;
}

.dark .alert-warning {
    background: linear-gradient(135deg, #78350f 0%, #92400e 100%);
    border-color: #f59e0b;
    color: #fef3c7;
}

.alert-info {
    background: linear-gradient(135deg, #cffafe 0%, #a5f3fc 100%);
    border-color: #06b6d4;
    color: #164e63;
}

.dark .alert-info {
    background: linear-gradient(135deg, #164e63 0%, #0e7490 100%);
    border-color: #06b6d4;
    color: #cffafe;
}

.alert-close {
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.alert-close:hover {
    background-color: rgba(0, 0, 0, 0.1);
    transform: rotate(90deg) scale(1.1);
}

.dark .alert-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* ============================================================================
   MODALES - Scroll en contenido y estilo unificado
   ============================================================================ */
/* Overlay: permite scroll cuando el modal es muy alto y centrado con padding */
.modal-overlay {
    overflow-y: auto;
    padding: 1rem 0;
}
/* Caja del modal: ancho fijo 60%, min-height 0 para scroll interno (flex) */
.modal-box {
    width: 60%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(0, 0, 0, 0.08);
    animation: modalFadeIn 0.25s ease-out;
    /* overflow visible para que el dropdown de Choices.js no se recorte */
    overflow: visible;
}
.dark .modal-box {
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}
/* Modal sin clase .modal-box: mismo ancho 60% para consistencia */
.modal-width-60 {
    width: 60%;
}
/* Modal más pequeño (ej. formularios alumnos) */
.modal-width-50 {
    width: 50%;
}
/* Modal compacto (alumnos, formularios largos) */
.modal-width-40 {
    width: 40%;
}
/* Área del modal: overflow visible para que el dropdown de Choices no se recorte.
   El scroll cuando hay mucho contenido lo hace el overlay (.modal-overlay). */
.modal-box-body {
    flex: 1 1 0%;
    min-height: 0;
    overflow: visible;
}
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(-8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}
.modal, #eventoModal, #menuModal {
    animation: fadeInScale 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================================================================
   HEADER Y NAVEGACIÓN
   ============================================================================ */
header {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.dark header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

footer {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* ============================================================================
   BADGES Y ETIQUETAS
   ============================================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.event-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* ============================================================================
   CARDS DE ESTADÍSTICAS (solo donde se usa .card-stat para no afectar tablas)
   ============================================================================ */
.card-stat {
    position: relative;
    overflow: hidden;
}
.card-stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}
.card-stat:hover::before {
    left: 100%;
}
.card-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}

/* ============================================================================
   CALENDARIO
   ============================================================================ */
.calendar-day {
    transition: all 0.2s ease;
    position: relative;
}

.calendar-day:hover {
    background-color: rgba(59, 130, 246, 0.1);
    transform: scale(1.05);
    z-index: 10;
}

.calendar-day:active {
    transform: scale(0.95);
}

/* ============================================================================
   CHECKBOXES Y RADIOS
   ============================================================================ */
.dia-checkbox, input[type="checkbox"] {
    transition: all 0.2s ease;
    cursor: pointer;
}

.dia-checkbox:hover, input[type="checkbox"]:hover {
    border-color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.1);
    transform: scale(1.1);
}

input[type="checkbox"]:checked {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-color: #3b82f6;
}

/* ============================================================================
   LOADING Y SKELETON
   ============================================================================ */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

.dark .skeleton {
    background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
    background-size: 200% 100%;
}

/* ============================================================================
   EFECTOS ESPECIALES
   ============================================================================ */
.glass-effect {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.dark .glass-effect {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.shine-effect {
    position: relative;
    overflow: hidden;
}

.shine-effect::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: rotate(45deg);
    transition: all 0.5s;
}

.shine-effect:hover::after {
    left: 100%;
    top: 100%;
}

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

.animate-fade-in-up {
    animation: fadeInUp 0.5s ease-out;
}

/* ============================================================================
   ICONOS
   ============================================================================ */
i.fas, i.far {
    transition: transform 0.2s ease;
}

button:hover i.fas,
button:hover i.far,
a:hover i.fas,
a:hover i.far {
    transform: scale(1.1);
}

/* ============================================================================
   NOTIFICACIONES CON TABS
   ============================================================================ */
.notification-tab {
    position: relative;
    transition: all 0.2s ease;
}

.notification-tab:hover {
    background-color: rgba(59, 130, 246, 0.05);
}

.dark .notification-tab:hover {
    background-color: rgba(59, 130, 246, 0.1);
}

.notification-tab.active {
    background-color: white;
}

.dark .notification-tab.active {
    background-color: #1f2937;
}

.notification-tab[data-tab="material"].active {
    border-bottom-color: #f97316;
    color: #ea580c;
}

.dark .notification-tab[data-tab="material"].active {
    color: #fb923c;
}

.notification-tab[data-tab="birthday"].active {
    border-bottom-color: #ec4899;
    color: #db2777;
}

.dark .notification-tab[data-tab="birthday"].active {
    color: #f472b6;
}

.notification-content {
    animation: fadeIn 0.2s ease-in-out;
}

.notification-item {
    position: relative;
    transition: all 0.2s ease;
}

.notification-item:hover {
    transform: translateX(2px);
}

.notification-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: transparent;
    transition: background 0.2s ease;
}

.notification-item[data-type="birthday"]:hover::before {
    background: #ec4899;
}

.notification-item[data-type="material"]:hover::before {
    background: #f97316;
}

/* ============================================================================
   FICHA DE ALUMNO - ESTILOS ESPECÍFICOS
   ============================================================================ */
#fichaContent > div:first-child.bg-gradient-to-r {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%);
    position: relative;
    overflow: hidden;
}


#fichaContent .w-24.h-24.bg-white.rounded-full {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 4px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

#fichaContent .w-24.h-24.bg-white.rounded-full:hover {
    transform: scale(1.05) rotate(5deg);
    box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.5);
}

#fichaContent .bg-white.rounded-xl.shadow-md,
#fichaContent .dark\:bg-gray-800.rounded-xl.shadow-md {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.dark #fichaContent .dark\:bg-gray-800.rounded-xl.shadow-md {
    border: 1px solid rgba(255, 255, 255, 0.05);
}

#fichaContent .bg-white.rounded-xl.shadow-md:hover,
#fichaContent .dark\:bg-gray-800.rounded-xl.shadow-md:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
}

#fichaContent h3.text-xl.font-bold {
    position: relative;
    padding-bottom: 0.5rem;
}

#fichaContent h3.text-xl.font-bold::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, transparent);
    border-radius: 2px;
    transition: width 0.3s ease;
}

#fichaContent h3.text-xl.font-bold:hover::after {
    width: 100px;
}

#fichaContent .px-3.py-1.rounded-full.bg-green-500,
#fichaContent .px-3.py-1.rounded-full.bg-orange-500 {
    position: relative;
    overflow: hidden;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#fichaContent .px-3.py-1.rounded-full.bg-green-500::before,
#fichaContent .px-3.py-1.rounded-full.bg-orange-500::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

#fichaContent .px-3.py-1.rounded-full:hover::before {
    left: 100%;
}

#fichaContent label.text-sm.font-medium {
    display: block;
    margin-bottom: 0.25rem;
    color: #6b7280;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.dark #fichaContent label.text-sm.font-medium {
    color: #9ca3af;
}

#fichaContent p.text-gray-800.font-semibold,
.dark #fichaContent p.text-gray-200.font-semibold {
    transition: color 0.2s ease;
    word-break: break-word;
}

#fichaContent .bg-blue-50,
#fichaContent .bg-green-50,
#fichaContent .bg-purple-50 {
    position: relative;
    overflow: hidden;
    border-left: 4px solid;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#fichaContent .bg-blue-50 {
    border-left-color: #3b82f6;
}

#fichaContent .bg-green-50 {
    border-left-color: #10b981;
}

#fichaContent .bg-purple-50 {
    border-left-color: #8b5cf6;
}

.dark #fichaContent .bg-blue-50 {
    border-left-color: #60a5fa;
}

.dark #fichaContent .bg-green-50 {
    border-left-color: #34d399;
}

.dark #fichaContent .bg-purple-50 {
    border-left-color: #a78bfa;
}

#fichaContent .bg-blue-50:hover,
#fichaContent .bg-green-50:hover,
#fichaContent .bg-purple-50:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

#fichaContent button.w-full.text-left {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

#fichaContent button.w-full.text-left::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: rgba(255, 255, 255, 0.2);
    transition: width 0.3s ease;
}

#fichaContent button.w-full.text-left:hover::before {
    width: 100%;
}

#fichaContent button.w-full.text-left:hover {
    transform: translateX(8px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

#fichaContent button.w-full.text-left i {
    transition: transform 0.3s ease;
}

#fichaContent button.w-full.text-left:hover i {
    transform: scale(1.2) rotate(5deg);
}

#fichaContent button.bg-white.text-blue-500 {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    border: 2px solid transparent;
}

#fichaContent button.bg-white.text-blue-500:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-2px);
    box-shadow: 0 8px 15px -3px rgba(59, 130, 246, 0.3), 0 4px 6px -2px rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.3);
}

#fichaContent button.bg-white.text-blue-500:active {
    transform: translateY(0);
}

#fichaContent .bg-gray-50.dark\:bg-gray-700 {
    transition: all 0.3s ease;
    border-left: 3px solid #3b82f6;
    position: relative;
}

#fichaContent .bg-gray-50.dark\:bg-gray-700:hover {
    border-left-color: #2563eb;
    box-shadow: inset 4px 0 0 rgba(59, 130, 246, 0.2);
}

#fichaContent > * {
    animation: fadeInUp 0.5s ease-out backwards;
}

#fichaContent > *:nth-child(1) {
    animation-delay: 0.1s;
}

#fichaContent > *:nth-child(2) {
    animation-delay: 0.2s;
}

#fichaContent > *:nth-child(3) {
    animation-delay: 0.3s;
}

#fichaContent > *:nth-child(4) {
    animation-delay: 0.4s;
}

#fichaContent .border-l-4.border-orange-500 {
    animation: pulse-border 2s ease-in-out infinite;
}

@keyframes pulse-border {
    0%, 100% {
        border-left-color: #f97316;
    }
    50% {
        border-left-color: #fb923c;
    }
}

#fichaContent .bg-green-50.dark\:bg-green-900\/20,
#fichaContent .bg-red-50.dark\:bg-red-900\/20,
#fichaContent .bg-yellow-50.dark\:bg-yellow-900\/20,
#fichaContent .bg-blue-50.dark\:bg-blue-900\/20 {
    position: relative;
    overflow: hidden;
}

#fichaContent .bg-green-50.dark\:bg-green-900\/20::before {
    content: '🍽️';
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 1.5rem;
    opacity: 0.3;
}

#fichaContent .bg-red-50.dark\:bg-red-900\/20::before {
    content: '⚠️';
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 1.5rem;
    opacity: 0.3;
}

#fichaContent .bg-yellow-50.dark\:bg-yellow-900\/20::before {
    content: '💊';
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 1.5rem;
    opacity: 0.3;
}

#fichaContent .bg-blue-50.dark\:bg-blue-900\/20::before {
    content: '📞';
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 1.5rem;
    opacity: 0.3;
}

#fichaContent .bg-green-50.dark\:bg-green-900\/20:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2);
}

.dark #fichaContent .bg-green-50.dark\:bg-green-900\/20:hover {
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

#fichaContent .bg-red-50.dark\:bg-red-900\/20:hover,
#fichaContent .bg-yellow-50.dark\:bg-yellow-900\/20:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.dark #fichaContent .bg-red-50.dark\:bg-red-900\/20:hover,
.dark #fichaContent .bg-yellow-50.dark\:bg-yellow-900\/20:hover {
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* ============================================================================
   CHART.JS
   ============================================================================ */
canvas {
    max-width: 100%;
    height: auto !important;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */
@media (max-width: 768px) {
    #alert-container {
        top: 60px;
        right: 10px;
        left: 10px;
        max-width: 100%;
    }
    
    .nav-item:hover {
        transform: none;
    }
    
    button:hover::after, .btn:hover::after {
        width: 0;
        height: 0;
    }
    
    #fichaContent .w-24.h-24.bg-white.rounded-full {
        width: 4rem;
        height: 4rem;
        font-size: 1.5rem;
    }
    
    #fichaContent > div:first-child.bg-gradient-to-r {
        padding: 1rem;
    }
    
    #fichaContent > div:first-child.bg-gradient-to-r .flex.items-center.justify-between {
        flex-direction: column;
        gap: 1rem;
    }
    
    #fichaContent button.w-full.text-left:hover {
        transform: translateX(4px);
    }
    
    #fichaContent .bg-red-50.dark\:bg-red-900\/20,
    #fichaContent .bg-yellow-50.dark\:bg-yellow-900\/20,
    #fichaContent .bg-blue-50.dark\:bg-blue-900\/20 {
        padding: 1rem;
    }
}

/* ============================================================================
   Choices.js - Select con búsqueda (complemento a choices.min.css si se usa CDN)
   ============================================================================ */
/* Dropdown de Choices.js siempre visible sobre el contenido posterior */
.choices.is-open {
    position: relative;
    z-index: 30;
}
.choices__list--dropdown {
    z-index: 30;
    max-height: min(280px, 50vh);
    overflow-y: auto !important;
}
/* Dentro de modales: prioridad sobre el backdrop del modal */
.modal-overlay .choices.is-open,
.modal-box .choices.is-open {
    z-index: 60;
}
.modal-overlay .choices__list--dropdown,
.modal-box .choices__list--dropdown {
    z-index: 60;
}
.choices__inner {
    min-height: 2.5rem;
    border-radius: 0.5rem !important;
    border: 1px solid #ddd;
    background-color: #f9f9f9;
}
/* Redondeado cuando el dropdown está abierto (sobrescribe choices.min.css) */
.choices.is-open .choices__inner {
    border-radius: 0.5rem 0.5rem 0 0 !important;
}
.choices.is-flipped.is-open .choices__inner {
    border-radius: 0 0 0.5rem 0.5rem !important;
}
.choices__list--dropdown,
.choices__list[aria-expanded] {
    border-radius: 0 0 0.5rem 0.5rem !important;
}
.choices.is-flipped .choices__list--dropdown,
.choices.is-flipped .choices__list[aria-expanded] {
    border-radius: 0.5rem 0.5rem 0 0 !important;
}
.choices__input {
    background: transparent;
}
.choices[data-type*="select-one"] .choices__input {
    background: transparent;
}
/* ============================================================================
   Choices.js - Modo oscuro
   ============================================================================ */
.dark .choices__inner,
.dark .choices__list--dropdown,
.dark .choices__list[aria-expanded] {
    background-color: rgb(55 65 81);
    border-color: rgb(75 85 99);
}
.dark .choices__input {
    color: rgb(229 231 235);
    background-color: transparent !important;
}
.dark .choices[data-type*="select-one"] .choices__input {
    border-bottom-color: rgb(75 85 99);
    background-color: transparent !important;
}
.dark .choices__list--single .choices__item,
.dark .choices__list--dropdown .choices__item--selectable,
.dark .choices__list[aria-expanded] .choices__item--selectable {
    color: rgb(229 231 235);
}
.dark .choices__list--dropdown .choices__item--selectable.is-highlighted,
.dark .choices__list[aria-expanded] .choices__item--selectable.is-highlighted {
    background-color: rgb(75 85 99);
    color: white;
}
.dark .choices__placeholder {
    color: rgb(156 163 175);
}
.dark .choices__heading {
    color: rgb(209 213 219);
    border-bottom-color: rgb(75 85 99);
}
.dark .choices__item--disabled {
    color: rgb(156 163 175);
    opacity: 0.7;
}
.dark .choices.is-disabled .choices__inner,
.dark .choices.is-disabled .choices__input {
    background-color: rgb(55 65 81) !important;
    border-color: rgb(75 85 99);
    opacity: 0.6;
}
/* Flecha del select-one en modo oscuro */
.dark .choices[data-type*="select-one"]::after {
    border-color: rgb(209 213 219) transparent transparent;
}
.dark .choices[data-type*="select-one"].is-open::after {
    border-color: transparent transparent rgb(209 213 219);
}
/* Select múltiple: ítems seleccionados en dark */
.dark .choices__list--multiple .choices__item {
    background-color: rgb(37 99 235);
    border-color: rgb(29 78 216);
    color: white;
}
.dark .choices__list--multiple .choices__item.is-highlighted {
    background-color: rgb(29 78 216);
    border-color: rgb(30 64 175);
}
.dark .is-disabled .choices__list--multiple .choices__item {
    background-color: rgb(75 85 99);
    border-color: rgb(55 65 81);
}
/* Aviso "sin resultados" / "no hay opciones" */
.dark .choices__item--choice.has-no-results,
.dark .choices__notice {
    color: rgb(156 163 175);
    background-color: transparent;
}

/* ============================================================================
   Leads Kanban (dashboard)
   ============================================================================ */
.kanban-grid-wrapper {
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.7) transparent;
}

.kanban-grid-wrapper::-webkit-scrollbar {
    height: 8px;
}

.kanban-grid-wrapper::-webkit-scrollbar-thumb {
    background-color: rgba(148, 163, 184, 0.7);
    border-radius: 999px;
}

.kanban-column {
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.kanban-column:hover {
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

.lead-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.lead-card:hover {
    transform: translateY(-1px);
    border-color: rgba(59, 130, 246, 0.35);
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.08);
}

.dark .lead-card:hover {
    border-color: rgba(96, 165, 250, 0.45);
    box-shadow: 0 8px 16px rgba(2, 6, 23, 0.35);
}
