/* ========================================= */
/* 1. RESET & BAZĂ (Native Dark Translucent) */
/* ========================================= */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #080c17;
    color: #ffffff;
    display: flex;
    justify-content: center;
    padding: 20px 10px;
    margin: 0;
    min-height: 100vh;
    height: auto;
}

.container {
    background-color: #111827;
    border: 1px solid rgba(71, 85, 105, 0.3);
    width: 100%;
    max-width: 800px;
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    position: relative;
    height: auto;
    min-height: min-content;
    margin-bottom: 40px;
}

/* FORȚĂM ALBUL CURAT PESTE TOT */
h1,
h2,
h3,
h4,
label,
p {
    color: #ffffff !important;
}

#nume-user,
#categorie-text,
#progres-text,
#timer-text,
.stat-label,
.stat-value,
.time-option {
    color: #ffffff !important;
}

.leaderboard-item,
.leaderboard-item-dark,
.leaderboard-box h3 {
    color: #ffffff !important;
}

#asteptare-nume,
#mesaj-final,
#titlu-intro {
    color: #ffffff !important;
}

/* ========================================= */
/* 2. ZONA DE TEST (Grile)                   */
/* ========================================= */
#zona-quiz {
    padding-bottom: 120px;
}

.header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    margin-bottom: 10px;
}

.progress-bg {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    margin-bottom: 15px;
    overflow: hidden;
    border: 1px solid rgba(71, 85, 105, 0.3);
}

.progress-fill {
    height: 100%;
    background: rgba(148, 163, 184, 0.6);
    width: 0%;
    transition: width 0.4s ease;
}

#intrebare-text {
    font-size: 18px;
    font-weight: normal;
    margin-bottom: 20px;
    white-space: pre-wrap;
    font-family: inherit;
    line-height: 1.5;
    text-align: left;
}

#imagine-grila {
    max-width: 100% !important;
    width: auto;
    height: auto !important;
    border-radius: 12px;
    margin: 0 auto 20px auto;
    display: block;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    object-fit: contain;
}

.raspunsuri-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.btn-raspuns {
    padding: 16px;
    font-size: 16px;
    text-align: left;
    background-color: rgba(17, 24, 39, 0.6);
    border: 1px solid rgba(71, 85, 105, 0.3);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    color: #ffffff;
    width: 100%;
}

.btn-raspuns.selectat {
    background-color: rgba(148, 163, 184, 0.2);
    border-color: rgba(148, 163, 184, 0.5);
}

.btn-raspuns.corect {
    background-color: rgba(16, 185, 129, 0.15) !important;
    border-color: rgba(16, 185, 129, 0.4) !important;
    color: #6ee7b7 !important;
}

.btn-raspuns.gresit {
    background-color: rgba(239, 68, 68, 0.15) !important;
    border-color: rgba(239, 68, 68, 0.4) !important;
    color: #fca5a5 !important;
}

/* ========================================= */
/* 4. BUTOANE UNIFICATE & IOS BAR            */
/* ========================================= */
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-warning,
.btn-info {
    padding: 18px 15px;
    font-size: 15px;
    border-radius: 12px;
    cursor: pointer;
    width: 100%;
    font-weight: 600;
    transition: all 0.15s ease;
    background: rgba(71, 85, 105, 0.35) !important;
    border: 1px solid rgba(148, 163, 184, 0.25) !important;
    color: #ffffff !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ios-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* REPARAT: Text Alb pentru butoanele iOS */
.btn-text-only {
    background: transparent !important;
    border: none !important;
    color: #ffffff !important;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 5px 0;
    transition: opacity 0.2s;
}

.btn-text-only:hover {
    opacity: 0.7;
}

.flex-row-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
}

.flex-row-buttons button {
    flex: 1;
    min-height: 60px;
}

/* ========================================= */
/* GRID CATEGORII - RESPONSIVE (3/5 COLOANE) */
/* ========================================= */

.category-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    /* 5 coloane pe PC */
    gap: 8px;
    margin-bottom: 15px;
}

.btn-category {
    padding: 5px 2px;
    /* <-- Am redus padding-ul sus/jos ca să facem loc textului */
    min-height: 60px;
    /* Înălțimea butonului rămâne exact la fel */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 13.5px;
    /* <-- TEXT MĂRIT (era 11.5px) */
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(71, 85, 105, 0.3);
    border-radius: 10px;
    color: #cbd5e1;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    line-height: 1.15;
    /* <-- Am strâns rândurile ca să nu se lungească butonul */
}

.btn-category.active {
    background: rgba(59, 130, 246, 0.25) !important;
    border-color: rgba(56, 189, 248, 0.6) !important;
    color: #ffffff !important;
    transform: translateY(-1px);
}

