/**
 * TRACERT SYSTEM EAS - ANIMATIONS & MICRO-INTERACTIONS
 * Conforme a ISO 9241-210, WCAG 2.1 AA e ISO 3864
 */

/* =========================================
   1. KEYFRAMES DE ANIMACIÓN
   ========================================= */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

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

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(37, 99, 235, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    }
}

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

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

/* =========================================
   2. CLASES DE UTILIDAD DE ANIMACIÓN
   ========================================= */
.animate-fade-in {
    animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-fade-in-up {
    animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Microinteracciones en tarjetas */
.card-hover-elevate {
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.25s ease;
    will-change: transform, box-shadow;
}

.card-hover-elevate:hover {
    transform: translateY(-5px);
}

/* Estados de carga en botones (ISO 9001) */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.85;
}

.btn-loading .btn-text-content {
    visibility: hidden;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 1.1rem;
    height: 1.1rem;
    top: calc(50% - 0.55rem);
    left: calc(50% - 0.55rem);
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.65s linear infinite;
}

/* =========================================
   3. SISTEMA DE NOTIFICACIONES TOAST (WCAG 4.1.3)
   ========================================= */
.toast-floating-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1090;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    max-width: 380px;
    width: calc(100% - 48px);
}

.modern-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 10px;
    background-color: var(--bg-surface, #ffffff);
    color: var(--text-primary, #0F172A);
    border: 1px solid var(--border-color, #E2E8F0);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    animation: slideInRight 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.modern-toast.toast-hiding {
    animation: slideOutRight 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.modern-toast-icon {
    font-size: 1.25rem;
    line-height: 1;
    margin-top: 2px;
    flex-shrink: 0;
}

.modern-toast-body {
    flex-grow: 1;
}

.modern-toast-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 2px;
    color: var(--text-primary, #0F172A);
}

.modern-toast-desc {
    font-size: 0.85rem;
    color: var(--text-secondary, #475569);
    margin: 0;
}

.modern-toast-close {
    background: transparent;
    border: none;
    color: var(--text-secondary, #475569);
    font-size: 1rem;
    line-height: 1;
    padding: 4px;
    cursor: pointer;
    border-radius: 4px;
    transition: color 0.2s, background-color 0.2s;
    min-width: 24px;
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modern-toast-close:hover {
    color: var(--text-primary, #0F172A);
    background-color: rgba(0, 0, 0, 0.05);
}

/* Variantes semánticas ISO 3864 */
.modern-toast-success {
    border-left: 4px solid var(--semantic-success, #10B981);
}
.modern-toast-success .modern-toast-icon {
    color: var(--semantic-success, #10B981);
}

.modern-toast-error {
    border-left: 4px solid var(--semantic-error, #EF4444);
}
.modern-toast-error .modern-toast-icon {
    color: var(--semantic-error, #EF4444);
}

.modern-toast-warning {
    border-left: 4px solid var(--semantic-warning, #F59E0B);
}
.modern-toast-warning .modern-toast-icon {
    color: var(--semantic-warning, #F59E0B);
}

.modern-toast-info {
    border-left: 4px solid var(--semantic-info, #0EA5E9);
}
.modern-toast-info .modern-toast-icon {
    color: var(--semantic-info, #0EA5E9);
}

/* =========================================
   4. EFECTOS MODERNOS GLASSMORPHISM
   ========================================= */
.glass-nav {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}
