/* Google fonts import */
@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@100..900&display=swap");

body {
    height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--text-color);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--primary-font);
    font-weight: 400 !important;
}

p {
    font-family: var(--primary-font);
    font-weight: 300 !important;
}

/* General styles */
:root {
    --primary-font: "Montserrat", "sans-serif";
    --secondary-font: "Nunito", system-ui, sans-serif;
    /* TODO(team): define colors*/
    --primary-color: #7ebdc2;
    --secondary-color: #bb4430;
    --highlight-color: #f3dfa2;
    --highlight-color-light: #efe6dd;
    --text-color: #231f20;
}

/*main styles*/
#index-main {
    background-color: var(--highlight-color-light);
}

main {
    background-color: var(--primary-color);
    /* make element fill the remaining space */
    flex: 1 0 auto;
    margin: 0;
    padding: 1rem;
    min-height: auto; /* Let content determine height */
}

/* name section */

#startGameForm label {
    color: white;
    font-size: 1.5rem;
}

#startGameForm input {
    width: 15rem;
}

#startGameForm p {
    color: white;
    font-size: 1rem;
    font-style: italic;
}

#validateUsernameBtn {
    font-size: 1rem;
}

#validateUsernameBtn:hover {
    background-color: green;
    border: green;
}

/* How it works section */
.how-it-works-section {
    background: var(--highlight-color-light);
    border-radius: 18px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
    padding: 3rem 0;
    margin-bottom: 2rem;
}
.how-it-works-section .card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    border: none;
}
.how-it-works-section .card:hover {
    transform: translateY(-6px) scale(1.03);
    box-shadow: 0 6px 24px rgba(123, 189, 194, 0.15);
}
.how-it-works-section .card-title {
    font-family: var(--primary-font);
    font-size: 1.35rem;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.how-it-works-section .card-text {
    font-family: var(--secondary-font);
    color: var(--text-color);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}
.how-it-works-section i {
    margin-bottom: 1rem;
    opacity: 0.9;
}
/* Quiz Section */
.quiz-section {
    background-color: var(--highlight-color-light);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    margin: 1rem;
    height: 95vh; /* Set a fixed height for the quiz section */
}

/*results page styles*/
.quiz-results {
    background-color: var(--highlight-color-light);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    padding: 3rem 2rem;
    margin: 1rem;
    border: 2px solid rgba(126, 189, 194, 0.2);
    position: relative;
    overflow: hidden;
}

.quiz-results::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(
        90deg,
        var(--primary-color),
        var(--secondary-color)
    );
    border-radius: 16px 16px 0 0;
}

.quiz-results .quiz-title {
    color: var(--secondary-color);
    font-weight: 700;
    margin-bottom: 2rem;
    font-size: 2.2rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.quiz-final-message {
    color: var(--secondary-color);
    font-size: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.results-body p {
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 1.2rem;
    line-height: 1.6;
}

.results-body .completion-message {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin: 1.5rem 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.results-body .results-intro {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 1.2rem 0 2rem 0;
    letter-spacing: 0.2px;
}

.results-body .score {
    background: linear-gradient(
        135deg,
        var(--primary-color),
        rgba(126, 189, 194, 0.8)
    );
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    font-size: 1.4rem;
    margin: 2rem 0;
    box-shadow: 0 4px 16px rgba(126, 189, 194, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.results-body .questions {
    background: rgba(243, 223, 162, 0.6);
    color: var(--text-color);
    padding: 1rem;
    border-radius: 8px;
    font-size: 1.2rem;
    margin: 1.5rem 0;
    border-left: 4px solid var(--secondary-color);
}

.results-body .thank-you-message {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--secondary-color);
    margin: 2rem 0 1.5rem 0;
    font-style: italic;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    letter-spacing: 0.3px;
}

.quiz-results .play-Again-btn .btn {
    background: linear-gradient(135deg, var(--secondary-color), #a03828);
    border: none;
    padding: 12px 32px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 25px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(187, 68, 48, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.quiz-results .play-Again-btn .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(187, 68, 48, 0.4);
    background: linear-gradient(135deg, #a03828, var(--secondary-color));
}

/*  modal  */

#quizConfigModal .modal-dialog {
    max-width: 400px;
    margin: 2rem auto;
}
#quizConfigModal .modal-content {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 24px rgba(0, 0, 0, 0.08);
    border: 1px solid #f3dfa2;
    padding: 2rem 1.5rem;
    font-family: var(--primary-font);
    color: var(--text-color);
}
#quizConfigModal .modal-header {
    border-bottom: none;
    text-align: center;
    padding-bottom: 0.5rem;
}
#quizConfigModal .modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--secondary-color);
    letter-spacing: 0.5px;
}
#quizConfigModal .btn-close {
    font-size: 1.2rem;
    color: var(--secondary-color);
    opacity: 0.6;
    transition: opacity 0.2s;
}
#quizConfigModal .btn-close:hover {
    opacity: 1;
}
#quizConfigModal .modal-body {
    font-size: 1rem;
    color: var(--text-color);
    padding-top: 0.5rem;
}
#quizConfigModal .modal-footer {
    border-top: none;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    padding-top: 1rem;
}
#quizConfigModal .btn-warning,
#quizConfigModal .btn-secondary {
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    padding: 0.5rem 1.2rem;
    box-shadow: none;
    border: 1px solid #e0e0e0;
    background: var(--highlight-color);
    color: var(--text-color);
    transition: background 0.2s, color 0.2s;
}
#quizConfigModal .btn-warning:hover,
#quizConfigModal .btn-secondary:hover {
    background: var(--secondary-color);
    color: #fff;
}
/* Header */

