/* =============================================================================
   ESTILOS BASE E LAYOUT PRINCIPAL
   ============================================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Rajdhani', sans-serif;
    background: 
        linear-gradient(45deg, transparent 49%, rgba(0, 255, 255, 0.03) 50%, transparent 51%),
        linear-gradient(-45deg, transparent 49%, rgba(120, 255, 120, 0.03) 50%, transparent 51%),
        radial-gradient(circle at 25% 25%, rgba(255, 0, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(0, 255, 255, 0.08) 0%, transparent 50%),
        linear-gradient(135deg, #0a0e1a 0%, #0d1117 30%, #161b22 60%, #0d1117 100%);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    position: relative;
    overflow: hidden;
    display: flex;
    /* FORÇAR fundo escuro em TODOS os dispositivos */
    background-color: #0d1117 !important;
    background-attachment: fixed !important;
}

/* Garantir que elementos principais tenham pointer-events habilitados */
.sidebar,
.main-content,
.content,
.nav-btn,
.mobile-nav-controls,
.hamburger-menu,
.mobile-menu,
.footer {
    pointer-events: auto !important;
}

/* Garantir que o conteúdo seja interativo e tenha scroll FORÇADO */
.content {
    pointer-events: auto !important;
    user-select: text !important;
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    overflow-y: scroll !important; /* FORÇAR scroll sempre */
    overflow-x: hidden !important;
    height: 100% !important;
    -webkit-overflow-scrolling: touch !important; /* Smooth scrolling no iOS */
    scroll-behavior: smooth !important;
    /* CRÍTICO para mobile */
    touch-action: manipulation !important; /* Permitir scroll e zoom básico */
    overscroll-behavior: contain !important; /* Manter scroll dentro do elemento */
}

