/* Quiz Application Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap');


:root {
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --font-heading: 'Montserrat', sans-serif;
    --rwb-gradient: linear-gradient(180deg, #dc5656 33.3%, #ffffff 33.3%, #ffffff 66.6%, #50aa4d 66.6%);
    --red:#dc5656;
    --green:#50aa4d;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color:  rgba(255, 255, 255, 0);

}

body {
    font-family: var(--font-primary);
    line-height: 1.6;
    color: #333;
    background-color: rgb(24 35 95);
    scroll-behavior: smooth;
}

/* Background slideshow */
.slideshow-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-height:100svh;
    z-index: -1;
    overflow: hidden;    .slide {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-size: cover;
        background-position: center;
        opacity: 0;
        transition: opacity 2s ease-in-out;

        &.active {
            opacity: 1;
        }

        /* Caption within each slide */
        .slide-caption {
            position: absolute;
            top: 20px;
            right: 20px;
            z-index: 2;

            background: rgba(0, 0, 0, 0.5);
            color: white;

            padding: 8px 12px;
            border-radius: 6px;
            font-size: 0.75rem;
            font-weight: 500;

            opacity: 0.6;
            transition: all 0.3s ease;

            /* Typography */
            font-family: var(--font-primary);
            letter-spacing: 0.02em;

            /* Hide on mobile */
            @media (max-width: 768px) {
                display: none;
            }

        }
    }
}

/* Main container */
.main-container {
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding: 0;
    position: relative;
    z-index: 1;
    overflow: hidden;


    &:has(.welcome-screen:not(.hidden)) {
        justify-content: center;
    }

    &:has(.results-screen:not(.hidden)) {
    justify-content: center;
    }
}

/* Welcome screen */
.welcome-screen {
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-grow: 1;
    text-align: center;
    width: 100%;
    min-height: 100svh;
    color: #022b55;
    transition: all 0.3s ease;

    h2 {
        font-family: var(--font-heading);
        font-size: 2rem;
        font-weight: 800;
        color: #374151;
        margin-bottom: 16px;
        position: relative;


    }

    h3 {
        font-family: var(--font-heading);
        font-size: 1.3rem;
        font-weight: 600;

        position: relative;
        text-align: left;
        text-transform: initial;
        padding-left: 24px;
        margin-top: 16px;

        &:after {
            content: '';
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 3px; /* Make the line thin */
            height: 100%; /* Make the line 80% of the text height */
            background: var(--rwb-gradient); /* Keep the red-white-blue gradient */
            border-radius: 1.5px;
        }


    }

    p {
        margin-bottom: 24px;
        font-size: 1.1rem;
        text-align: justify;
        line-height: 1.7;
    }

    .welcome-content {
        padding: 40px;
        margin-bottom: 20px;
        max-width: 800px;
        border-radius: 12px;
        margin:16px auto ;
        z-index: 2;


        a {
            color: #3b82f6;
            text-decoration: none;
            font-weight: 600;
            transition: color 0.2s ease;

            &:hover {
                color: #2563eb;
                text-decoration: underline;
            }
        }
    }
}
.quiz-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}
/* Quiz panel */
.quiz-panel {
    padding: 32px;
    width: 100%;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgb(24 35 95 / 84%) 85%);

}

.current-question {
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    position: absolute;
    left: 26px;
    top: 22px;
    animation: slideInFromTop 0.6s ease-out;


    @media (max-width: 768px) {
        flex-direction: column;
        gap: 8px;
        font-size: 0.8rem;
    }
}

#current-question {
    font-weight: 800;
    color: #fbbf24;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.current-score {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 2.5rem;
    color: #ffffff;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    padding: 8px 20px;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
    text-shadow: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    position: absolute;
    top: 0;

    &::after {
        content: 'pont';
        font-size: 0.6em;
        opacity: 0.8;
        font-weight: 600;
    }

    &.updated {
        animation: scoreUpdate 0.5s ease-out;
    }

    @media (max-width: 768px) {
        font-size: 1.8rem;
        padding: 6px 16px;
        right: -1px;
        border-radius: 0 0 0 12px;
        top:0;
    }
}
/* Progress bar */
.progress-container {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 100vh;
    background-color: rgba(229, 231, 235, 0.8);
    z-index: 10;

    @media (max-width: 768px) {
        left: 0;
        width: 6px;
    }
}

