/**
 * Styles principaux - SPA
 * La Chasse au Trésor Péï
 */

/* ===================================
   RESET & BASE
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--night-blue);
    color: var(--text-light);
}

[x-cloak] {
    display: none !important;
}

/* ===================================
   VARIABLES
   =================================== */
:root {
    --pup-orange: #FF6B00;
    --orange-dark: #E55A00;
    --orange-glow: rgba(255, 107, 0, 0.5);
    --night-blue: #0A0E27;
    --night-blue-light: #1A2332;
    --gold: #FFD700;
    --text-light: #FFFFFF;
    --text-dim: rgba(255, 255, 255, 0.7);
}

/* ===================================
   SPLASH SCREEN
   =================================== */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, 
        rgba(10, 14, 39, 0.95) 0%, 
        rgba(26, 35, 50, 0.95) 50%, 
        rgba(45, 67, 86, 0.95) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.splash-logo {
    width: 180px;
    margin-bottom: 30px;
    animation: logoEntrance 1s ease forwards;
}

@keyframes logoEntrance {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    60% {
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.splash-text {
    font-size: 18px;
    color: var(--text-dim);
    margin-bottom: 20px;
}

.splash-progress {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.splash-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--pup-orange), var(--gold));
    transition: width 0.3s ease;
}

/* ===================================
   APP SHELL
   =================================== */
.app-shell {
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

.app-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    z-index: 1; /* Au-dessus du background */
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ===================================
   BACKGROUND FIXE PAGE D'ACCUEIL
   =================================== */
.home-background-fixed {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('/assets/images/map.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0; /* Entre le fond et le contenu */
    pointer-events: none; /* Ne bloque pas les clics */
}

.home-background-fixed::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35); /* 🌚 Plus la valeur est élevée → plus c’est foncé */
    backdrop-filter: blur(2px); /* Optionnel : léger flou pour + de lisibilité */
}

.enigma-1-background-fixed {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-image: url('/assets/images/ville.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0;
    pointer-events: none;
}

.enigma-1-background-fixed::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35); /* 🌚 Plus la valeur est élevée → plus c’est foncé */
    backdrop-filter: blur(2px); /* Optionnel : léger flou pour + de lisibilité */
}

.enigma-2-background-fixed {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-image: url('/assets/images/plage.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0;
    pointer-events: none;
}

.enigma-2-background-fixed::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35); /* 🌚 Plus la valeur est élevée → plus c’est foncé */
    backdrop-filter: blur(2px); /* Optionnel : léger flou pour + de lisibilité */
}

.enigma-3-background-fixed {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-image: url('/assets/images/mer.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0;
    pointer-events: none;
}

.enigma-3-background-fixed::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35); /* 🌚 Plus la valeur est élevée → plus c’est foncé */
    backdrop-filter: blur(2px); /* Optionnel : léger flou pour + de lisibilité */
}

.enigma-4-background-fixed {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-image: url('/assets/images/volcan.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0;
    pointer-events: none;
}

.enigma-4-background-fixed::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35); /* 🌚 Plus la valeur est élevée → plus c’est foncé */
    backdrop-filter: blur(2px); /* Optionnel : léger flou pour + de lisibilité */
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--pup-orange);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ===================================
   AUDIO PLAYER
   =================================== */
.audio-player {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.audio-toggle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(30px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.audio-toggle:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.15);
}

.audio-toggle:active {
    transform: scale(0.95);
}

.audio-toggle.playing {
    box-shadow: 0 8px 32px rgba(255, 107, 0, 0.4);
}

.audio-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(255, 107, 0, 0.5));
}

/* ===================================
   FOOTER NAVIGATION
   =================================== */
.footer-nav {
    position: relative;
    width: 100%;
    z-index: 999;
    flex-shrink: 0;
}

.footer-nav-container {
    background: white;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    padding: 8px 0 10px;
}

.footer-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 1;
    max-width: 120px;
    padding: 8px 4px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.6);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    cursor: pointer;
    border-radius: 12px;
}

.footer-nav-item:active {
    transform: scale(0.92);
    background: rgba(255, 255, 255, 0.05);
}

.footer-nav-item.active {
    color: #FF6B00;
}

.footer-nav-item.active .footer-nav-icon {
    transform: scale(1.1);
}

.footer-nav-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.footer-nav-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: all 0.3s ease;
}

.footer-nav-item.active .footer-nav-img {
    filter: brightness(1) contrast(1) drop-shadow(0 0 8px rgba(255, 107, 0, 0.5));
}

.footer-nav-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-align: center;
    color: black;
}

.footer-nav-item.active .footer-nav-label {
    font-weight: 700;
    text-shadow: 0 0 8px rgba(255, 107, 0, 0.4);
}

.footer-nav-indicator {
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: #FF6B00;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(255, 107, 0, 0.6);
    animation: pulse-indicator 2s ease-in-out infinite;
}

@keyframes pulse-indicator {
    0%, 100% {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }
    50% {
        opacity: 0.6;
        transform: translateX(-50%) scale(0.8);
    }
}

/* ===================================
   ENIGMA MENU
   =================================== */
.enigma-menu {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 998;
    width: 90%;
    max-width: 400px;
}

.enigma-menu-content {
    padding: 20px;
}

.enigma-menu-content h3 {
    color: white;
    font-size: 18px;
    margin-bottom: 15px;
    text-align: center;
}