#quiz-header {
    margin-top: 0%;
}
.quiz-header h1 {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--text-color);
    margin-top: 0;
}

/* difficulty and score */
#quiz-difficulty,
#quiz-score {
    background-color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-color);
    border-radius: 8px;
    margin: 0.5rem;
    padding: 0.5rem;
}

/* Category */
#quiz-category {
    background-color: var(--secondary-color);
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 1rem;
    color: #fff;
    border-radius: 8px;
}

/* Question Number */
#question-number h1 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

/* Question */
.quiz-question {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--text-color);
}

/* Options */
.quiz-options {
    list-style: none;
    padding: 0;
    margin-bottom: 1.5rem;

    font-family: var(--primary-font);
    font-weight: 500;
    font-size: 20pt;
}

.quiz-option {
    background-color: #e0e0e0;
    margin: 0.5rem 0;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.quiz-option.selected {
    background-color: #3498db;
    color: white;
}

.quiz-option.correct {
    background-color: #27ae60;
    color: white;
}

.quiz-option.incorrect {
    color: white;
    background-color: var(--highlight-color);
    margin: 0.5rem 0;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.quiz-option:hover {
    background-color: var(--primary-color);
    border-width: 2px;
    border-color: var(--secondary-color);
}

/* Answer Display */
.quiz-answer {
    font-size: 1rem;
    margin-bottom: 1rem;
    margin-top: 1rem;
    color: #2c3e50;
}

/* Footer Buttons */
.quiz-footer {
    gap: 1rem;
    flex-wrap: wrap;
}

.quiz-footer .btn {
    background-color: var(--secondary-color);
    color: #fff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.quiz-footer .btn:hover {
    background-color: var(--primary-color);
    color: var(--text-color);
}

#result-body {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.mt-5 {
    margin-top: 0 !important;
}

.hero-section {
    background-image: url("../images/mobile-background.jpg");
    background-size: cover;
    background-position: top center;
    background-repeat: no-repeat;
    width: 100%;
    min-height: 70vh;
    position: relative;
}

/* medium devices (tablet, 320px and up) */
@media screen and (min-width: 320px) {
    .quiz-section {
        height: auto;
    }
    .quiz-results {
        margin-top: 160px;
        padding: 2rem 1.5rem;
    }
    .quiz-results .quiz-title {
        font-size: 1.8rem;
    }
    .quiz-final-message {
        font-size: 1.6rem;
    }
    .results-body p {
        font-size: 1rem;
    }
    .results-body .completion-message {
        font-size: 1.1rem;
    }
    .results-body .results-intro {
        font-size: 1.05rem;
    }
    .results-body .score {
        font-size: 0.7em;
        padding: 1.2rem;
    }
    .results-body .questions {
        font-size: 1.1rem;
    }
    .results-body .thank-you-message {
        font-size: 1.2rem;
    }
    .quiz-footer .btn {
        font-size: 0.9rem;
        padding: 10px 24px;
    }
    #quiz-difficulty {
        font-size: 1rem;
    }
    #quiz-score {
        min-height: 62px;
        text-align: center;
        font-size: 1rem;
        align-content: center;
    }
}

/* medium devices (tablet, 375px and up) */
@media screen and (min-width: 375px) {
    #quiz-difficulty,
    #quiz-score {
        min-height: auto;
    }
}

/* medium devices (tablet, 425px and up) */
@media screen and (min-width: 425px) {
    #quiz-difficulty,
    #quiz-score {
        min-height: auto;
    }
}