.progress-bar {
    background: linear-gradient(180deg, #3b82f6, #1d4ed8);
    width: 100%;
    transition: height 0.5s ease;
    position: absolute;
    bottom: 0;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

/* Question section */
.question-section {
    max-width: 800px;
    margin: auto;
    transition: all 0.3s ease;
    &.slide-out {
        animation: fadeOut 0.2s ease-in forwards;
    }

    &.slide-in {
        animation: fadeIn 0.3s ease-out forwards;
    }
}

.question-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.question-category {
    font-size: 0.6rem;
    font-weight: 900;
    color: #2563eb;
    background-color: #dbeafe;
    padding: 4px 12px;
    border-radius: 9999px;

}

.question-text {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 16px;
    text-shadow: 0px 0px 7px #022b55, 0px 0px 30px rgb(20 22 83);
    /* text-box: trim-both cap alphabetic; */
}

/* Answer options */
.answers-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;

    @media (max-width: 768px) {
        grid-template-columns: 1fr;
    }
}

.answer-button {
    width: 100%;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    background-color: #003f7e93;
    color:#ffffff;
    font-weight:600;
    border: 2px solid #ffffff91;
    border-radius: 120px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.1rem;
    font-family: var(--font-primary);
    position: relative;
    overflow:hidden;
    transition: all 0.5s ease;


    &:before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
        transition: all 0.5s ease;
    }

    &:hover:not(:disabled) {
        /* background: rgba(255, 255, 255, 0.2); */
        box-shadow: 0 0 15px rgba(255, 255, 255, 0.541);
    }

    &:not(:disabled):hover::before {
        left: 100%;
    }

    /* &:hover {
        background-color: #f3f4f6;
        border-color: #d1d5db;
    } */
     &.selected {
        background-color: #dbeafe;
        border-color: #3b82f6;
        color: #1e40af;
        transform: scale(1.02);
        box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    }

    &.correct {
        background-color: #50aa4d70;
        border-color: #74eca0;
        color: #c8e6c7;
        box-shadow: 0 4px 16px rgba(116, 236, 160, 0.4);
        /* animation: correctPulse 0.6s ease-out; */
    }

    &.incorrect {
        background-color: #dc262679;
        border-color: #e24b4b;
        color: #e89191;
        box-shadow: 0 4px 12px rgba(226, 75, 75, 0.3);
        /* animation: incorrectShake 0.6s ease-out; */
    }
    &:disabled {
        pointer-events: none;
    }
    &:disabled:not(.correct):not(.incorrect) {
        opacity:0.5;
    }

    &.selecting {
    animation: selectingPulse 0.5s ease-out infinite;
}

    /* Answer button internal layout */
    .answer-letter {
        flex-shrink: 0;
        text-align: left;
        font-weight: 700;
    }

    .answer-text {
        flex: 1;
        text-align: left;
        padding: 0 16px;
    }
}

/* Explanation section */
.explanation-container {
    margin: 0 24px;
    padding: 16px;
    max-width: 800px;
    background-color: #eff6ff;
    border-radius: 8px;
    transition: all 0.3s ease;
    opacity: 1;
    max-height: calc-size(auto, size);
    transform: translateY(0);
    z-index: 10;



    &.hidden {
        display: block;
        opacity: 0;
        max-height: 0;
        pointer-events: none;

    }
    /* &.fade-out-explanation {
        opacity: 0;
        transform: translateY(-10px);
        pointer-events: none;
    }

    &.fade-in-explanation {
        opacity: 0;
        transform: translateY(10px);
        animation: fadeInExplanation 0.4s ease-out forwards;
    } */

    h4 {
        font-family: var(--font-heading);
        font-weight: 600;
        color: #1e40af;
        margin-bottom: 8px;
    }
}

.explanation-text {
    color: #1d4ed8;
}

/* Action buttons */
.action-buttons {
    text-align: center;
    margin-top: 24px;
}

.btn {
    font-family: var(--font-heading);
    font-weight: 600;
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
    text-decoration: none;
    display: inline-block;
    opacity:1;

    &.btn-primary {
        background-color: #3b82f6;
        color: white;

        &:hover {
            background-color: #2563eb;
        }
    }

    &.btn-success {
        background-color: var(--green);
        color: white;

        &:hover {
            background-color: #059669;
        }
    }
    &.hidden {
        opacity: 0;
        display:inline-block;
        pointer-events: none;

    }
}

