/**
 * Hospital Incluir IA - UX Premium Enhancements
 * Mejoras avanzadas de experiencia de usuario
 *
 * @package Hospital_Incluir_IA
 * @since 1.0.0
 */

/* ============================================
   VARIABLES MEJORADAS
   ============================================ */
:root {
    /* Sombras mejoradas */
    --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 12px 40px rgba(0, 0, 0, 0.18);
    --shadow-2xl: 0 20px 60px rgba(0, 0, 0, 0.2);
    
    /* Sombras de color */
    --shadow-primary: 0 4px 15px rgba(255, 107, 107, 0.35);
    --shadow-accent-1: 0 4px 15px rgba(255, 230, 109, 0.35);
    --shadow-accent-2: 0 4px 15px rgba(168, 237, 234, 0.35);
    --shadow-success: 0 4px 15px rgba(52, 199, 89, 0.35);
    
    /* Transiciones */
    --transition-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    
    /* Espaciado */
    --spacing-2xs: 4px;
    --spacing-xs: 8px;
    --spacing-sm: 12px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    --spacing-3xl: 64px;
}

/* ============================================
   HEADER MEJORADO
   ============================================ */
.site-header {
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.98);
    transition: all 0.3s var(--transition-smooth);
}

.site-header.scrolled {
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.12);
    background: rgba(255, 255, 255, 0.99);
}

/* ============================================
   HERO SECTION PREMIUM
   ============================================ */
.hero-section {
    position: relative;
    overflow: hidden;
}

/* Partículas animadas de fondo */
.hero-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(255, 107, 107, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 230, 109, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(168, 237, 234, 0.1) 0%, transparent 50%);
    animation: heroPulse 8s ease-in-out infinite;
    pointer-events: none;
}

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

.hero-title {
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    animation: titleFloat 3s ease-in-out infinite;
}

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

/* ============================================
   CARDS DE ACTIVIDADES PREMIUM
   ============================================ */
.activity-selection-card {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

/* Efecto de onda al hacer click */
.activity-selection-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.4) 0%, transparent 70%);
    transform: scale(0);
    opacity: 0;
    transition: transform 0.5s var(--transition-bounce), opacity 0.3s ease;
    pointer-events: none;
}

.activity-selection-card:active::after {
    transform: scale(2);
    opacity: 1;
    transition: transform 0s, opacity 0s;
}

/* Borde animado */
.activity-selection-card::before {
    content: '';
    position: absolute;
    inset: -3px;
    background: linear-gradient(45deg, 
        var(--color-primary), 
        var(--color-accent-1), 
        var(--color-accent-2), 
        var(--color-primary)
    );
    background-size: 300% 300%;
    border-radius: calc(var(--radius-xl) + 3px);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
    animation: gradientRotate 3s ease infinite;
}

.activity-selection-card:hover::before {
    opacity: 1;
}

@keyframes gradientRotate {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Icono con efecto de flotación */
.activity-selection-card .activity-icon {
    animation: iconFloat 2s ease-in-out infinite;
}

@keyframes iconFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-3px) rotate(-2deg);
    }
    75% {
        transform: translateY(-3px) rotate(2deg);
    }
}

.activity-selection-card:hover .activity-icon {
    animation: iconSpin 0.6s var(--transition-bounce);
}

@keyframes iconSpin {
    from {
        transform: scale(1.2) rotate(0deg);
    }
    to {
        transform: scale(1.2) rotate(10deg);
    }
}

/* ============================================
   BOTONES PREMIUM
   ============================================ */
.btn-primary,
.btn-secondary,
.btn-mic,
.tool-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s var(--transition-smooth);
}

/* Efecto de brillo al hover */
.btn-primary::before,
.btn-secondary::before,
.btn-mic::before,
.tool-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transition: left 0.5s ease;
}

.btn-primary:hover::before,
.btn-secondary:hover::before,
.btn-mic:hover::before,
.tool-btn:hover::before {
    left: 100%;
}

/* Efecto de pulsación en botones importantes */
.btn-mic {
    animation: micPulse 2s ease-in-out infinite;
}

@keyframes micPulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    }
    50% {
        box-shadow: 0 4px 25px rgba(255, 107, 107, 0.5);
    }
}

/* ============================================
   MODALES PREMIUM
   ============================================ */
