/* ============================================
   ESTILOS GLOBALES - SISTEMA IMAP 2026
   Paleta: Púrpura/Azul (#667eea, #764ba2)
   ============================================ */

/* Variables CSS globales */
:root {
    /* Colores principales */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #6B73FF 0%, #000DFF 100%);
    --accent-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --warning-gradient: linear-gradient(135deg, #f5af19 0%, #f12711 100%);
    
    /* Colores sólidos */
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --accent-color: #f093fb;
    --success-color: #11998e;
    --danger-color: #f5576c;
    --warning-color: #f5af19;
    
    /* Fondos y efectos */
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-bg-light: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(255, 255, 255, 0.3);
    --shadow-color: rgba(102, 126, 234, 0.15);
    --shadow-hover: rgba(102, 126, 234, 0.25);
    
    /* Texto */
    --text-primary: #1a1a2e;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    
    /* Transiciones */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    --transition-bounce: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Reset y base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Tipografía */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--secondary-color);
}

/* Utilidades de glassmorphism */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 8px 32px var(--shadow-color);
}

.glass-light {
    background: var(--glass-bg-light);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
}

/* Botones globales */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.4rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.btn:active::before {
    width: 200%;
    height: 200%;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.45);
    color: white;
}

.btn-success {
    background: var(--success-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(17, 153, 142, 0.3);
}

.btn-danger {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.3);
}

.btn-outline-primary {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline-primary:hover {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
}

/* Formularios globales */
.form-control,
.form-select {
    width: 100%;
    padding: 0.85rem 1.2rem;
    font-size: 0.95rem;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    transition: var(--transition-normal);
    background: white;
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(102, 126, 234, 0.15);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

/* Cards globales */
.card {
    background: var(--glass-bg);
    border: none;
    border-radius: 20px;
    box-shadow: 0 8px 32px var(--shadow-color);
    transition: var(--transition-bounce);
    overflow: hidden;
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: var(--transition-normal);
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 50px var(--shadow-hover);
}

.card:hover::before {
    opacity: 1;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid rgba(102, 126, 234, 0.1);
    padding: 1.5rem;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    background: transparent;
    border-top: 1px solid rgba(102, 126, 234, 0.1);
    padding: 1.5rem;
}

/* Badges globales */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.9rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 8px;
    letter-spacing: 0.3px;
}

.badge-primary {
    background: var(--primary-gradient);
    color: white;
}

.badge-success {
    background: var(--success-gradient);
    color: white;
}

.badge-danger {
    background: var(--accent-gradient);
    color: white;
}

.badge-light {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary-color);
}

/* Alertas globales */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 14px;
    border: none;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    animation: slideDown 0.4s var(--transition-bounce);
}

.alert-success {
    background: rgba(56, 239, 125, 0.1);
    color: #11998e;
    border: 1px solid rgba(56, 239, 125, 0.2);
}

.alert-danger {
    background: rgba(245, 87, 108, 0.1);
    color: #f5576c;
    border: 1px solid rgba(245, 87, 108, 0.2);
}

.alert-warning {
    background: rgba(245, 175, 25, 0.1);
    color: #f5af19;
    border: 1px solid rgba(245, 175, 25, 0.2);
}

.alert-info {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary-color);
    border: 1px solid rgba(102, 126, 234, 0.2);
}

/* Tablas globales */
.table {
    border-collapse: separate;
    border-spacing: 0 10px;
}

.table thead th {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border: none;
    padding: 1rem 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.table tbody td {
    background: white;
    border: none;
    padding: 1rem 1.5rem;
    vertical-align: middle;
}

.table tbody tr {
    box-shadow: 0 2px 15px rgba(102, 126, 234, 0.08);
    transition: var(--transition-normal);
}

.table tbody tr:hover {
    transform: scale(1.01);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-gradient);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
}

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

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(25px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px rgba(102, 126, 234, 0.5); }
    50% { box-shadow: 0 0 20px rgba(102, 126, 234, 0.8); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Clases de animación */
.animate-fadeIn { animation: fadeIn 0.5s ease forwards; }
.animate-fadeInUp { animation: fadeInUp 0.5s ease forwards; }
.animate-fadeInDown { animation: fadeInDown 0.5s ease forwards; }
.animate-slideDown { animation: slideDown 0.4s ease forwards; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }
.animate-glow { animation: glow 2s ease-in-out infinite; }
.animate-float { animation: float 3s ease-in-out infinite; }

/* Loader global */
.loader {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(102, 126, 234, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
}

.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
}

.loader-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Utilidades */
.text-gradient {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-gradient {
    background: var(--primary-gradient);
}

.shadow-soft {
    box-shadow: 0 8px 32px var(--shadow-color);
}

.shadow-medium {
    box-shadow: 0 15px 40px var(--shadow-color);
}

.shadow-strong {
    box-shadow: 0 25px 50px var(--shadow-hover);
}

/* Responsive base */
@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    
    .card {
        border-radius: 16px;
    }
    
    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .form-control,
    .form-select {
        padding: 0.75rem 1rem;
    }
}

@media (max-width: 480px) {
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    
    .card {
        border-radius: 12px;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
        border-radius: 10px;
    }
}

/* SweetAlert2 personalización */
.swal2-popup {
    border-radius: 20px !important;
    padding: 2rem !important;
}

.swal2-title {
    color: var(--text-primary) !important;
    font-weight: 700 !important;
}

.swal2-html-container {
    color: var(--text-secondary) !important;
}

.swal2-confirm {
    background: var(--primary-gradient) !important;
    border-radius: 12px !important;
    font-weight: 600 !important;
    padding: 0.8rem 2rem !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3) !important;
}