.enigma-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.enigma-item {
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: white;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s ease;
}

.enigma-item:hover {
    background: rgba(255, 107, 0, 0.1);
    border-color: var(--pup-orange);
}

/* ===================================
   GLASSMORPHISM CARDS
   =================================== */
.glass-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(50px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ===================================
   ANIMATIONS
   =================================== */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

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

.animate-slideDown {
    animation: slideDown 0.6s ease forwards;
}

.animate-fadeIn {
    animation: fadeIn 0.8s ease forwards;
}

.animate-bounce {
    animation: bounce 2s ease-in-out infinite;
}

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

/* ===================================
   RESPONSIVE
   =================================== */
@media (max-width: 375px) {
    .footer-nav-container {
        padding: 6px 0 8px;
    }
    
    .footer-nav-item {
        gap: 3px;
        padding: 6px 2px;
    }
    
    .footer-nav-icon {
        width: 24px;
        height: 24px;
    }
    
    .footer-nav-label {
        font-size: 10px;
    }
}

@media (min-width: 768px) {
    .footer-nav-container {
        max-width: 600px;
        margin: 0 auto;
        border-radius: 20px 20px 0 0;
    }
}

/* ========== BOUTONS ========== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn:active:not(:disabled) {
    transform: scale(0.96);
}

.btn-primary {
    background: linear-gradient(135deg, var(--pup-orange), var(--orange-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.3);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 6px 16px rgba(255, 107, 0, 0.4);
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-accent {
    background: linear-gradient(135deg, var(--gold), #DAA520);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.btn-accent:hover:not(:disabled) {
    box-shadow: 0 6px 16px rgba(255, 215, 0, 0.4);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, #ff4444, #cc0000);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 68, 68, 0.3);
}

.btn-danger:hover:not(:disabled) {
    box-shadow: 0 6px 16px rgba(255, 68, 68, 0.4);
    transform: translateY(-2px);
}

.btn-link {
    background: transparent;
    color: var(--gold);
    padding: 8px 16px;
    text-decoration: underline;
}

.btn-link:hover {
    color: var(--pup-orange);
}

.btn-block {
    width: 100%;
}

/* ========== LOGO HOME CENTRÉ ========== */
.home-logo {
    display: block;
    margin: 0 auto 20px;
    max-width: 120px;
}

/* ========== FORMULAIRE AUTH (LOGIN/REGISTER) ========== */
.auth-container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 80px 20px 120px;
}

.auth-card {
    padding: 40px 30px;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo {
    width: 120px;
    margin: 0 auto 20px;
    display: block;
}

.auth-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 8px;
}

.auth-subtitle {
    font-size: 16px;
    color: var(--text-dim);
}

.auth-form {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-size: 16px;
    transition: all 0.3s;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: var(--pup-orange);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.1);
}

.form-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.form-message {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 14px;
    text-align: center;
}

.form-message.error {
    background: rgba(255, 68, 68, 0.2);
    color: #ff6b6b;
    border: 1px solid rgba(255, 68, 68, 0.3);
}

.form-message.success {
    background: rgba(76, 217, 100, 0.2);
    color: #4cd964;
    border: 1px solid rgba(76, 217, 100, 0.3);
}

.auth-footer {
    text-align: center;
    color: var(--text-dim);
    font-size: 14px;
}

.auth-footer p {
    margin-bottom: 10px;
}

/* ========== MENU POPUP ÉNIGMES AVEC INDICATEURS ========== */
.enigma-menu-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.enigma-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    color: white;
}

.enigma-menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateX(4px);
}

.enigma-menu-icon {
    font-size: 24px;
    min-width: 32px;
    text-align: center;
}

.enigma-menu-icon.solved {
    filter: drop-shadow(0 0 8px rgba(76, 217, 100, 0.6));
}

.enigma-menu-icon.unlocked {
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.6));
}

.enigma-menu-icon.locked {
    opacity: 0.5;
}

.enigma-menu-info {
    flex: 1;
}

.enigma-menu-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.enigma-menu-status {
    font-size: 12px;
    color: var(--text-dim);
}

.enigma-menu-status.solved {
    color: #4cd964;
}

.enigma-menu-status.unlocked {
    color: var(--gold);
}

.enigma-menu-status.locked {
    color: rgba(255, 255, 255, 0.4);
}

/* ========== HOME CARD IMPROVEMENTS ========== */
.home-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 0 20px 120px;
}

.home-card {
    padding: 30px 25px;
    text-align: center;
}

.home-card-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.home-card h2 {
    font-size: 22px;
    color: white;
    margin-bottom: 12px;
    font-weight: 700;
}

.home-card p {
    font-size: 15px;
    color: var(--text-dim);
    margin-bottom: 20px;
    line-height: 1.6;
}

/* ========== PROFIL ACTIONS ========== */
.profil-actions {
    padding: 20px;
    text-align: center;
}

.profil-actions .btn {
    width: 100%;
    max-width: 300px;
}

/* ========== BACKGROUNDS ÉNIGMES ========== */
.enigma-container {
    position: relative;
    min-height: 100vh;
}

.enigma-container::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.15;
    z-index: 0;
    pointer-events: none;
}

/* S'assurer que le contenu des énigmes est au-dessus du background */
.enigma-container > * {
    position: relative;
    z-index: 2;
}