/* ===============================================
   LA BARRIAL - ESTILOS PERSONALIZADOS
   Complemento a Tailwind CSS
   =============================================== */

/* Variables CSS personalizadas - Coinciden con Tailwind config */
:root {
    --barrial-primary: #354E56;
    --barrial-secondary: #E3E0D7;
    --barrial-accent1: #DF0C0B;
    --barrial-accent2: #EEC10D;
    --barrial-accent3: #85CBE3;
    --text-dark: #222222;
    --text-light: #FFFFFF;
}

/* Reset y utilidades base */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Tagesschrift', 'Montserrat', sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ===============================================
   ANIMACIONES PERSONALIZADAS
   =============================================== */

/* Animación floating */
@keyframes floating {
    0%, 100% { 
        transform: translateY(0px); 
    }
    50% { 
        transform: translateY(-15px); 
    }
}

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

@keyframes rotating {
    from { 
        transform: rotate(0deg); 
    }
    to { 
        transform: rotate(360deg); 
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { 
        transform: translateY(0) rotate(45deg); 
    }
    40% { 
        transform: translateY(-10px) rotate(45deg); 
    }
    60% { 
        transform: translateY(-5px) rotate(45deg); 
    }
}

@keyframes pulse-glow {
    0% { 
        box-shadow: 0 0 0px rgba(238, 193, 13, 0.7); 
    }
    100% { 
        box-shadow: 0 0 20px rgba(238, 193, 13, 0.9); 
    }
}

@keyframes confetti-fall {
    0% { 
        transform: translateY(0) rotate(0); 
    }
    100% { 
        transform: translateY(100vh) rotate(720deg); 
    }
}

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

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

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

/* Clases de utilidad para animaciones */
.animate-floating {
    animation: floating 3s ease-in-out infinite;
}

.animate-floating-delayed {
    animation: floating-delayed 3s ease-in-out 1.5s infinite;
}

.animate-rotating {
    animation: rotating 15s linear infinite;
}

.animate-bounce-slow {
    animation: bounce 2s infinite;
}

.animate-pulse-glow {
    animation: pulse-glow 2s ease-in-out infinite alternate;
}

.animate-fade-in {
    animation: fadeInUp 0.7s ease-out forwards;
}

.animate-slide-in-left {
    animation: slideInLeft 0.7s ease-out forwards;
}

.animate-slide-in-right {
    animation: slideInRight 0.7s ease-out forwards;
}

/* ===============================================
   CURSOR PERSONALIZADO
   =============================================== */
.cursor-custom {
    position: fixed;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: var(--barrial-accent2);
    pointer-events: none;
    mix-blend-mode: difference;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
    z-index: 9999;
    display: none;
}

/* Solo mostrar en dispositivos que no son táctiles */
@media (hover: hover) {
    .cursor-custom {
        display: block;
    }
}

/* ===============================================
   EFECTOS DE GLASSMORPHISM
   =============================================== */
.glass {
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.glass-dark {
    backdrop-filter: blur(10px);
    background: rgba(53, 78, 86, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===============================================
   GRADIENTES PERSONALIZADOS
   =============================================== */
.gradient-hero {
    background: linear-gradient(135deg, rgba(53, 78, 86, 0.9) 0%, rgba(133, 203, 227, 0.8) 100%);
}

.gradient-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.9) 0%, rgba(227, 224, 215, 0.9) 100%);
}

.gradient-text {
    background: linear-gradient(45deg, var(--barrial-primary), var(--barrial-accent1));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-border {
    position: relative;
}

.gradient-border::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    padding: 2px;
    background: linear-gradient(45deg, var(--barrial-accent2), var(--barrial-accent1));
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    -webkit-mask-composite: xor;
}

/* ===============================================
   SOMBRAS PERSONALIZADAS
   =============================================== */
.shadow-barrial {
    box-shadow: 0 10px 30px rgba(53, 78, 86, 0.2);
}

.shadow-barrial-hover:hover {
    box-shadow: 0 20px 40px rgba(53, 78, 86, 0.3);
}

.shadow-float {
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.shadow-glow {
    box-shadow: 0 0 20px rgba(238, 193, 13, 0.3);
}

.shadow-glow-strong {
    box-shadow: 0 0 30px rgba(238, 193, 13, 0.5);
}

/* ===============================================
   EFECTOS DE HOVER MEJORADOS
   =============================================== */
.hover-lift {
    transition: all 0.3s ease;
}

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

.hover-scale {
    transition: transform 0.3s ease;
}

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

.hover-rotate {
    transition: transform 0.3s ease;
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

/* Efectos para tarjetas de personajes */
.character-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.character-card:hover {
    transform: translateY(-10px) scale(1.02);
}

.character-card:hover .character-image {
    transform: scale(1.1);
}

.character-image {
    transition: transform 0.5s ease;
}

/* ===============================================
   ESTILOS DE TEXTO ESPECIALES
   =============================================== */
.text-shadow {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.text-shadow-strong {
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8);
}

.text-glow {
    text-shadow: 0 0 10px rgba(238, 193, 13, 0.5);
}

/* ===============================================
   EFECTOS DE PARALLAX
   =============================================== */
.parallax {
    transform: translate3d(0, 0, 0);
    will-change: transform;
}

/* ===============================================
   ESTILOS PARA SWIPER JS
   =============================================== */
.swiper-pagination-bullet {
    background-color: var(--barrial-accent2) !important;
    opacity: 0.7;
}

.swiper-pagination-bullet-active {
    background-color: var(--barrial-accent1) !important;
    opacity: 1;
}

.swiper-button-next,
.swiper-button-prev {
    color: var(--barrial-accent2) !important;
}

.swiper-button-next:after,
.swiper-button-prev:after {
    font-size: 2rem;
}

/* ===============================================
   EASTER EGGS Y JUEGOS
   =============================================== */
.easter-egg-campo {
    transition: transform 0.5s ease;
}

.easter-egg-campo.translate-y-full {
    transform: translateY(100%);
}

/* Fix para visibilidad del Campo de Fútbol */
.easter-egg-campo.visible {
    transform: translateY(0) !important;
    display: flex !important;
}

/* Asegurar visibilidad forzada */
#easter-egg-campo:not(.translate-y-full) {
    transform: translateY(0) !important;
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Asegurar que los elementos internos sean visibles */
#easter-egg-campo .campo-futbol,
#easter-egg-campo .controles,
#easter-egg-campo .power-ups {
    display: block !important;
    visibility: visible !important;
}

/* Debug visual temporal */
.campo-futbol-debug {
    border: 2px solid red !important;
    background-color: rgba(255, 0, 0, 0.1) !important;
}

.confetti {
    position: fixed;
    top: -10px;
    width: 10px;
    height: 10px;
    z-index: 999;
    animation: confetti-fall linear forwards;
}

/* ===============================================
   CAMPO DE FÚTBOL MEJORADO
   =============================================== */
.campo-futbol {
    background: linear-gradient(90deg, #2D5A27 0%, #4C7F25 50%, #2D5A27 100%);
    background-size: 50px 50px;
}

.balon {
    background: radial-gradient(circle at 30% 30%, #EEC10D, #DF0C0B);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.balon-trail {
    width: 100px;
    height: 6px;
    background: linear-gradient(90deg, transparent, var(--barrial-accent2), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 5;
}

.balon-trail.active {
    opacity: 1;
}

.goalkeeper {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    animation: goalkeeper-move 2s ease-in-out infinite;
}

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

/* Animación especial para el poder de velocidad */
@keyframes ball-move-fast {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.2) rotate(180deg); }
}

.power-up-indicator {
    z-index: 20;
}

.goal-particles {
    pointer-events: none;
    z-index: 15;
}

.power-up-card {
    cursor: pointer;
    transition: all 0.3s ease;
    animation: power-up-float 3s ease-in-out infinite;
}

.power-up-card:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

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

.score-display,
.timer-display,
.half-display {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Efectos especiales para goles */
@keyframes goal-celebration {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.goal-celebration {
    animation: goal-celebration 1s ease-in-out;
}

/* Trail del balón para efectos especiales */
.balon-trail-super {
    background: linear-gradient(90deg, transparent, #FF6B35, transparent);
    box-shadow: 0 0 20px #FF6B35;
}

/* ===============================================
   FÚTBOL PONG ATLÉTICO FUNEBRERO
   =============================================== */
#secret-pong-game-container.hidden {
    display: none;
}

#pong-canvas {
    border: 4px solid var(--barrial-accent2);
    background: linear-gradient(180deg, #4C7F25 0%, #2D5A27 100%);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    cursor: none;
}

/* Efectos de partículas para Pong */
@keyframes pong-ball-glow {
    0% { box-shadow: 0 0 20px rgba(238, 193, 13, 0.5); }
    50% { box-shadow: 0 0 40px rgba(238, 193, 13, 0.8); }
    100% { box-shadow: 0 0 20px rgba(238, 193, 13, 0.5); }
}

.pong-ball-glow {
    animation: pong-ball-glow 1s ease-in-out infinite;
}

/* Efectos especiales de defensa */
@keyframes pong-block-effect {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.pong-block-effect {
    animation: pong-block-effect 0.5s ease-out;
}

/* Power-up effects */
.pong-power-nine {
    background: linear-gradient(45deg, #1E40AF, #3B82F6);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.pong-power-viche {
    background: linear-gradient(45deg, #059669, #10B981);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.pong-power-chulquera {
    background: linear-gradient(45deg, #7C3AED, #A855F7);
    box-shadow: 0 4px 8px rgba(168, 85, 247, 0.3);
}

/* Score effects */
@keyframes score-increase {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); color: #10B981; }
    100% { transform: scale(1); }
}

.score-increase {
    animation: score-increase 0.6s ease-out;
}

/* Timer flash effect */
@keyframes timer-flash {
    0% { background-color: var(--barrial-accent1); }
    50% { background-color: var(--barrial-accent1); box-shadow: 0 0 20px var(--barrial-accent1); }
    100% { background-color: var(--barrial-accent1); }
}

.timer-flash {
    animation: timer-flash 1s ease-in-out;
}

/* Game status effects */
.game-status {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.pong-status {
    text-shadow: 0 0 10px var(--barrial-accent2);
    font-size: 1.1em;
}

/* Period transition effects */
.period-transition {
    animation: period-transition 3s ease-in-out;
}

@keyframes period-transition {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1); }
}

/* ===============================================
   RESPONSIVE DESIGN MEJORADO
   =============================================== */

/* Breakpoints personalizados */
@media (max-width: 640px) {
    .character-card:hover {
        transform: translateY(-5px) scale(1.01);
    }

    .text-shadow {
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    }
}

/* Ajustes para tarjetas de personajes en móvil y tablet */
@media (max-width: 1023px) {
    .character-card {
        /* Deshabilitar hover lift en móvil */
        transform: none !important;
    }

    .character-card:hover {
        transform: none !important;
    }

    .character-card .mobile-backstory {
        display: block;
        animation: fadeInMobile 0.5s ease-in-out forwards;
    }

    /* Asegurar que el overlay no aparezca en móvil */
    .character-card .absolute.inset-0.bg-barrial-primary {
        display: none !important;
    }
}

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

@media (max-width: 768px) {
    .glass {
        backdrop-filter: blur(5px);
        background: rgba(255, 255, 255, 0.15);
    }
    
    .swiper-button-next:after,
    .swiper-button-prev:after {
        font-size: 1.5rem;
    }
}

@media (max-width: 1024px) {
    .parallax {
        transform: translateY(0) !important;
    }
}

/* ===============================================
   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;
    }
}

/* Focus visible para navegación por teclado */
button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--barrial-accent2);
    outline-offset: 2px;
}

/* ===============================================
   UTILIDADES ADICIONALES
   =============================================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.not-sr-only {
    position: static;
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* ===============================================
   LOADING STATES
   =============================================== */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--barrial-accent2);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

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

/* ===============================================
   ESTADOS DE INTERACCIÓN
   =============================================== */
.interactive {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.interactive:active {
    transform: scale(0.98);
}

/* Disable text selection for interactive elements */
.no-select {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* ===============================================
   EFECTOS PARA JUEGOS (JUICE)
   =============================================== */

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

.screen-shake {
    animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes flash-white {
    0% { background-color: rgba(255, 255, 255, 1); }
    100% { background-color: transparent; }
}

.hit-flash {
    animation: flash-white 0.1s ease-out;
}

@keyframes particle-fade {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0); }
}

.game-particle {
    position: absolute;
    pointer-events: none;
    animation: particle-fade 0.6s ease-out forwards;
}

/* ===============================================
   DEBUGGING STYLES (solo para desarrollo)
   =============================================== */
.debug * {
    outline: 1px solid red !important;
}

.debug-grid::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(255, 0, 0, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 0, 0, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: 1000;
}