/* CeibeRRHH - Custom Styles */

/* Variables CSS para consistencia */
:root {
    --ceibe-primary: #2563eb;
    --ceibe-secondary: #64748b;
    --ceibe-accent: #f59e0b;
    --ceibe-success: #10b981;
    --ceibe-error: #ef4444;
    --ceibe-warning: #f59e0b;
    --ceibe-dark: #1e293b;
    --ceibe-light: #f8fafc;
    --ceibe-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --ceibe-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --ceibe-transition: all 0.3s ease;
}

/* Paginación de DataTables - Solo visible cuando hay más de 500 registros */
.pagination-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.dataTables_paginate {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.dataTables_paginate .paginate_button {
    padding: 0.5rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    background: white;
    color: #475569;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.dataTables_paginate .paginate_button:hover:not(.disabled) {
    background: #f1f5f9;
    border-color: var(--ceibe-primary);
    color: var(--ceibe-primary);
}

.dataTables_paginate .paginate_button.current {
    background: var(--ceibe-primary);
    border-color: var(--ceibe-primary);
    color: white;
}

.dataTables_paginate .paginate_button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Estilos base */
body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--ceibe-light);
    color: var(--ceibe-dark);
}

/* Compensación para header fijo */
.main-content {
    padding-top: 80px; /* Desktop header height + margin */
}

@media (max-width: 768px) {
    .main-content {
        padding-top: 70px; /* Mobile header height + margin */
    }
}

/* Navigation Links */
.nav-link {
    position: relative;
    transition: all 0.2s ease-in-out;
}

.nav-link:hover {
    /* Sin movimiento, solo el efecto de gradiente del fondo */
}

.nav-link.active {
    color: var(--ceibe-primary) !important;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background-color: var(--ceibe-primary);
    border-radius: 1px;
}

/* Desktop Navigation with vertical icons */
@media (min-width: 768px) {
    .nav-link-vertical {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        padding: 8px 12px !important;
        min-width: 80px;
        position: relative;
        border-radius: 8px;
        transition: all 0.2s ease-in-out;
        border: 1px solid transparent;
    }
    
    .nav-link-vertical::before {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 100%;
        background: linear-gradient(to top, rgba(219, 234, 254, 0.8) 0%, transparent 70%);
        border-radius: 8px;
        opacity: 0;
        transition: opacity 0.2s ease-in-out;
        pointer-events: none;
    }
    
    .nav-link-vertical:hover {
        border-color: #bfdbfe;
    }
    
    .nav-link-vertical:hover::before {
        opacity: 1;
    }
    
    .nav-link-vertical i {
        font-size: 16px;
        margin: 0 !important;
        position: relative;
        z-index: 1;
    }
    
    .nav-link-vertical .nav-text {
        font-size: 12px;
        font-weight: 500;
        text-align: center;
        white-space: nowrap;
        position: relative;
        z-index: 1;
    }
    
    .nav-button-vertical {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        padding: 8px 12px !important;
        min-width: 80px;
        border: 1px solid transparent;
        background: none;
        cursor: pointer;
        position: relative;
        border-radius: 8px;
        transition: all 0.2s ease-in-out;
    }
    
    .nav-button-vertical::before {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 100%;
        background: linear-gradient(to top, rgba(219, 234, 254, 0.8) 0%, transparent 70%);
        border-radius: 8px;
        opacity: 0;
        transition: opacity 0.2s ease-in-out;
        pointer-events: none;
    }
    
    .nav-button-vertical:hover {
        border-color: #bfdbfe;
    }
    
    .nav-button-vertical:hover::before {
        opacity: 1;
    }
    
    .nav-button-vertical i {
        font-size: 16px;
        margin: 0 !important;
        position: relative;
        z-index: 1;
    }
    
    .nav-button-vertical .nav-text {
        font-size: 12px;
        font-weight: 500;
        text-align: center;
        white-space: nowrap;
        position: relative;
        z-index: 1;
    }
    
    .nav-button-vertical .chevron {
        display: none;
    }
}

/* Dropdown Links */
.dropdown-link {
    display: block;
    padding: 8px 16px;
    text-decoration: none;
    color: var(--ceibe-dark);
    font-size: 14px;
    transition: all 0.2s ease-in-out;
    border-left: 2.5px solid transparent;
}

.dropdown-link:hover {
    background-color: #dbeafe;
    color: var(--ceibe-dark);
    border-left: 2.5px solid #3b82f6;
}

.dropdown-link i {
    width: 16px;
    text-align: center;
}

/* Mobile Navigation */
.mobile-nav-link {
    transition: all 0.2s ease-in-out;
}

.mobile-nav-link:hover {
    transform: translateX(4px);
}

.mobile-nav-section {
    margin-bottom: 16px;
}

/* Botones personalizados */
.btn-ceibe {
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    outline: none;
    border: none;
    cursor: pointer;
}

.btn-ceibe:focus {
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.5);
}

.btn-primary {
    background-color: var(--ceibe-primary);
    color: white;
}

.btn-primary:hover {
    background-color: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: var(--ceibe-shadow-lg);
}

