/**
 * ============================================
 * ESTILOS PERSONALIZADOS - VAKUTIN
 * Complementa Tailwind CSS con animaciones y efectos
 * Versión 3.0 - Optimizado y sin duplicados
 * ============================================
 */

/* ============================================
   ANIMACIONES KEYFRAMES
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {
    0%, 100% { 
        transform: translateX(0); 
    }
    10%, 30%, 50%, 70%, 90% { 
        transform: translateX(-5px); 
    }
    20%, 40%, 60%, 80% { 
        transform: translateX(5px); 
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% { 
        opacity: 1; 
    }
    50% { 
        opacity: 0.5; 
    }
}

@keyframes spin {
    from { 
        transform: rotate(0deg); 
    }
    to { 
        transform: rotate(360deg); 
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* ============================================
   CLASES DE ANIMACIÓN
   ============================================ */

.animate-fade-in {
    animation: fadeIn 0.5s ease-out;
}

.animate-shake,
.shake {
    animation: shake 0.5s ease-in-out;
}

.animate-slide-in {
    animation: slideIn 0.3s ease-out;
}

/* ============================================
   LOADING Y OVERLAYS
   ============================================ */

.loader-overlay,
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease-out;
}

.loader-overlay {
    background: rgba(255, 255, 255, 0.95);
}

.loading-overlay.active {
    display: flex;
}

.loader,
.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e5e7eb;
    border-top-color: #3B82F6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    will-change: transform;
    transform: translateZ(0);
}

.skeleton {
    animation: shimmer 2s infinite;
    background: linear-gradient(
        to right,
        #f0f0f0 0%,
        #e0e0e0 20%,
        #f0f0f0 40%,
        #f0f0f0 100%
    );
    background-size: 1000px 100%;
}

/* ============================================
   INPUTS Y FORMULARIOS
   ============================================ */

.input-field {
    transition: all 0.2s ease-in-out;
}