.swal2-cancel {
    border-radius: 12px !important;
    font-weight: 600 !important;
    padding: 0.8rem 2rem !important;
}

/* DataTables personalización */
.dataTables_wrapper .dataTables_filter input {
    border: 2px solid #e9ecef !important;
    border-radius: 12px !important;
    padding: 0.6rem 1rem !important;
    transition: var(--transition-normal);
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 0.25rem rgba(102, 126, 234, 0.15) !important;
    outline: none !important;
}

.dataTables_wrapper .dataTables_length select {
    border: 2px solid #e9ecef !important;
    border-radius: 10px !important;
    padding: 0.4rem 2rem 0.4rem 0.8rem !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 10px !important;
    margin: 0 2px !important;
    padding: 0.5rem 0.9rem !important;
    transition: var(--transition-normal) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary-gradient) !important;
    border: none !important;
    color: white !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: rgba(102, 126, 234, 0.1) !important;
    border: none !important;
    color: var(--primary-color) !important;
}
/* ============================================
   SWEETALERT2 - ALERTAS COMPACTAS Y SUTILES
   ============================================ */

/* Popup compacto */
.swal2-popup.swal-compact {
    width: auto !important;
    min-width: 280px;
    max-width: 340px;
    padding: 1rem 1.25rem !important;
    border-radius: 12px !important;
    font-size: 0.9rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
}

.swal2-popup.swal-compact .swal2-title {
    font-size: 1rem !important;
    font-weight: 600;
    padding: 0 0 0.5rem 0 !important;
    margin: 0 !important;
    color: var(--text-primary);
}

.swal2-popup.swal-compact .swal2-html-container {
    font-size: 0.85rem !important;
    margin: 0.25rem 0 0.75rem 0 !important;
    padding: 0 !important;
    color: var(--text-secondary);
}

.swal2-popup.swal-compact .swal2-icon {
    width: 50px !important;
    height: 50px !important;
    margin: 0 auto 0.5rem !important;
    border-width: 3px !important;
}

.swal2-popup.swal-compact .swal2-icon .swal2-icon-content {
    font-size: 2rem !important;
}

.swal2-popup.swal-compact .swal2-actions {
    margin-top: 0.5rem !important;
    gap: 0.5rem;
}

.swal2-popup.swal-compact .swal2-confirm,
.swal2-popup.swal-compact .swal2-cancel {
    padding: 0.4rem 1rem !important;
    font-size: 0.8rem !important;
    border-radius: 6px !important;
    font-weight: 500 !important;
    min-width: 80px;
}

.swal2-popup.swal-compact .swal2-input {
    height: 36px !important;
    font-size: 0.85rem !important;
    margin: 0.5rem 0 !important;
    border-radius: 6px !important;
}

/* Loading overlay sutil */
.swal2-popup.swal-loading {
    width: auto !important;
    min-width: 180px;
    padding: 1.25rem 1.5rem !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
}

.swal2-popup.swal-loading .swal2-title {
    font-size: 0.85rem !important;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 0.5rem !important;
}

/* Colores personalizados para iconos */
.swal2-popup.swal-compact .swal2-icon.swal2-success {
    border-color: #28a745 !important;
    color: #28a745 !important;
}

.swal2-popup.swal-compact .swal2-icon.swal2-error {
    border-color: #dc3545 !important;
}

.swal2-popup.swal-compact .swal2-icon.swal2-warning {
    border-color: #ffc107 !important;
    color: #ffc107 !important;
}

.swal2-popup.swal-compact .swal2-icon.swal2-question {
    border-color: var(--primary-color) !important;
    color: var(--primary-color) !important;
}

/* ============================================
   TOAST ELEGANTE GLOBAL (estilo moderno)
   ============================================ */
.toast-container {
    position: fixed;
    top: 80px; /* Debajo del navbar */
    right: 20px;
    z-index: 10500; /* Por encima del navbar (z-index 1030) */
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 380px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 14px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateX(calc(100% + 30px));
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.hide {
    transform: translateX(calc(100% + 30px));
    opacity: 0;
}

.toast-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.95) 0%, rgba(5, 150, 105, 0.95) 100%);
    color: white;
}

.toast-error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.95) 0%, rgba(220, 38, 38, 0.95) 100%);
    color: white;
}

.toast-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.95) 0%, rgba(217, 119, 6, 0.95) 100%);
    color: white;
}

.toast-info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.95) 0%, rgba(37, 99, 235, 0.95) 100%);
    color: white;
}

.toast-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.toast-message {
    flex: 1;
    line-height: 1.5;
    letter-spacing: -0.01em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 0 0 14px 14px;
    animation: toastProgress linear forwards;
}

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* Responsive para móviles */
@media (max-width: 480px) {
    .toast-container {
        top: 70px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .toast {
        padding: 14px 16px;
        font-size: 0.85rem;
    }
}

/* ===== DESACTIVAR HOVER ANIMATIONS EN DISPOSITIVOS TÁCTILES ===== */
@media (hover: none) {
    .btn:hover,
    .card:hover {
        transform: none !important;
    }
}