/* Variables CSS - serán sobrescritas dinámicamente */
:root {
    --color-primary: #b8860b;
    --color-highlight: #c41e3a;
    --color-bg: #0d0d0d;
    --color-text: #ffffff;
    --bg-color: #0d0d0d;
    --bg-inicio: #1a1a2e;
    --bg-fin: #16213e;
    --bg-direccion: 135deg;
}

/* Reset y base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    min-height: 100dvh;
    color: var(--color-text);
    background: var(--bg-color);
    overflow-x: hidden;
}

/* Fondos dinámicos */
body.fondo-color {
    background: var(--bg-color);
}

body.fondo-gradiente {
    background: linear-gradient(var(--bg-direccion), var(--bg-inicio), var(--bg-fin));
    background-attachment: fixed;
}

body.fondo-imagen {
    background-image: var(--bg-imagen);
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

body.fondo-imagen-overlay::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: var(--bg-imagen);
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    z-index: -2;
}

body.fondo-imagen-overlay::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: -1;
}

/* Container */
.container {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

/* Loading */
.loading {
    text-align: center;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

/* Skeleton Loading */
.skeleton-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
    max-width: 400px;
}

.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.1) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 8px;
}

.skeleton-logo {
    width: 120px;
    height: 80px;
    border-radius: 12px;
}

.skeleton-title {
    width: 200px;
    height: 28px;
}

.skeleton-subtitle {
    width: 140px;
    height: 16px;
}

.skeleton-button {
    width: 100%;
    height: 56px;
    border-radius: 50px;
}

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

/* Content */
.content {
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.hidden {
    display: none !important;
}

/* Header */
.header {
    margin-bottom: 32px;
}

.logo {
    display: block;
    max-width: 180px;
    max-height: 120px;
    margin: 0 auto 16px auto;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.nombre {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 8px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.subtitulo {
    font-size: 0.9rem;
    opacity: 0.8;
    letter-spacing: 3px;
    text-transform: uppercase;
}

/* Menús */
.menus {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
}

.menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: linear-gradient(135deg, var(--color-primary) 0%, color-mix(in srgb, var(--color-primary), black 20%) 100%);
    color: white;
    text-decoration: none;
    padding: 18px 24px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.menu-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.menu-btn:focus {
    outline: 3px solid var(--color-primary);
    outline-offset: 3px;
}

.menu-btn:focus:not(:focus-visible) {
    outline: none;
}

.menu-btn:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 3px;
}

.menu-btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Ripple effect on click */
.menu-btn {
    position: relative;
    overflow: hidden;
}

.menu-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.menu-btn:active::before {
    width: 300%;
    height: 300%;
}

.menu-btn.destacado {
    background: linear-gradient(135deg, var(--color-highlight) 0%, color-mix(in srgb, var(--color-highlight), black 20%) 100%);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(196, 30, 58, 0.3); }
    50% { box-shadow: 0 4px 30px rgba(196, 30, 58, 0.5); }
}

.menu-btn .icon {
    font-size: 1.3rem;
}

/* Redes sociales */
.redes {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 24px;
}

.red-social {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 1.4rem;
}

.red-social:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.15) rotate(5deg);
}

.red-social:active {
    transform: scale(0.95);
}

.red-social:focus {
    outline: 3px solid var(--color-primary);
    outline-offset: 3px;
}

.red-social:focus:not(:focus-visible) {
    outline: none;
}

.red-social:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 3px;
}

/* Copyright */
.copyright {
    font-size: 0.75rem;
    opacity: 0.5;
}

/* Error */
.error {
    text-align: center;
    padding: 32px;
}

.error h2 {
    margin-bottom: 16px;
    color: var(--color-highlight);
}

.error button {
    margin-top: 16px;
    padding: 12px 24px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.error button:hover {
    transform: scale(1.05);
}

.error button:focus {
    outline: 3px solid var(--color-primary);
    outline-offset: 3px;
}

.error button:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 3px;
}

/* Responsive */
@media (min-width: 768px) {
    .container {
        padding: 48px 24px;
    }

    .content {
        max-width: 450px;
    }

    .nombre {
        font-size: 2rem;
    }

    .menu-btn {
        padding: 20px 32px;
        font-size: 0.95rem;
    }
}

/* PWA install prompt - ocultamos por defecto */
.install-prompt {
    display: none;
}

/* Animaciones de entrada mejoradas */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

.content.animate .header {
    animation: fadeInScale 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.content.animate .logo {
    animation: fadeInScale 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both;
}

.content.animate .nombre {
    animation: fadeInUp 0.5s ease-out 0.15s both;
}

.content.animate .subtitulo {
    animation: fadeInUp 0.5s ease-out 0.2s both;
}

.content.animate .menu-btn {
    animation: slideInFromLeft 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    animation-fill-mode: both;
}

.content.animate .menu-btn:nth-child(1) { animation-delay: 0.25s; }
.content.animate .menu-btn:nth-child(2) { animation-delay: 0.35s; }
.content.animate .menu-btn:nth-child(3) { animation-delay: 0.45s; }
.content.animate .menu-btn:nth-child(4) { animation-delay: 0.55s; }
.content.animate .menu-btn:nth-child(5) { animation-delay: 0.65s; }
.content.animate .menu-btn:nth-child(6) { animation-delay: 0.75s; }
.content.animate .menu-btn:nth-child(7) { animation-delay: 0.85s; }
.content.animate .menu-btn:nth-child(8) { animation-delay: 0.95s; }

.content.animate .redes {
    animation: fadeInUp 0.5s ease-out 0.8s both;
}

.content.animate .copyright {
    animation: fadeInUp 0.5s ease-out 0.9s both;
}

/* iPhone notch support (safe areas) */
@supports (padding: env(safe-area-inset-top)) {
    .container {
        padding-top: max(24px, env(safe-area-inset-top));
        padding-bottom: max(24px, env(safe-area-inset-bottom));
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }
}

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

    .menu-btn:hover,
    .red-social:hover,
    .error button:hover {
        transform: none;
    }

    .menu-btn.destacado {
        animation: none;
    }
}