.btn-primary:focus {
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.5);
}

.btn-secondary {
    background-color: var(--ceibe-secondary);
    color: white;
}

.btn-secondary:hover {
    background-color: #475569;
}

.btn-success {
    background-color: var(--ceibe-success);
    color: white;
}

.btn-success:hover {
    background-color: #059669;
}

.btn-warning {
    background-color: var(--ceibe-warning);
    color: white;
}

.btn-warning:hover {
    background-color: #d97706;
}

.btn-error {
    background-color: var(--ceibe-error);
    color: white;
}

.btn-error:hover {
    background-color: #dc2626;
}

/* Cards personalizadas */
.card-ceibe {
    background: white;
    border-radius: 12px;
    box-shadow: var(--ceibe-shadow-lg);
    padding: 24px;
    transition: all 0.3s ease;
}

.card-ceibe:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* Inputs personalizados */
.input-ceibe {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    outline: none;
    transition: all 0.3s ease;
}

.input-ceibe:focus {
    border-color: var(--ceibe-primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.5);
}

/* Efectos hover para elementos interactivos */
.hover-lift {
    transition: transform 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
}

/* Loader personalizado */
.loader {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Animaciones personalizadas */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Responsive utilities */
@media (max-width: 640px) {
    .desktop-only {
        display: none !important;
    }
}

@media (min-width: 641px) {
    .mobile-only {
        display: none !important;
    }
}

/* Estilos de formularios específicos */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    color: var(--ceibe-dark);
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--ceibe-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-select {
    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 12px center;
    background-repeat: no-repeat;
    background-size: 16px 12px;
    padding-right: 40px;
}

/* Utilidades para charts */
.chart-container {
    position: relative;
    height: 256px;
    width: 100%;
}

@media (min-width: 768px) {
    .chart-container {
        height: 320px;
    }
}

/* Overlay de loading */
.loading-overlay {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ============================================
   DataTable Selector de Empleados
   ============================================ */
#selectorEmpleadosTable_wrapper .dataTables_filter {
    padding: 8px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

#selectorEmpleadosTable_wrapper .dataTables_filter input {
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    padding: 6px 12px;
    font-size: 0.875rem;
    width: 100%;
    margin-left: 0;
}

#selectorEmpleadosTable_wrapper .dataTables_filter input:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

#selectorEmpleadosTable tbody tr {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

#selectorEmpleadosTable tbody tr:hover {
    background-color: #f3f4f6 !important;
}

#selectorEmpleadosTable tbody td {
    padding: 8px 12px;
    font-size: 0.875rem;
}

#selectorEmpleadosTable thead th {
    padding: 8px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    color: #6b7280;
}

/* ============================================
   Dev Mode Toast - Advertencia de desarrollo
   ============================================ */
.dev-mode-toast {
    border: 2px solid #FF6B00 !important;
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.3) !important;
}

.dev-mode-title {
    font-weight: 700 !important;
    color: #FF6B00 !important;
    font-size: 0.95rem !important;
}

.dev-mode-toast .swal2-html-container {
    margin-top: 0.25rem !important;
    font-size: 0.85rem !important;
}

/* ============================================
   CeibeRRHH Toast Vertical - Diseño centrado
   Icono arriba, texto debajo, texto negro
   ============================================ */

/* Forzar layout vertical en el toast */
.swal2-popup.swal2-toast.ceibe-toast-vertical {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 1.25rem 2rem 1.5rem 2rem !important;
    min-width: 220px !important;
    max-width: 400px !important;
    border-radius: 16px !important;
    border: 2px solid #2d2d33 !important;
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 10px 15px -3px rgba(0, 0, 0, 0.15),
        0 20px 25px -5px rgba(0, 0, 0, 0.1) !important;
    background: white !important;
    overflow: hidden !important;
}

/* Ocultar el grid por defecto del toast y forzar columna */
.swal2-popup.swal2-toast.ceibe-toast-vertical .swal2-icon {
    order: 1 !important;
    margin: 0 auto 0.75rem auto !important;
    transform: scale(1.3) !important;
    transform-origin: center center !important;
}

.swal2-popup.swal2-toast.ceibe-toast-vertical .swal2-title {
    order: 2 !important;
    margin: 0 !important;
    padding: 0 !important;
    justify-content: center !important;
}

/* Icono de éxito */
.swal2-popup.swal2-toast.ceibe-toast-vertical .swal2-icon.swal2-success {
    border-color: #10b981 !important;
}

.swal2-popup.swal2-toast.ceibe-toast-vertical .swal2-icon.swal2-success [class^='swal2-success-line'] {
    background-color: #10b981 !important;
}

.swal2-popup.swal2-toast.ceibe-toast-vertical .swal2-icon.swal2-success .swal2-success-ring {
    border-color: rgba(16, 185, 129, 0.3) !important;
}

/* Icono de error */
.swal2-popup.swal2-toast.ceibe-toast-vertical .swal2-icon.swal2-error {
    border-color: #ef4444 !important;
}