.modal {
    backdrop-filter: blur(20px) brightness(0.7);
}

.modal-content {
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25);
    transform: translateY(-20px);
    opacity: 0;
    animation: modalSlideUp 0.4s var(--transition-spring) forwards;
}

@keyframes modalSlideUp {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    transition: all 0.3s var(--transition-bounce);
}

.modal-close:hover {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff4757 100%);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

/* ============================================
   FORMULARIOS MEJORADOS
   ============================================ */
.form-group input,
.form-group textarea,
.form-group select {
    transition: all 0.3s var(--transition-smooth);
    border: 2px solid transparent;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.2);
}

/* Label flotante */
.form-group {
    position: relative;
}

.form-group input:focus + label,
.form-group input:not(:placeholder-shown) + label,
.form-group textarea:focus + label,
.form-group textarea:not(:placeholder-shown) + label {
    transform: translateY(-28px) scale(0.85);
    opacity: 0.8;
}

/* ============================================
   INDICADORES DE CARGA
   ============================================ */
.spinner {
    animation: spin 1s linear infinite;
}

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

/* Loading skeleton */
.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

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

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 16px 24px;
    background: #ffffff;
    border-radius: var(--radius-xl);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 9999;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.4s var(--transition-spring);
    max-width: 400px;
}

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

.toast.success {
    border-left: 4px solid var(--color-success);
}

.toast.error {
    border-left: 4px solid var(--color-error);
}

.toast.info {
    border-left: 4px solid var(--color-primary);
}

.toast-icon {
    font-size: 1.5rem;
}

.toast-message {
    flex-grow: 1;
    font-weight: 500;
}

/* ============================================
   PROGRESS BARS
   ============================================ */
.progress-bar {
    position: relative;
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent-1));
    border-radius: 4px;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.5s var(--transition-smooth);
}

.progress-bar-fill.active {
    transform: scaleX(1);
}

/* ============================================
   BADGES Y ETIQUETAS
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: #ffffff;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.badge-dot {
    width: 6px;
    height: 6px;
    background: #ffffff;
    border-radius: 50%;
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

/* ============================================
   SCROLL INDICATORS
   ============================================ */
.scroll-indicator {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 50px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 15px;
    opacity: 0.7;
}

.scroll-indicator::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    width: 6px;
    height: 6px;
    background: #ffffff;
    border-radius: 50%;
    transform: translateX(-50%);
    animation: scrollDown 2s ease-in-out infinite;
}

@keyframes scrollDown {
    0% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
}

/* ============================================
   HOVER EFFECTS AVANZADOS
   ============================================ */
.hover-lift {
    transition: transform 0.3s var(--transition-spring), 
                box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 30px rgba(255, 107, 107, 0.4);
}

.hover-scale {
    transition: transform 0.3s var(--transition-bounce);
}

.hover-scale:hover {
    transform: scale(1.05);
}

/* ============================================
   ANIMACIONES DE ENTRADA
   ============================================ */
.fade-in {
    opacity: 0;
    animation: fadeIn 0.6s ease forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.slide-up {
    opacity: 0;
    transform: translateY(30px);
    animation: slideUp 0.6s var(--transition-spring) forwards;
}

@keyframes slideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.scale-in {
    opacity: 0;
    transform: scale(0.9);
    animation: scaleIn 0.5s var(--transition-bounce) forwards;
}

@keyframes scaleIn {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ============================================
   UTILIDADES DE RENDIMIENTO
   ============================================ */
.will-animate {
    will-change: transform, opacity;
}

.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* ============================================
   RESPONSIVE MEJORADO
   ============================================ */
@media (max-width: 768px) {
    .toast {
        left: 16px;
        right: 16px;
        bottom: 16px;
        max-width: none;
    }
    
    .modal-content {
        margin: 16px;
        max-height: calc(100vh - 32px);
    }
    
    .activity-selection-card {
        min-height: 250px;
    }
}

/* ============================================
   ACCESIBILIDAD
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .will-animate {
        will-change: auto;
    }
}

/* Focus visible mejorado */
*:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 3px;
    border-radius: var(--radius-md);
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.3);
        --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.4);
        --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    }
    
    .activity-selection-card,
    .btn-primary,
    .modal-content {
        border: 2px solid currentColor;
    }
}