.input-field:focus {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.input-field.border-red-500 {
    animation: shake 0.5s ease-in-out;
}

.input-field::placeholder {
    color: #9CA3AF;
    opacity: 1;
}

.input-field:focus::placeholder {
    opacity: 0.5;
}

/* Estados de validación */
.input-error {
    border-color: #EF4444 !important;
    background-color: #FEF2F2 !important;
}

.input-success {
    border-color: #10B981 !important;
    background-color: #F0FDF4 !important;
}

/* Mensajes de error */
.error-message {
    display: block;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    animation: fadeIn 0.2s ease-out;
}

/* ============================================
   BOTONES
   ============================================ */

.btn-primary {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:active::before {
    width: 300px;
    height: 300px;
}

.btn-primary:hover {
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.3);
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
}

/* Botones de acción */
.btn-action {
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.btn-editar {
    background-color: #10B981;
    color: white;
}

.btn-editar:hover {
    background-color: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.btn-eliminar {
    background-color: #EF4444;
    color: white;
}

.btn-eliminar:hover {
    background-color: #DC2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.btn-reservar {
    background-color: #3B82F6;
    color: white;
}

.btn-reservar:hover {
    background-color: #2563EB;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* ============================================
   ALERTAS Y MENSAJES
   ============================================ */

.alert-error,
.alert-success {
    animation: slideIn 0.3s ease-out;
    transition: all 0.3s ease;
}

.alert-error {
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

.alert-success {
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.15);
}

/* ============================================
   BADGES Y ETIQUETAS
   ============================================ */

.badge-optimo {
    background-color: #D1FAE5;
    color: #065F46;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-critico {
    background-color: #FEE2E2;
    color: #991B1B;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-advertencia {
    background-color: #FEF3C7;
    color: #92400E;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ============================================
   INDICADORES DE INVENTARIO
   ============================================ */

.inventario-bajo {
    color: #DC2626;
    font-weight: 600;
}

.inventario-medio {
    color: #F59E0B;
    font-weight: 600;
}

.inventario-alto {
    color: #10B981;
    font-weight: 600;
}

/* ============================================
   DATATABLES
   ============================================ */

.dataTables_wrapper .dataTables_length select {
    padding: 0.375rem 2rem 0.375rem 0.75rem;
    border: 1px solid #D1D5DB;
    border-radius: 0.375rem;
}

.dataTables_wrapper .dataTables_filter input {
    padding: 0.375rem 0.75rem;
    border: 1px solid #D1D5DB;
    border-radius: 0.375rem;
    margin-left: 0.5rem;
}

/* ============================================
   INDICADOR DE FORTALEZA DE CONTRASEÑA
   ============================================ */

#password_strength {
    animation: fadeIn 0.3s ease-out;
}

#strength_bar {
    transition: all 0.3s ease-in-out;
}

/* ============================================
   SOMBRAS PERSONALIZADAS
   ============================================ */

.shadow-3xl {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* ============================================
   EFECTOS DE GLASSMORPHISM
   ============================================ */

.glass-effect {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* ============================================
   SCROLLBAR PERSONALIZADO
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ============================================
   TOOLTIPS
   ============================================ */

.tooltip {
    position: relative;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    padding: 8px 12px;
    background: #1f2937;
    color: white;
    font-size: 0.875rem;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out;
    z-index: 1000;
}

.tooltip::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1f2937;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out;
}

.tooltip:hover::before,
.tooltip:hover::after {
    opacity: 1;
}

/* ============================================
   ACCESIBILIDAD
   ============================================ */

/* Focus visible para teclado */
*:focus-visible {
    outline: 2px solid #3B82F6;
    outline-offset: 2px;
}

/* Ocultar visualmente pero mantener accesible */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ============================================
   ESTADOS ESPECIALES
   ============================================ */

.loading {
    pointer-events: none;
    opacity: 0.6;
    cursor: wait;
}

input:disabled,
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   TRANSICIONES GLOBALES
   ============================================ */

a {
    transition: color 0.2s ease-in-out;
}

button {
    transition: all 0.2s ease-in-out;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

input,
select,
textarea {
    transition: all 0.2s ease-in-out;
}

.bg-white {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* ============================================
   MEJORAS DE PERFORMANCE
   ============================================ */

.animate-fade-in,
.animate-shake,
.animate-slide-in,
.btn-primary,
.input-field {
    will-change: transform;
}

/* ============================================
   MEJORAS DE LEGIBILIDAD
   ============================================ */

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 640px) {
    .loader-overlay {
        background: rgba(255, 255, 255, 0.98);
    }
    
    .input-field {
        font-size: 16px; /* Prevenir zoom en iOS */
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .shadow-2xl,
    .shadow-3xl {
        box-shadow: none;
    }
}

/* ============================================
   REDUCIR MOVIMIENTO (ACCESIBILIDAD)
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   MODO OSCURO (PREPARADO PARA FUTURO)
   ============================================ */

@media (prefers-color-scheme: dark) {
    /* 
    Descomentar cuando se implemente modo oscuro
    
    body {
        background: linear-gradient(to bottom right, #1e293b, #0f172a);
    }
    
    .bg-white {
        background-color: #1e293b !important;
        color: #f1f5f9;
    }
    
    .text-gray-800 {
        color: #f1f5f9 !important;
    }
    
    .text-gray-600 {
        color: #cbd5e1 !important;
    }
    
    .border-gray-300 {
        border-color: #475569 !important;
    }
    
    .input-field {
        background-color: #334155;
        color: #f1f5f9;
    }
    */
}



 /* Badges de tipo */
        .badge-jeringa {
            background-color: #DBEAFE;
            color: #1E40AF;
            padding: 0.25rem 0.75rem;
            border-radius: 9999px;
            font-size: 0.75rem;
            font-weight: 600;
        }
        
        .badge-aguja {
            background-color: #FEE2E2;
            color: #991B1B;
            padding: 0.25rem 0.75rem;
            border-radius: 9999px;
            font-size: 0.75rem;
            font-weight: 600;
        }
        
        .badge-algodon {
            background-color: #F3E8FF;
            color: #6B21A8;
            padding: 0.25rem 0.75rem;
            border-radius: 9999px;
            font-size: 0.75rem;
            font-weight: 600;
        }
        
        .badge-alcohol {
            background-color: #FEF3C7;
            color: #92400E;
            padding: 0.25rem 0.75rem;
            border-radius: 9999px;
            font-size: 0.75rem;
            font-weight: 600;
        }
        
        .badge-guantes {
            background-color: #D1FAE5;
            color: #065F46;
            padding: 0.25rem 0.75rem;
            border-radius: 9999px;
            font-size: 0.75rem;
            font-weight: 600;
        }
        
        .badge-otro {
            background-color: #E5E7EB;
            color: #374151;
            padding: 0.25rem 0.75rem;
            border-radius: 9999px;
            font-size: 0.75rem;
            font-weight: 600;
        }

                /* Select2 básico */
        .select2-container {
            width: 100% !important;
        }

                /* Estilos personalizados para badges de estado */
        .badge {
            padding: 4px 12px;
            border-radius: 12px;
            font-size: 0.75rem;
            font-weight: 600;
            text-transform: uppercase;
            display: inline-block;
        }
        
        .badge-pendiente {
            background-color: #FEF3C7;
            color: #92400E;
        }
        
        .badge-aplicada {
            background-color: #D1FAE5;
            color: #065F46;
        }
        
        .badge-cancelada {
            background-color: #FEE2E2;
            color: #991B1B;
        }
        
        .badge-liberada {
            background-color: #E0E7FF;
            color: #3730A3;
        }
        
        /* Animaciones */
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
        
        .animate-fade-in {
            animation: fadeIn 0.3s ease-out;
        }
        
        /* Estilos para DataTables */
        .dataTables_wrapper .dataTables_length select,
        .dataTables_wrapper .dataTables_filter input {
            border: 1px solid #D1D5DB;
            border-radius: 0.375rem;
            padding: 0.5rem;
        }
        
        .dataTables_wrapper .dataTables_paginate .paginate_button.current {
            background: #3B82F6 !important;
            color: white !important;
            border-color: #3B82F6 !important;
        }
        
        .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
            background: #60A5FA !important;
            color: white !important;
            border-color: #60A5FA !important;
        }

/* ============================================
   FIN DEL ARCHIVO
   Vakutin © 2025
   ============================================ */