/* Ocultar conteúdo principal até o game começar */
body:not(.game-started) .sidebar,
body:not(.game-started) .main-content,
body:not(.game-started) .footer,
body:not(.game-started) .hamburger-menu,
body:not(.game-started) .slide-indicator {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* IMPORTANTE: Sempre mostrar HUD mobile e botões mobile mesmo antes do game começar */
body:not(.game-started) .mobile-hud,
body:not(.game-started) .mobile-nav-controls {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* DESKTOP: HUD apenas na sidebar, botões apenas no bottom */
@media (min-width: 769px) {
    .mobile-hud {
        display: none !important; /* Ocultar HUD mobile no desktop */
    }
    
    /* Remover botões da direita no desktop */
    .desktop-nav-controls {
        display: none !important;
    }
    
    /* Botões ficam no bottom mesmo no desktop */
    .mobile-nav-controls {
        display: flex !important;
        position: fixed !important;
        bottom: 20px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        z-index: 9999 !important;
        gap: 12px !important;
        pointer-events: auto !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

/* MOBILE: HUD no topo, botões no bottom */
@media (max-width: 768px) {
    .mobile-hud {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 9998 !important;
    }
    
    .mobile-nav-controls {
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }
}

/* =============================================================================
   SIDEBAR DESKTOP
   ============================================================================= */

.sidebar {
    width: 300px;
    min-width: 300px;
    height: 100vh;
    background: linear-gradient(180deg, 
        rgba(13, 17, 23, 0.98) 0%, 
        rgba(22, 27, 34, 0.95) 50%, 
        rgba(13, 17, 23, 0.98) 100%);
    border-right: 2px solid rgba(120, 255, 120, 0.4);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(120, 255, 120, 0.3);
    position: relative;
}

.sidebar-header h1 {
    font-family: 'Orbitron', monospace;
    font-size: 1.6rem;
    font-weight: 900;
    margin: 0 0 8px 0;
    color: #ffffff;
    text-shadow: 0 0 15px rgba(120, 255, 120, 0.8);
    text-transform: uppercase;
    letter-spacing: 1px;
    line-height: 1.2;
}

.sidebar-header p {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.1rem;
    color: #00ffff;
    font-weight: 600;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.6);
}

/* =============================================================================
   SISTEMA DE STATS (HP/MP/XP) - APENAS NA SIDEBAR NO DESKTOP
   ============================================================================= */

.sidebar-stats {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(48, 54, 61, 0.5);
    font-family: 'Orbitron', monospace;
    font-size: 0.8rem;
    color: rgba(120, 255, 120, 0.9);
    line-height: 1.8;
    background: rgba(0, 0, 0, 0.3);
}

.stat-bar {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    gap: 8px;
}

.stat-label {
    min-width: 24px;
    font-weight: bold;
}

.stat-fill {
    flex: 1;
    height: 8px;
    background: rgba(22, 27, 34, 0.8);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
}

.stat-fill-inner {
    height: 100%;
    transition: width 0.5s ease;
    position: relative;
    border-radius: 3px;
}

.hp-bar .stat-fill-inner {
    background: linear-gradient(90deg, #ff4444, #ff6666);
    box-shadow: 0 0 8px rgba(255, 68, 68, 0.5);
}

.mp-bar .stat-fill-inner {
    background: linear-gradient(90deg, #4444ff, #6666ff);
    box-shadow: 0 0 8px rgba(68, 68, 255, 0.5);
}

/* Estado crítico */
.hp-bar.critical .stat-fill-inner {
    background: linear-gradient(90deg, #ff0000, #ff4444);
    animation: criticalPulse 1.5s ease-in-out infinite;
}

.mp-bar.critical .stat-fill-inner {
    background: linear-gradient(90deg, #ff6600, #ff8844);
    animation: criticalPulse 1.5s ease-in-out infinite;
}

@keyframes criticalPulse {
    0%, 100% { 
        opacity: 0.6; 
        box-shadow: 0 0 8px rgba(255, 0, 0, 0.3);
    }
    50% { 
        opacity: 1; 
        box-shadow: 0 0 20px rgba(255, 0, 0, 0.8);
    }
}

.stat-fill-inner::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 15px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4));
    animation: statShine 2s ease-in-out infinite;
}

.stat-percentage {
    min-width: 35px;
    text-align: right;
    font-size: 0.75rem;
}

@keyframes statShine {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

/* Barra de XP */
.xp-bar-container {
    margin-top: 16px;
    padding: 0 4px;
}

.xp-bar-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-family: 'Orbitron', monospace;
    font-size: 0.7rem;
    color: rgba(120, 255, 120, 0.9);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.xp-bar {
    width: 100%;
    height: 8px;
    background: rgba(22, 27, 34, 0.8);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(120, 255, 120, 0.3);
    position: relative;
}

.xp-fill {
    height: 100%;
    background: linear-gradient(90deg, #78ff78, #00ffff);
    width: 12%;
    transition: width 1s ease-out;
    box-shadow: 0 0 10px rgba(120, 255, 120, 0.5);
    position: relative;
}

.xp-fill::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 20px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3));
    animation: xpShine 2s ease-in-out infinite;
}

@keyframes xpShine {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

/* =============================================================================
   NAVEGAÇÃO LATERAL
   ============================================================================= */

.navigation {
    flex: 1;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
}

.navigation::before {
    content: 'MISSION SELECT';
    font-family: 'Orbitron', monospace;
    font-size: 0.8rem;
    color: rgba(0, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 255, 255, 0.3);
}

.nav-btn {
    background: linear-gradient(135deg, rgba(22, 27, 34, 0.9), rgba(13, 17, 23, 0.7));
    color: #ffffff;
    border: 1px solid rgba(120, 255, 120, 0.3);
    padding: 14px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    backdrop-filter: blur(12px);
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-btn::before {
    content: '▸';
    color: rgba(120, 255, 120, 0.7);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: linear-gradient(135deg, rgba(120, 255, 120, 0.15), rgba(0, 255, 255, 0.08));
    border-color: rgba(120, 255, 120, 0.6);
    color: #78ff78;
    transform: translateX(6px);
    text-shadow: 0 0 10px rgba(120, 255, 120, 0.5);
    box-shadow: 0 4px 15px rgba(120, 255, 120, 0.2);
}

.nav-btn:hover::before {
    color: #78ff78;
    transform: translateX(4px);
}

.nav-btn.active {
    background: linear-gradient(135deg, rgba(120, 255, 120, 0.25), rgba(0, 255, 255, 0.15));
    border-color: #78ff78;
    color: #78ff78;
    box-shadow: 
        0 0 0 1px rgba(120, 255, 120, 0.4),
        inset 0 1px 0 rgba(120, 255, 120, 0.3);
    text-shadow: 0 0 10px rgba(120, 255, 120, 0.8);
    transform: translateX(10px);
}

.nav-btn.active::before {
    color: #78ff78;
    transform: translateX(4px);
}

/* =============================================================================
   CONTEÚDO PRINCIPAL
   ============================================================================= */

.main-content {
    flex: 1;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    transition: opacity 0.3s ease-in-out;
}

.main-content.level-up-fade {
    opacity: 0.1;
    pointer-events: none;
}

.content-header {
    padding: 24px 40px;
    background: linear-gradient(135deg, rgba(22, 27, 34, 0.95), rgba(13, 17, 23, 0.9));
    border-bottom: 1px solid rgba(48, 54, 61, 0.5);
    position: relative;
}

.slide-title {
    font-family: 'Orbitron', monospace;
    font-size: 2.5rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 0 20px rgba(120, 255, 120, 0.6);
    display: flex;
    align-items: center;
    gap: 20px;
}

.slide-title::before {
    content: '>';
    color: #78ff78;
    text-shadow: 0 0 15px rgba(120, 255, 120, 0.8);
    animation: cursorBlink 1.5s infinite;
}

@keyframes cursorBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

.content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    position: relative;
}

.content::-webkit-scrollbar {
    width: 12px;
}

.content::-webkit-scrollbar-track {
    background: rgba(22, 27, 34, 0.8);
    border-radius: 6px;
}

.content::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #78ff78, #00ffff);
    border-radius: 6px;
    border: 1px solid rgba(120, 255, 120, 0.4);
    box-shadow: 0 0 10px rgba(120, 255, 120, 0.3);
}

.content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #00ffff, #ff00ff);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
}

/* =============================================================================
   FOOTER
   ============================================================================= */

.footer {
    background: linear-gradient(135deg, rgba(13, 17, 23, 0.95), rgba(22, 27, 34, 0.9));
    color: #7d8590;
    text-align: center;
    padding: 12px 20px;
    border-top: 1px solid rgba(48, 54, 61, 0.5);
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
}

.footer::before {
    content: 'Apresentação por: ';
    color: #7d8590;
}

.footer-name {
    color: #78ff78;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(120, 255, 120, 0.4);
}

/* =============================================================================
   RESPONSIVIDADE BÁSICA
   ============================================================================= */

@media (max-width: 1200px) {
    .sidebar {
        width: 280px;
        min-width: 280px;
    }
    
    .slide-title {
        font-size: 2.2rem;
    }
    
    .content {
        padding: 32px;
    }
}

@media (max-width: 768px) {
    /* Ocultar sidebar desktop */
    .sidebar {
        display: none !important;
    }

    /* MOSTRAR elementos mobile */
    .hamburger-menu {
        display: block !important;
    }
    
    .mobile-menu-overlay {
        display: block !important;
    }
    
    .slide-indicator {
        display: block !important;
    }
    
    .mobile-hud {
        display: block !important;
    }
    
    /* FORÇAR exibição dos botões de navegação mobile */
    .mobile-nav-controls {
        display: flex !important;
        position: fixed !important;
        bottom: 20px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        z-index: 9999 !important;
        gap: 12px !important;
        pointer-events: auto !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Layout principal mobile */
    body {
        flex-direction: column;
        padding-top: 60px; /* Espaço para o HUD mobile */
        /* FORÇAR fundo escuro no mobile */
        background: linear-gradient(135deg, #0a0e1a 0%, #0d1117 30%, #161b22 60%, #0d1117 100%) !important;
    }
    
    .main-content {
        width: 100%;
        height: calc(100vh - 60px);
        /* GARANTIR fundo escuro */
        background: transparent !important;
    }

    .content-header {
        padding: 70px 20px 20px 20px; /* Espaço para hambúrguer */
        /* FORÇAR fundo escuro */
        background: linear-gradient(135deg, rgba(22, 27, 34, 0.95), rgba(13, 17, 23, 0.9)) !important;
    }

    .slide-title {
        font-size: 1.6rem;
        gap: 12px;
        line-height: 1.2;
    }

    .content {
        padding: 20px 20px 80px 20px; /* Espaço para botões de navegação */
        height: calc(100vh - 180px);
        -webkit-overflow-scrolling: touch !important;
        scroll-behavior: smooth !important;
        /* IMPORTANTE: Garantir scroll vertical no mobile */
        overflow-y: scroll !important; /* SCROLL FORÇADO */
        overflow-x: hidden !important;
        touch-action: manipulation !important; /* Permitir scroll vertical por touch */
        /* Forçar o elemento a ser scrollável */
        min-height: calc(100vh - 180px) !important;
        max-height: calc(100vh - 180px) !important;
        /* Garantir que há conteúdo para scroll */
        position: relative !important;
        /* FORÇAR fundo transparente para mostrar o fundo do body */
        background: transparent !important;
    }

    .footer {
        display: none; /* Ocultar footer no mobile para dar mais espaço */
    }
}

@media (max-width: 480px) {
    body {
        padding-top: 55px; /* Menos espaço para telas menores */
    }
    
    .main-content {
        height: calc(100vh - 55px);
    }
    
    .content-header {
        padding: 65px 16px 16px 16px;
    }

    .slide-title {
        font-size: 1.3rem;
        gap: 8px;
    }

    .content {
        padding: 16px 16px 80px 16px;
        height: calc(100vh - 165px);
        /* Garantir scroll em telas pequenas */
        overflow-y: scroll !important;
        -webkit-overflow-scrolling: touch !important;
        touch-action: manipulation !important;
        /* Forçar altura mínima para garantir scroll */
        min-height: calc(100vh - 165px) !important;
        max-height: calc(100vh - 165px) !important;
    }
}

/* =============================================================================
   MELHORIAS PARA DISPOSITIVOS MÓVEIS
   ============================================================================= */

@media (max-width: 768px) {
    /* Evitar zoom no input focus em iOS */
    input, select, textarea {
        font-size: 16px;
    }

    /* Melhor experiência de touch */
    .hamburger-menu, .nav-control-btn, .mobile-nav-btn {
        -webkit-tap-highlight-color: rgba(120, 255, 120, 0.1);
    }
    
    /* Garantir que o conteúdo seja scrollável no mobile */
    .slide {
        touch-action: manipulation !important;
        -webkit-overflow-scrolling: touch !important;
        /* Forçar altura mínima nos slides para garantir scroll */
        min-height: calc(100vh - 200px) !important;
    }
    
    /* Força específica para o container de conteúdo */
    .main-content .content {
        overflow-y: scroll !important;
        overscroll-behavior: contain !important;
        scroll-behavior: smooth !important;
        position: relative !important;
    }
}