.count-badge {
    font-size: 9px;
    opacity: 0.7;
    margin-top: 3px;
}

/* ========================================= */
/* REPARAT: SLIDER TIMP PER GRILĂ            */
/* ========================================= */
.time-selector-group {
    display: flex;
    position: relative;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(71, 85, 105, 0.3);
    border-radius: 12px;
    padding: 4px;
    cursor: pointer;
    margin-bottom: 15px;
}

.time-option {
    flex: 1;
    text-align: center;
    padding: 10px 0;
    font-weight: 600;
    z-index: 2;
    font-size: 14px;
    transition: color 0.3s;
}

.time-slider {
    position: absolute;
    top: 4px;
    left: 4px;
    height: calc(100% - 8px);
    width: calc(33.33% - 5.33px);
    background: rgba(71, 85, 105, 0.4);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 8px;
    z-index: 1;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pos-0 {
    transform: translateX(0);
}

.pos-1 {
    transform: translateX(100%);
}

.pos-2 {
    transform: translateX(200%);
}

/* ========================================= */
/* 5. MODALE (ÎNĂLȚIME REPARATĂ)             */
/* ========================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(8, 12, 23, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(8px);
}

.modal-content {
    background: #111827;
    padding: 25px;
    border-radius: 16px;
    width: 95%;
    max-width: 700px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(71, 85, 105, 0.4);
}

.scrollable-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
    margin: 15px 0;
}

/* ========================================= */
/* DOCK BUTOANE ACȚIUNE                      */
/* ========================================= */
.quiz-action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 30px);
    max-width: 750px;
    padding: 15px;
    background: rgba(17, 24, 39, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(71, 85, 105, 0.4);
    border-radius: 16px;
    z-index: 1000;
}

.input-form {
    width: 100%;
    padding: 14px;
    margin-bottom: 15px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(71, 85, 105, 0.4);
    border-radius: 12px;
    color: #ffffff;
}

pre {
    margin: 15px 0 20px 0;
    padding: 18px;
    background: #05080f;
    border-radius: 12px;
    overflow-x: auto;
    border: 1px solid rgba(71, 85, 105, 0.15);
}

code {
    font-family: "SF Mono", Consolas, monospace;
    font-size: 14px;
    color: #ffffff;
}

/* ========================================= */
/* 7. MOBILE RESPONSIVE TWEAKS               */
/* ========================================= */


/* ========================================= */
/* 8. REPARAȚII UI (Parolă, Statistici, Clasament) */
/* ========================================= */

/* --- 8.1. Butonul Arată/Ascunde Parola --- */
.password-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 15px;
}

.password-wrapper .input-form {
    margin-bottom: 0;
    /* Anulăm marginea default pentru a o lăsa wrapper-ului */
    padding-right: 45px;
    /* Facem loc pentru ochi ca să nu se suprapună cu textul */
}

.password-toggle {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 18px;
    user-select: none;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.password-toggle:hover {
    opacity: 1;
}

/* --- 8.2. Cardurile de Scor și Procentaj (Ecran Final) --- */
.stats-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 25px 0 35px 0;
}

.stat-card {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(71, 85, 105, 0.4);
    border-radius: 12px;
    padding: 15px 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 130px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.stat-label {
    font-size: 12px;
    color: #94a3b8 !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #38bdf8 !important;
}

/* Prevenim definitiv apariția barei de scroll orizontale în orice listă */
.scrollable-list {
    overflow-x: hidden;
}



/* ========================================= */
/* 9. ELIMINARE SĂGEȚI INPUT NUMBER (SPINNERS) */
/* ========================================= */
.no-spinners::-webkit-outer-spin-button,
.no-spinners::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Pentru browserul Firefox */
.no-spinners {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* ========================================= */
/* 7. MOBILE RESPONSIVE TWEAKS               */
/* ========================================= */
@media (max-width: 600px) {
    .container {
        padding: 15px;
    }

    .category-grid {
        grid-template-columns: repeat(3, 1fr);
        /* 3 coloane pe mobil */
        gap: 6px;
    }

    .btn-category {
        font-size: 12px;
        /* <-- TEXT MĂRIT PENTRU MOBIL (era 10.5px) */
        padding: 4px 1px;
        /* <-- Padding și mai mic pentru a face loc pe ecran îngust */
        min-height: 55px;
        /* Înălțimea butonului rămâne exact la fel */
        border-radius: 8px;
        line-height: 1.1;
        /* <-- Rânduri mai strânse */
    }

    .count-badge {
        font-size: 8.5px;
    }

    #intrebare-text {
        font-size: 16px;
    }

    .flex-row-buttons button {
        font-size: 13px;
        min-height: 55px;
    }
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 0.8s ease-in-out infinite;
    margin-left: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}