/* ============================================ */
/* ANIMATIONS.CSS - ANIMACIONES CINEMATOGRÁFICAS */
/* Keyframes premium para transiciones suaves   */
/* ============================================ */

/* ============================================ */
/* LOADING & INTRO                              */
/* ============================================ */
@keyframes app-reveal {
    from {
        opacity: 0;
        transform: scale(0.95);
        filter: blur(10px);
    }
    to {
        opacity: 1;
        transform: scale(1);
        filter: blur(0);
    }
}

#app.app-visible {
    animation: app-reveal 0.8s var(--ease-cinematic);
}

/* ============================================ */
/* MAPA - Aparece con efecto cinematográfico    */
/* ============================================ */
@keyframes map-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

#map.leaflet-container {
    animation: map-fade-in 1s var(--ease-cinematic) 0.2s backwards;
}

/* ============================================ */
/* ELEMENTOS DEL HEADER                         */
/* ============================================ */
@keyframes header-slide-down {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.brand-bar {
    animation: header-slide-down 0.6s var(--ease-cinematic) 0.4s backwards;
}

.brand-left,
.brand-center,
.brand-right {
    animation: fade-in-up 0.6s var(--ease-cinematic) backwards;
}

.brand-left { animation-delay: 0.5s; }
.brand-center { animation-delay: 0.6s; }
.brand-right { animation-delay: 0.7s; }

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================ */
/* SIDEBAR - Slide in from right                */
/* ============================================ */
@keyframes sidebar-slide-in {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.sidebar {
    animation: sidebar-slide-in 0.6s var(--ease-cinematic) 0.8s backwards;
}

.sidebar-header { animation: fade-in-up 0.4s ease-out 1s backwards; }
.search-box { animation: fade-in-up 0.4s ease-out 1.1s backwards; }
.category-filters { animation: fade-in-up 0.4s ease-out 1.2s backwards; }
.pois-list { animation: fade-in-up 0.4s ease-out 1.3s backwards; }

/* ============================================ */
/* POI CARDS - Stagger reveal                   */
/* ============================================ */
.poi-card {
    animation: card-slide-in 0.4s var(--ease-smooth) backwards;
}

@keyframes card-slide-in {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.poi-card:nth-child(1)  { animation-delay: 1.40s; }
.poi-card:nth-child(2)  { animation-delay: 1.45s; }
.poi-card:nth-child(3)  { animation-delay: 1.50s; }
.poi-card:nth-child(4)  { animation-delay: 1.55s; }
.poi-card:nth-child(5)  { animation-delay: 1.60s; }
.poi-card:nth-child(6)  { animation-delay: 1.65s; }
.poi-card:nth-child(7)  { animation-delay: 1.70s; }
.poi-card:nth-child(8)  { animation-delay: 1.75s; }
.poi-card:nth-child(9)  { animation-delay: 1.80s; }
.poi-card:nth-child(10) { animation-delay: 1.85s; }
.poi-card:nth-child(11) { animation-delay: 1.90s; }
.poi-card:nth-child(12) { animation-delay: 1.95s; }
.poi-card:nth-child(13) { animation-delay: 2.00s; }
.poi-card:nth-child(14) { animation-delay: 2.05s; }
.poi-card:nth-child(15) { animation-delay: 2.10s; }
.poi-card:nth-child(16) { animation-delay: 2.15s; }
.poi-card:nth-child(17) { animation-delay: 2.20s; }

/* ============================================ */
/* FLOATING CONTROLS - Stagger from bottom      */
/* ============================================ */
.floating-controls {
    animation: controls-rise 0.6s var(--ease-cinematic) 1.5s backwards;
}

@keyframes controls-rise {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.floating-controls > * {
    animation: control-pop 0.4s var(--ease-bounce) backwards;
}

.floating-controls > *:nth-child(1) { animation-delay: 1.6s; }
.floating-controls > *:nth-child(2) { animation-delay: 1.7s; }
.floating-controls > *:nth-child(3) { animation-delay: 1.8s; }
.floating-controls > *:nth-child(4) { animation-delay: 1.9s; }
.floating-controls > *:nth-child(5) { animation-delay: 2.0s; }

@keyframes control-pop {
    from {
        opacity: 0;
        transform: scale(0.3);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ============================================ */
/* MAP COMPASS                                  */
/* ============================================ */
.map-compass {
    animation: compass-fade-in 0.5s ease-out 2s backwards;
}

@keyframes compass-fade-in {
    from {
        opacity: 0;
        transform: scale(0) rotate(-180deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

/* ============================================ */
/* SHIMMER EFFECT (para elementos en hover)     */
/* ============================================ */
@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

.poi-card-icon,
.detail-hero-icon,
.dev-marker-pin {
    background-size: 200% 100%;
    background-image: linear-gradient(
        90deg,
        var(--poi-color, #d4af37) 0%,
        var(--poi-color, #d4af37) 30%,
        rgba(255, 255, 255, 0.5) 50%,
        var(--poi-color, #d4af37) 70%,
        var(--poi-color, #d4af37) 100%
    );
}

/* ============================================ */
/* PULSE RINGS (para elementos activos)         */
/* ============================================ */
@keyframes pulse-ring {
    0% {
        transform: scale(0.8);
        opacity: 0.8;
    }
    100% {
        transform: scale(2.2);
        opacity: 0;
    }
}

.pulse-ring {
    position: absolute;
    inset: 0;
    border: 2px solid currentColor;
    border-radius: 50%;
    animation: pulse-ring 2s ease-out infinite;
}

/* ============================================ */
/* TOUR ANIMATIONS                              */
/* ============================================ */
@keyframes tour-overlay-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.tour-progress {
    animation: tour-progress-in 0.5s var(--ease-cinematic);
    position: relative;
    pointer-events: none;
}

.tour-progress-skip {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s var(--ease-smooth);
    pointer-events: auto;
    z-index: 10;
}

.tour-progress-skip:hover {
    background: rgba(255, 255, 255, 0.32);
    transform: translateY(-50%) scale(1.1);
}

@keyframes tour-progress-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ============================================ */
/* GLOWING LINES (rutas entre desarrollo y POI) */
/* ============================================ */
@keyframes line-draw {
    from {
        stroke-dashoffset: 1000;
    }
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes line-flow {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -50; }
}

.route-line-animated {
    stroke-dasharray: 8 4;
    animation: line-flow 1.5s linear infinite;
}

/* ============================================ */
/* SHAKE (para errores)                         */
/* ============================================ */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

/* ============================================ */
/* SPIN (para loaders internos)                 */
/* ============================================ */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.spin {
    animation: spin 1s linear infinite;
}

/* ============================================ */
/* FADE IN/OUT genericos                        */
/* ============================================ */
.fade-in {
    animation: fade-in 0.4s var(--ease-cinematic);
}

.fade-out {
    animation: fade-out 0.3s var(--ease-cinematic) forwards;
}

@keyframes fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ============================================ */
/* SCALE IN                                     */
/* ============================================ */
@keyframes scale-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.scale-in {
    animation: scale-in 0.4s var(--ease-bounce);
}

/* ============================================ */
/* SLIDE IN desde la izquierda                  */
/* ============================================ */
@keyframes slide-in-left {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-left {
    animation: slide-in-left 0.5s var(--ease-cinematic);
}

/* ============================================ */
/* DISTANCE RINGS                               */
/* ============================================ */
@keyframes ring-pulse {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }
    100% {
        transform: scale(1.15);
        opacity: 0;
    }
}

.distance-ring {
    animation: ring-pulse 4s ease-out infinite;
    transform-origin: center;
}

.distance-ring:nth-child(2) { animation-delay: 1s; }
.distance-ring:nth-child(3) { animation-delay: 2s; }
.distance-ring:nth-child(4) { animation-delay: 3s; }

/* ============================================ */
/* HOVER LIFT (para botones)                    */
/* ============================================ */
.hover-lift {
    transition: transform 0.2s var(--ease-smooth), box-shadow 0.2s var(--ease-smooth);
}

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

.hover-lift:active {
    transform: translateY(0);
}

/* ============================================ */
/* SMOOTH SCROLL BEHAVIOR                       */
/* ============================================ */
html {
    scroll-behavior: smooth;
}

/* ============================================ */
/* GLOWING TEXT (para acentos)                  */
/* ============================================ */
@keyframes text-glow {
    0%, 100% { text-shadow: 0 0 20px rgba(212, 175, 55, 0.4); }
    50% { text-shadow: 0 0 40px rgba(212, 175, 55, 0.8); }
}

.text-glow {
    animation: text-glow 3s ease-in-out infinite;
}

/* ============================================ */
/* RESPECT MOTION PREFERENCES                   */
/* ============================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