/* Results screen */
.results-screen {
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(2px);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    width: 100%;    h2 {
        font-family: var(--font-heading);
        font-size: 2rem;
        font-weight: 600;
        color: #374151;
        margin-bottom: 16px;
    }
}

.final-score {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: bold;
    color: #3b82f6;
    margin-bottom: 8px;
}

.score-message {
    color: #6b7280;
    margin-bottom: 24px;
}


footer {
    position: relative;
    overflow: hidden;
    z-index: 0;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* clip-path: polygon(0 50px, 100% 0, 100% 100%, 0 100%); */
    padding:  15rem 2rem 1rem 2rem;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgb(24 35 95 / 84%) 64%);
    margin-top: -15rem;

    .footer-content {
      display: flex;
        width: 100%;
        max-width: 800px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 4rem;
        position: relative;
    }
    h3 {
        color: #ffffff;
    }
}
.logo-wrapper {
    width: 200px;
    height: auto;
    position: relative;
    transition: transform 0.3s ease;
}

.logo-wrapper:hover {
    transform: translateY(-5px);
}

.logo-wrapper::before {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background: var(--primary);
    border-radius: 1.5px;
    opacity: 0;
    transition: opacity 0.3s ease, width 0.3s ease;
}

.logo-wrapper:hover::before {
    opacity: 1;
    width: 60px;
}

#logo {
    transition: filter 0.3s ease;
}

#logo:hover {
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.8));
}

#logo img {
    max-width: 100%;
    height: auto;
}
/* Animation keyframes */

@keyframes selectingPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Synchronized question transition animations */
.question-transition-out {
    animation: fadeOut 0.3s ease-in forwards;
}

.question-transition-in {
    animation: fadeIn 0.4s ease-out forwards;
}

.explanation-transition-out {
    animation: fadeOutDown 0.3s ease-in forwards;
}

.explanation-transition-in {
    animation: fadeInUp 0.4s ease-out forwards;
}

.button-transition-out {
    animation: fadeOutScale 0.3s ease-in forwards;
}

.button-transition-in {
    animation: fadeInScale 0.4s ease-out forwards;
}

@keyframes fadeOutDown {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(20px);
    }
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOutScale {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.9);
    }
}

@keyframes fadeInScale {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Question transition animations */
@keyframes slideOutLeft {
    0% {
        transform: translateX(0);
        opacity: 1;
    }
    100% {
        transform: translateX(-100%);
        opacity: 0;
    }
}

@keyframes slideInRight {
    0% {
        transform: translateX(100%);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    0% {
        opacity: 1;

    }
    100% {
        opacity: 0;
    }
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;

    }
}

@keyframes fadeInExplanation {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modern animations for quiz header */
@keyframes slideInFromTop {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Score update animation */
@keyframes scoreUpdate {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.5);
        box-shadow: 0 6px 24px rgba(59, 130, 246, 0.6);
    }
    100% {
        transform: scale(1);
    }
}

/* Utility classes */
.hidden {
    display: none;

}

.text-center {
    text-align: center;
}

.glass-panel {
    background: rgba(255, 255, 255, 0.61);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}
/* Responsive design */
@media (max-width: 768px), (max-height: 500px) {


    .welcome-screen,
    .quiz-panel,
    .results-screen {

        h2 {
            font-size: 1.2rem;
        }
        h3 {
            font-size: 1rem;
        }
    }
    /* .welcome-screen,
    .results-screen {
        margin: 16px;
        width:auto;
    } */
    .welcome-screen {
        min-height: 500px;
        justify-content: flex-end;
        p {
            font-size: 0.8rem;
            margin-bottom: 1em
        }
        .welcome-content {
            padding: 16px;
            max-width: 100%;
            margin:16px;
        }
    }

    .explanation-container {
        font-size: 0.8rem;;
        margin-bottom: -3.5rem;
    }

    .question-text {
        font-size: 1.1rem;
    }

    .quiz-info {
        flex-direction: column;
        gap: 4px;

    }
    .question-category {
        padding: 2px 8px;
    }
    .answer-button {
        font-size: 1rem;
        padding: 12px;
    }
}
