/* ===== SISTEMA DE ANIMAÇÕES ERDERON ===== */
/* Arquivo: /mapa-erderon/assets/css/animations.css */
/* Micro-interações e animações suaves */

/* ===== 1. VARIÁVEIS DE ANIMAÇÃO ===== */
:root {
    --duration-fast: 0.15s;
    --duration-normal: 0.3s;
    --duration-slow: 0.5s;
    --duration-very-slow: 1s;
    
    --easing-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --easing-bounce: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --easing-elastic: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --easing-sharp: cubic-bezier(0.4, 0, 0.6, 1);
}

/* ===== 2. ANIMAÇÕES DE ENTRADA ===== */
@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

@keyframes fadeInRight {
    0% {
        opacity: 0;
        transform: translateX(20px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInRight {
    0% {
        transform: translateX(100%);
    }
    100% {
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(0);
    }
}

/* ===== 3. ANIMAÇÕES DE LOADING ===== */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    14% {
        transform: scale(1.1);
    }
    28% {
        transform: scale(1);
    }
    42% {
        transform: scale(1.1);
    }
    70% {
        transform: scale(1);
    }
}

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

/* ===== 4. ANIMAÇÕES DE HOVER ===== */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(74, 144, 226, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(74, 144, 226, 0.6);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
    20%, 40%, 60%, 80% { transform: translateX(2px); }
}

/* ===== 5. APLICAÇÃO NOS COMPONENTES ===== */

/* === CONTROLES === */
.control-btn {
    transition: all var(--duration-normal) var(--easing-smooth);
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.control-btn:active {
    transform: scale(0.95);
    transition: transform var(--duration-fast) var(--easing-sharp);
}

/* === FILTROS === */
.filter-btn {
    transition: all var(--duration-normal) var(--easing-smooth);
}

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

.filter-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

/* === BUSCA === */
.search-input {
    transition: all var(--duration-normal) var(--easing-smooth);
}

.search-input:focus {
    transform: none;
    border: none !important;
    box-shadow: none !important;
}

.search-btn {
    transition: all var(--duration-normal) var(--easing-smooth);
}

.search-btn:hover {
    transform: scale(1.05);
    color: var(--accent-primary);
}

/* === SIDEBAR === */
.side-panel {
    transition: right var(--duration-slow) var(--easing-smooth);
}

.character-image {
    transition: all var(--duration-normal) var(--easing-smooth);
}

.character-image:hover {
    transform: scale(1.05);
    border-color: var(--accent-primary);
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
}

.gallery-item {
    transition: all var(--duration-normal) var(--easing-smooth);
}

.gallery-item:hover {
    transform: scale(1.02);
    border-color: var(--accent-primary);
}

/* === MINIMAP === */
.minimap {
    transition: all var(--duration-normal) var(--easing-smooth);
}

.minimap:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.minimap-view {
    transition: all var(--duration-fast) var(--easing-smooth);
}

/* === TEMA === */
.theme-toggle {
    transition: all var(--duration-normal) var(--easing-smooth);
}

.theme-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ===== 6. ANIMAÇÕES DE CARREGAMENTO ===== */
.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

.loading-spinner {
    animation: spin 1s linear infinite;
}

.loading-shimmer {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.2) 50%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* ===== 7. ANIMAÇÕES DE NOTIFICAÇÃO ===== */
@keyframes notificationSlideIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -100%);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes notificationSlideOut {
    0% {
        opacity: 1;
        transform: translate(-50%, 0);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -100%);
    }
}

.notification {
    animation: notificationSlideIn var(--duration-normal) var(--easing-smooth);
}

.notification.removing {
    animation: notificationSlideOut var(--duration-normal) var(--easing-smooth);
}

/* ===== 8. ANIMAÇÕES DE MODAL ===== */
@keyframes modalFadeIn {
    0% {
        opacity: 0;
        backdrop-filter: blur(0);
    }
    100% {
        opacity: 1;
        backdrop-filter: blur(8px);
    }
}

@keyframes modalContentIn {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.gallery-modal {
    animation: modalFadeIn var(--duration-normal) var(--easing-smooth);
}

.gallery-modal .modal-content {
    animation: modalContentIn var(--duration-normal) var(--easing-bounce);
}

/* ===== 9. ANIMAÇÕES DE PROGRESSÃO ===== */
@keyframes progressBar {
    0% { width: 0%; }
    100% { width: 100%; }
}

.progress-bar {
    animation: progressBar 2s var(--easing-smooth);
}

/* ===== 10. ANIMAÇÕES ESPECIAIS ===== */
@keyframes sparkle {
    0%, 100% {
        opacity: 0;
        transform: scale(0) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: scale(1) rotate(180deg);
    }
}

.sparkle {
    animation: sparkle 1s ease-in-out infinite;
}

@keyframes typewriter {
    0% { width: 0; }
    100% { width: 100%; }
}

.typewriter {
    overflow: hidden;
    white-space: nowrap;
    animation: typewriter 2s steps(40) 1s forwards;
}

/* ===== 11. ANIMAÇÕES DE SUCESSO/ERRO ===== */
@keyframes success {
    0% {
        background-color: var(--accent-success);
        transform: scale(1);
    }
    50% {
        background-color: var(--accent-success);
        transform: scale(1.1);
    }
    100% {
        background-color: var(--accent-success);
        transform: scale(1);
    }
}

@keyframes error {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-3px); }
    20%, 40%, 60%, 80% { transform: translateX(3px); }
}

