/* ==========================================================
   STATISTICI - DESIGN PROFESIONAL (Glassmorphism & Grid)
   ========================================================== */

:root {
    --accent-gold: #b45309;
    --accent-green: #15803d;
    --accent-red: #be123c;
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Container adaptat pentru vizibilitate optimă */
.app-container {
    padding: max(20px, env(safe-area-inset-top)) 15px 40px;
    max-width: 1100px;
    margin: 0 auto;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* ================= HEADER ANALIZĂ - REZOLVARE SUPRAPUNERE ================= */
.top-bar {
    display: flex !important;
    flex-direction: column !important; /* Forțează titlul sub butoane */
    align-items: center;
    width: 100%;
    gap: 15px;
    padding: 10px 0 20px 0;
    position: relative; /* Container de referință */
}

/* Containerul care ține butonul Back și cel de Meniu */
.header-actions {
    display: flex !important;
    justify-content: space-between !important; /* Împinge butoanele la margini */
    align-items: center;
    width: 100%;
    position: relative; /* Dezactivează influența absolută asupra h2 */
}

/* FORȚĂM butoanele să nu plutească */
.back-btn, .menu-button, .menu-spacer {
    position: relative !important; 
    top: auto !important;
    right: auto !important;
    left: auto !important;
    transform: none !important;
    flex-shrink: 0;
    z-index: 10;
}

.top-bar h2 {
    margin: 0 !important;
    width: 100% !important;
    text-align: center !important;
    position: relative !important;
    /* Coborâm z-index-ul titlului să nu intervină peste butoane la scroll */
    z-index: 1;
    
    /* Font adaptiv */
    font-size: clamp(1.4rem, 6vw, 2rem);
    font-weight: 900;
    color: var(--primary-blue);
    text-transform: uppercase;
    display: block !important;
}

/* Asigurăm simetria pe mobil */
.menu-spacer {
    width: 80px; /* Trebuie să fie egală cu lățimea butonului de Back */
    display: block;
}

/* TOGGLE TICKET (Filtru Tip Joc) */
.type-toggle {
    background: rgba(0, 0, 0, 0.08);
    padding: 6px;
    border-radius: 50px;
    width: fit-content;
    margin: 0 auto 35px;
    display: flex;
    gap: 8px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toggle-btn {
    border: none;
    padding: 10px 24px;
    border-radius: 40px;
    font-weight: 700;
    cursor: pointer;
    background: transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-main);
    font-size: 0.95rem;
}

.toggle-btn.active {
    background: var(--surface);
    color: var(--primary-blue);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: scale(1.05);
}

/* GRID-UL DE CARDURI - 2 Coloane pe Desktop, 1 pe Mobil */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* FORȚĂM 2 COLOANE PE DESKTOP */
    gap: 25px;
    width: 100%;
}

/* CARD STATISTIC - Stil Premium */
.stat-card {
    background: var(--surface);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(12px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    opacity: var(--card-opacity);
}

.stat-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

/* HEADER CARD (Nivelul) */
.level-header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-blue));
    color: #ffffff;
    text-align: center;
    padding: 16px;
    font-weight: 900;
    font-size: 1.1rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* SECȚIUNE EMOJI & TITLU NIVEL */
.pattern-box {
    padding: 25px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
}

.pattern-emoji {
    font-size: 3.5rem;
    filter: drop-shadow(0 5px 10px rgba(0,0,0,0.1));
}

.pattern-name {
    font-weight: 900;
    font-size: 1.25rem;
    color: var(--primary-blue);
    text-transform: uppercase;
}

/* RÂNDURI DE INFORMAȚII */
.info-group {
    padding: 20px 30px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.info-row:last-child { border-bottom: none; }

.info-row .label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.info-row .val {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-main);
}

/* FOOTER CARD (Eficiență) */
.efficiency-footer {
    background: rgba(0, 0, 0, 0.04);
    padding: 20px;
    text-align: center;
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.eff-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.eff-value {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--primary-blue);
    line-height: 1;
}

/* ==========================================================
   RESPONSIVE - ADAPTARE SMART
   ========================================================== */

/* TABLETĂ ȘI MOBIL MARE */
@media (max-width: 900px) {
    .stats-grid {
        gap: 20px;
    }
}

/* MOBIL (Ecrane mici) */
@media (max-width: 768px) {
    /* Aplicăm regula pe ambele posibile denumiri pentru siguranță */
    .stats-grid, #stats-content {
        grid-template-columns: 1fr !important; /* O SINGURĂ COLOANĂ */
        gap: 15px !important;
    }

    .top-bar h2 {
        font-size: 1.5rem !important; /* Font lizibil pe mobil */
    }

    .stat-card {
        min-height: auto !important; /* Cardurile se lungesc după conținut */
    }
}

/* Butoanele de Toggle */
.type-toggle {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    background: rgba(0,0,0,0.05);
    padding: 5px;
    border-radius: 50px;
    backdrop-filter: blur(10px);
}

.toggle-btn {
    padding: 10px 25px;
    border-radius: 40px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    background: transparent;
    color: var(--text-main);
}

.toggle-btn.active {
    background: var(--surface);
    color: var(--primary-blue);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Culori utilitare pentru date specifice */
.text-red { color: var(--accent-red) !important; }
.text-gold { color: var(--accent-gold) !important; }
.text-green { color: var(--accent-green) !important; }