/* ====================================
   1. RESET I GLOBALNE STYLI (CENTROWANIE)
   ==================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%; /* Zapewnia, że body ma pełną wysokość */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color:#000000;
    color: #333;
}

body {
    display: flex; /* Flexbox dla głównego układu */
    flex-direction: column; /* Układanie elementów w kolumnie */
    min-height: 100vh; 
}

main {
    flex-grow: 1; /* Sekcja main zajmuje całą dostępną przestrzeń pionową */
    display: flex;
    justify-content: center; /* Centrowanie w poziomie */
    align-items: center; /* Centrowanie w pionie */
    padding: 20px;
}

/* ====================================
   2. NAGŁÓWEK I STOPKA
   ==================================== */
header {
    background-color: #059669;
    color: white;
    padding: 25px 20px;
    text-align: center;
    width: 100%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 1.8em;
}

footer {
    padding: 10px;
    text-align: center;
    background-color: #000000;
    color: white;
    width: 100%;
    margin-top: auto; /* Wypycha stopkę na sam dół */
    font-size: 0.8em;
}

/* ====================================
   3. KONTENERY WIDOKÓW (MENU/QUIZ/WYNIKI)
   ==================================== */
#menu, #quiz-container, #results-screen, #trening-menu, #ustawa-content {
    background-color: #000000;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    max-width: 500px;
    width: 100%;
    text-align: center; /* Domyślne centrowanie tekstu */
}

#menu h2, #trening-menu h2 {
    margin-bottom: 25px;
    color: white;
}

/* Informacja o wyniku i czasie w quizie */
.quiz-info-bar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-weight: bold;
    font-size: 1.1em;
}

#score-display {
    color: #28a745;
}

#timer-display {
    color: #ffc107;
}

#question-text {
    margin-bottom: 30px;
    font-size: 1.25em;
    line-height: 1.5;
    text-align: left;
    color: white;
}

/* ====================================
   4. STYLIZACJA PRZYCISKÓW I LINKÓW
   ==================================== */
button, a button, a.button-link {
    display: block; 
    width: 100%;
    padding: 14px 20px;
    margin-bottom: 12px;
    border: none;
    border-radius: 8px;
    background-color: #059669;
    color: white;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    text-decoration: none;
    text-align: center;
}

button:hover:not(:disabled), a button:hover, a.button-link:hover {
    background-color: #06d191;
    transform: translateY(-1px);
}

/* Przyciski odpowiedzi */
.answer-button {
    background-color: #f8f9fa; 
    color: #333;
    border: 1px solid #dee2e6;
    text-align: left;
    transition: all 0.3s;
}

.answer-button:hover:not(:disabled) {
    background-color: #e9ecef;
    color: #059669;
}

/* Styl dla przycisków po wyłączeniu (po kliknięciu) */
.answer-button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* ====================================
   5. STYLIZACJA WYNIKÓW I KOMUNIKATÓW ZWROTNYCH
   ==================================== */

/* Poprawna odpowiedź */
.answer-correct {
    background-color: #28a745 !important; /* Zielony */
    color: white !important; /* Wymuś biały tekst na zielonym tle */
    border-color: #28a745 !important;
}

/* Błędna odpowiedź */
.answer-incorrect {
    background-color: #dc3545 !important; /* Czerwony */
    color: white !important; /* Wymuś biały tekst na czerwonym tle */
    border-color: #dc3545 !important;
}

/* Komunikaty ZDANY/NIEZDANY */
.result-passed {
    color: #28a745; /* Zielony */
    font-size: 1.8em;
    margin: 20px 0;
}

.result-failed {
    color: #dc3545; /* Czerwony */
    font-size: 1.8em;
    margin: 20px 0;
}

/* ====================================
   6. STYLIZACJA STRONY USTAWA.HTML
   ==================================== */
#ustawa-content p {
    margin-bottom: 20px;
    line-height: 1.5;
    text-align: left;
}

.document-link {
    margin: 30px 0;
    text-align: center;
}

.document-link p {
    margin-top: 10px;
    font-style: italic;
    color: #6c757d;
    text-align: center;
}

.back-button {
    margin-top: 30px; 
}

/* ====================================
   7. STYLIZACJA EKRANÓW WYNIKÓW
   ==================================== */
#results-screen {
    display: flex;
    flex-direction: column;
    align-items: center; 
    justify-content: center;
}

#results-screen h2, #results-screen p {
    color: white; 
    margin-bottom: 10px;
}

/* Styl dla kontenerów przechowujących nowe przyciski (Egzamin i Trening) */
#results-buttons-placeholder, 
#trening-results-buttons {
    margin-top: 30px; 
    width: 100%; 
    display: flex;
    flex-direction: column; 
    gap: 15px; 
}

#results-buttons-placeholder button,
#trening-results-buttons button {
    margin-bottom: 0; 
}

/* Dla większych ekranów, aby przyciski nie były za szerokie */
@media (min-width: 600px) {
    #results-buttons-placeholder,
    #trening-results-buttons {
        max-width: 350px;
    }
}

/* ====================================
   8. KOREKTA DLA URZĄDZEŃ MOBILNYCH (NAPRAWIONA LOGIKA HOVER)
   ==================================== */

@media (hover: none) {
    
    /* KLUCZOWA POPRAWKA: Wyłączamy styl hover TYLKO dla czystych przycisków, 
       aby nie nadpisywać klas poprawności/błędów, gdy są już aktywne. */
    .answer-button:hover:not(.answer-correct):not(.answer-incorrect) {
        background-color: #f8f9fa !important; /* Normalny stan */
        color: #333 !important; /* Normalny tekst */
        transform: none; 
    }
    
    /* Wyłączamy transformację dla ogólnych przycisków, aby zapobiec "lepkiemu" efektowi */
    button:hover:not(:disabled), 
    a button:hover, 
    a.button-link:hover {
        background-color: #059669; 
        transform: none;
    }
}