/* ============================================
   ESTILOS COMUNES - AlPrint HR
   ============================================ */

/* Variables de colores y tipografía */
body {
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

/* Colores personalizados */
.bg-navy { background-color: #0a0e27; }
.bg-navy-light { background-color: #1a1f3a; }
.bg-navy-dark { background-color: #050814; }
.text-navy-dark { color: #050814; }
.text-navy { color: #0a0e27; }
.text-yellow-custom { color: #f1c40f; }
.bg-yellow-custom { background-color: #f1c40f; }
.border-yellow-custom { border-color: #f1c40f; }

/* Sidebar común */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height para móviles */
    width: 240px;
    background: linear-gradient(180deg, #1a1f3a 0%, #0a0e27 100%);
    border-right: 1px solid rgba(241, 196, 15, 0.2);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header del sidebar - fijo en la parte superior */
.sidebar > .p-6:first-child {
    flex-shrink: 0;
    background: linear-gradient(180deg, #1a1f3a 0%, rgba(26, 31, 58, 0.95) 100%);
    position: relative;
    z-index: 2;
}

/* Navegación del sidebar - scrollable con gradiente */
.sidebar > nav {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(241, 196, 15, 0.3) transparent;
    padding-bottom: 0.5rem;
    min-height: 0;
    position: relative;
}

/* Scrollbar personalizado para webkit */
.sidebar > nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar > nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar > nav::-webkit-scrollbar-thumb {
    background: rgba(241, 196, 15, 0.3);
    border-radius: 3px;
}

.sidebar > nav::-webkit-scrollbar-thumb:hover {
    background: rgba(241, 196, 15, 0.5);
}

/* Footer del sidebar - fijo en la parte inferior con sombra superior */
.sidebar > div:last-child {
    flex-shrink: 0;
    position: relative;
    background: linear-gradient(180deg, rgba(10, 14, 39, 0.8) 0%, #0a0e27 100%);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
    z-index: 2;
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.sidebar-item:hover {
    background: rgba(241, 196, 15, 0.1);
    color: #f1c40f;
    border-left-color: #f1c40f;
}

.sidebar-item.active {
    background: rgba(241, 196, 15, 0.2);
    color: #f1c40f;
    border-left-color: #f1c40f;
}

.main-content {
    margin-left: 240px;
    transition: all 0.3s ease;
}

.menu-icon {
    width: 20px;
    height: 20px;
    margin-right: 12px;
}

/* Overlay y menú móvil */
#sidebarOverlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    z-index: 40;
    transition: opacity 0.3s ease;
}

.menu-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 60;
    width: 48px;
    height: 48px;
    background-color: #1a1f3a;
    border: 1px solid rgba(241, 196, 15, 0.3);
    border-radius: 0.5rem;
    align-items: center;
    justify-content: center;
    color: #f1c40f;
    cursor: pointer;
    transition: all 0.3s ease;
}

.menu-toggle:hover {
    background-color: #0a0e27;
    border-color: rgba(241, 196, 15, 0.5);
}

/* Efectos visuales comunes */
.glass-elegant {
    background: rgba(26, 31, 58, 0.7);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(241, 196, 15, 0.2);
}

.neon-border {
    border: 1px solid rgba(241, 196, 15, 0.3);
    box-shadow: 0 0 10px rgba(241, 196, 15, 0.1), inset 0 0 10px rgba(241, 196, 15, 0.05);
}

.animated-line {
    position: relative;
    overflow: hidden;
    padding-bottom: 10px;
}

.animated-line::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100px;
    height: 2px;
    background: linear-gradient(90deg, #f1c40f, #f39c12);
}

.gradient-text {
    background: linear-gradient(135deg, #f1c40f 0%, #f39c12 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Inputs oscuros comunes */
.input-dark, .select-dark, .textarea-dark {
    background-color: #050814;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    width: 100%;
    transition: all 0.2s ease;
}

.input-dark:focus, .select-dark:focus, .textarea-dark:focus {
    border-color: #f1c40f;
    box-shadow: 0 0 0 1px #f1c40f;
    outline: none;
}

.input-file-dark {
    color: white;
}

.input-file-dark::file-selector-button {
    background-color: #f1c40f;
    color: #050814;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-right: 1rem;
}

.input-file-dark::file-selector-button:hover {
    background-color: #e0a800;
}

/* Modal común */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

/* Responsive común */
@media (max-width: 640px) {
    .menu-toggle {
        display: flex !important;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        max-width: 85vw;
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height */
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.6);
    }
    
    /* Header más compacto en móvil */
    .sidebar > .p-6:first-child {
        padding: 1rem 1.5rem 1rem 4rem;
    }
    
    /* Navegación con altura calculada dinámicamente */
    .sidebar > nav {
        flex: 1 1 auto;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        min-height: 0;
        max-height: calc(100vh - 180px); /* Espacio para header y footer */
        max-height: calc(100dvh - 180px);
    }
    
    /* Footer compacto pero siempre visible */
    .sidebar > div:last-child {
        flex-shrink: 0;
        padding: 1rem 1.5rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .main-content {
        margin-left: 0;
        padding: 1rem !important;
        padding-top: 5rem !important;
    }
    
    .sidebar h2 {
        font-size: 1.125rem;
    }
    
    .sidebar-item {
        padding: 0.875rem 1.25rem;
        font-size: 0.9375rem;
    }
    
    .sidebar-text {
        white-space: nowrap;
    }
    
    /* Mejorar el botón de cerrar sesión en móvil */
    .sidebar > div:last-child a {
        font-size: 0.9375rem;
        padding: 0.625rem 1rem;
    }
}

/* Optimización para pantallas muy pequeñas */
@media (max-width: 360px) {
    .sidebar {
        width: 260px;
    }
    
    .sidebar > .p-6:first-child {
        padding-left: 3.5rem;
    }
    
    .sidebar h2 {
        font-size: 1rem;
    }
    
    .sidebar-item {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
}

/* Estilos para mensajes flash */
.flash { 
    padding: 15px; 
    margin-bottom: 20px; 
    border-radius: 4px; 
    font-weight: bold; 
    text-align: center; 
}
.flash.error { 
    background-color: rgba(220, 53, 69, 0.2); 
    color: #f8d7da; 
    border: 1px solid rgba(220, 53, 69, 0.5); 
}
.flash.warning { 
    background-color: rgba(255, 193, 7, 0.2); 
    color: #fff3cd; 
    border: 1px solid rgba(255, 193, 7, 0.5); 
}
.flash.info { 
    background-color: rgba(23, 162, 184, 0.2); 
    color: #d1ecf1; 
    border: 1px solid rgba(23, 162, 184, 0.5); 
}
.flash.success { 
    background-color: rgba(40, 167, 69, 0.2); 
    color: #d4edda; 
    border: 1px solid rgba(40, 167, 69, 0.5); 
}

/* Estilos para tablas responsive */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    table {
        font-size: 0.75rem;
    }
    
    th, td {
        padding: 0.5rem !important;
    }
}

@media (max-width: 640px) {
    .hide-mobile {
        display: none;
    }
    
    table {
        font-size: 0.875rem;
    }
}

/* Estilos para impresión */
@media print {
    .sidebar, .no-print {
        display: none !important;
    }
    .main-content {
        margin-left: 0;
    }
}