.success {
    animation: success 0.6s var(--easing-smooth);
}

.error {
    animation: error 0.5s var(--easing-smooth), 
               glow 1s ease-in-out 3;
}

/* ===== 12. ANIMAÇÕES DE ENTRADA SEQUENCIAL ===== */
.stagger-animation {
    opacity: 0;
    animation: fadeInUp var(--duration-slow) var(--easing-smooth) forwards;
}

.stagger-animation:nth-child(1) { animation-delay: 0.1s; }
.stagger-animation:nth-child(2) { animation-delay: 0.2s; }
.stagger-animation:nth-child(3) { animation-delay: 0.3s; }
.stagger-animation:nth-child(4) { animation-delay: 0.4s; }
.stagger-animation:nth-child(5) { animation-delay: 0.5s; }
.stagger-animation:nth-child(6) { animation-delay: 0.6s; }

/* ===== 13. RESPONSIVIDADE DAS ANIMAÇÕES ===== */
@media (max-width: 768px) {
    :root {
        --duration-fast: 0.1s;
        --duration-normal: 0.2s;
        --duration-slow: 0.3s;
        --duration-very-slow: 0.5s;
    }
    
    /* Animações mais sutis no mobile */
    .control-btn:hover,
    .filter-btn:hover,
    .character-image:hover {
        animation: none;
        transform: scale(1.05);
    }
    
    /* Remove float animations no mobile */
    .theme-toggle:hover {
        animation: none;
    }
}

/* ===== 14. REDUÇÃO DE MOVIMENTO ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .marker.animate-in,
    .marker.highlighted,
    .loading,
    .stagger-animation {
        animation: none !important;
    }
}

/* ===== 15. PERFORMANCE OPTIMIZATIONS ===== */
.control-btn,
.filter-btn,
.search-input,
.theme-toggle,
.character-image,
.gallery-item {
    will-change: transform, opacity;
}

/* Remove will-change após animações */
.animation-complete {
    will-change: auto;
}

/* ===== 16. EFEITOS ESPECIAIS DE FEEDBACK ===== */
@keyframes confetti {
    0% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate(
            calc(-50% + ${Math.random() * 200 - 100}px), 
            calc(-50% + ${Math.random() * 200 - 100}px)
        ) scale(0) rotate(360deg);
        opacity: 0;
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
    20%, 40%, 60%, 80% { transform: translateX(2px); }
}