.swal2-popup.swal2-toast.ceibe-toast-vertical .swal2-icon.swal2-error .swal2-x-mark-line-left,
.swal2-popup.swal2-toast.ceibe-toast-vertical .swal2-icon.swal2-error .swal2-x-mark-line-right {
    background-color: #ef4444 !important;
}

/* Icono de warning */
.swal2-popup.swal2-toast.ceibe-toast-vertical .swal2-icon.swal2-warning {
    border-color: #f59e0b !important;
    color: #f59e0b !important;
}

/* Icono de info */
.swal2-popup.swal2-toast.ceibe-toast-vertical .swal2-icon.swal2-info {
    border-color: #3b82f6 !important;
    color: #3b82f6 !important;
}

/* Título/texto siempre negro y centrado */
.swal2-popup.swal2-toast.ceibe-toast-vertical .swal2-title.ceibe-toast-title,
.ceibe-toast-title {
    color: #1e293b !important;
    font-weight: 600 !important;
    font-size: 1rem !important;
    text-align: center !important;
    line-height: 1.5 !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
}

/* Barra de progreso en la parte inferior */
.swal2-popup.swal2-toast.ceibe-toast-vertical .swal2-timer-progress-bar-container {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 5px !important;
    border-radius: 0 0 16px 16px !important;
    overflow: hidden !important;
}

.swal2-popup.swal2-toast.ceibe-toast-vertical .swal2-timer-progress-bar {
    height: 5px !important;
    background: linear-gradient(90deg, #5eead4, #2dd4bf) !important;
}

/* HTML container para mensajes secundarios */
.swal2-popup.swal2-toast.ceibe-toast-vertical .swal2-html-container {
    order: 3 !important;
    color: #1e293b !important;
    margin-top: 0.5rem !important;
    text-align: center !important;
}

/* ============================================
   Toast Flip Animations
   ============================================ */
@keyframes toastFlipIn {
    0% {
        transform: perspective(400px) rotateX(90deg);
        opacity: 0;
    }
    40% {
        transform: perspective(400px) rotateX(-10deg);
    }
    70% {
        transform: perspective(400px) rotateX(10deg);
    }
    100% {
        transform: perspective(400px) rotateX(0deg);
        opacity: 1;
    }
}

@keyframes toastFlipOut {
    0% {
        transform: perspective(400px) rotateX(0deg);
        opacity: 1;
    }
    30% {
        transform: perspective(400px) rotateX(-10deg);
        opacity: 1;
    }
    100% {
        transform: perspective(400px) rotateX(90deg);
        opacity: 0;
    }
}

.toast-flip-in {
    animation: toastFlipIn 0.5s ease-out forwards;
}

.toast-flip-out {
    animation: toastFlipOut 0.4s ease-in forwards;
}

/* ============================================
   SweetAlert2 Alerts - Estilo unificado con Toasts
   ============================================ */

/* Animaciones flip para alertas normales */
@keyframes alertFlipIn {
    0% {
        transform: perspective(400px) rotateX(90deg);
        opacity: 0;
    }
    40% {
        transform: perspective(400px) rotateX(-10deg);
    }
    70% {
        transform: perspective(400px) rotateX(10deg);
    }
    100% {
        transform: perspective(400px) rotateX(0deg);
        opacity: 1;
    }
}

@keyframes alertFlipOut {
    0% {
        transform: perspective(400px) rotateX(0deg);
        opacity: 1;
    }
    30% {
        transform: perspective(400px) rotateX(-10deg);
        opacity: 1;
    }
    100% {
        transform: perspective(400px) rotateX(90deg);
        opacity: 0;
    }
}

.alert-flip-in {
    animation: alertFlipIn 0.5s ease-out forwards !important;
    transform-style: preserve-3d;
}

.alert-flip-out {
    animation: alertFlipOut 0.4s ease-in forwards !important;
    transform-style: preserve-3d;
}

/* Estilos visuales para alertas normales (igual que toasts) */
.swal2-popup.ceibe-alert {
    border-radius: 16px !important;
    border: 2px solid #2d2d33 !important;
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 10px 15px -3px rgba(0, 0, 0, 0.15),
        0 20px 25px -5px rgba(0, 0, 0, 0.1) !important;
    background: white !important;
}

/* Desactivar animaciones por defecto de SweetAlert2 para alertas con clase ceibe-alert */
.swal2-popup.ceibe-alert.swal2-show {
    animation: none !important;
}

.swal2-popup.ceibe-alert.swal2-hide {
    animation: none !important;
}

/* ============================================
   Animaciones Fade In/Out para alertas
   ============================================ */
@keyframes alertFadeIn {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes alertFadeOut {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-20px);
    }
}

.alert-fade-in {
    animation: alertFadeIn 0.3s ease-out forwards !important;
}

.alert-fade-out {
    animation: alertFadeOut 0.25s ease-in forwards !important;
}

/* Animación para modales HTML */
@keyframes modalFadeIn {
    0% {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.animate-modal-fade-in {
    animation: modalFadeIn 0.25s ease-out forwards;
}