/* medium devices (tablet, 768px and up) */
@media screen and (min-width: 768px) {
    .quiz-section {
        padding: 3rem;
        max-width: 900px;
        height: 95vh;
        margin-top: 10px;
    }
    /* Make the quiz score and timer the same height for consistency */
    .quiz-header h1 {
        font-size: 2rem;
        margin-bottom: 1rem;
        font-weight: 700;
    }
    .results-body .score {
        font-size: 1.2rem;
        padding: 1.2rem;
    }
    #quiz-difficulty,
    #quiz-score {
        font-size: 1.5rem;
        padding: 1rem;
    }
    .quiz-options {
        display: flex;
        flex-direction: column;
    }

    .hero-section {
        background-image: url("../images/background.jpg");
    }
}

/* laptop devices (laptop, 1024px and up) */
@media screen and (min-width: 1024px) {
    .quiz-section {
        padding: 4rem;
        max-width: 1000px;
        height: 95vh;
        margin-top: 10px;
    }
    .quiz-results {
        margin-top: 40px;
        padding: 3.5rem;
        max-width: 800px;
    }
    .quiz-results .quiz-title {
        font-size: 2.5rem;
    }
    .quiz-final-message {
        font-size: 2.2rem;
    }
    .results-body .completion-message {
        font-size: 1.5rem;
    }
    .results-body .results-intro {
        font-size: 1.4rem;
    }
    .results-body .score {
        font-size: 1.6rem;
        padding: 2rem;
    }
    .results-body .questions {
        font-size: 1.3rem;
        padding: 1.2rem;
    }
    .results-body .thank-you-message {
        font-size: 1.6rem;
    }

    .hero-section {
        background-image: url("../images/background.jpg");
    }
}

/* modal */

#quizConfigModal {
    margin-top: 3rem;
}

/* Large laptop devices (large laptop, 1440px and up) */
@media screen and (min-width: 1440px) {
    .quiz-section {
        padding: 5rem;
        max-width: 85vw;
        height: 95vh;
        margin-top: 10px;
        align-items: center;
        margin-left: 95px;
    }
    .quiz-results {
        margin-top: 30px;
        padding: 4rem;
        max-width: 900px;
        margin-left: auto;
        margin-right: auto;
    }
    .quiz-results .quiz-title {
        font-size: 2.8rem;
    }
    .quiz-final-message {
        font-size: 2.4rem;
    }
}

/* Animation keyframes for results */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Apply animations to results elements */
.quiz-results {
    animation: fadeInUp 0.6s ease-out;
}

.quiz-results .quiz-title {
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.quiz-final-message {
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.results-body .completion-message {
    animation: fadeInUp 0.6s ease-out 0.6s both;
}

.results-body .results-intro {
    animation: fadeInUp 0.6s ease-out 0.8s both;
}

.results-body .score {
    animation: scaleIn 0.6s ease-out 1s both;
}

.results-body .questions {
    animation: fadeInUp 0.6s ease-out 1.2s both;
}

.results-body .thank-you-message {
    animation: fadeInUp 0.6s ease-out 1.4s both;
}

.play-Again-btn {
    animation: fadeInUp 0.6s ease-out 1.6s both;
}

.input-narrow {
    max-width: 220px;
}

.quiz-input::placeholder {
    color: #fff;
    opacity: 0.8;
}

.hero-overlay {
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0.45),
        rgba(0, 0, 0, 0.65)
    );
    pointer-events: none;
}

.hero-subtitle {
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85);
    font-size: 2rem;
    font-weight: bold;
}

/* Focus states for buttons and inputs */
.btn:focus,
.btn:focus-visible,
button:focus,
button:focus-visible {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(187, 68, 48, 0.2);
}

.quiz-footer .btn:focus,
.quiz-footer .btn:focus-visible {
    outline: 7px solid var(--primary-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(126, 189, 194, 0.3);
}

#quizConfigModal .btn-warning:focus,
#quizConfigModal .btn-warning:focus-visible,
#quizConfigModal .btn-secondary:focus,
#quizConfigModal .btn-secondary:focus-visible {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(187, 68, 48, 0.2);
}

#validateUsernameBtn:focus,
#validateUsernameBtn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(126, 189, 194, 0.3);
}

input:focus,
input:focus-visible,
.form-control:focus,
.form-control:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(126, 189, 194, 0.2);
    border-color: var(--primary-color);
}

.btn-close:focus,
.btn-close:focus-visible {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(187, 68, 48, 0.2);
}

.quiz-option:focus,
.quiz-option:focus-visible {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(187, 68, 48, 0.2);
}
