@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;700&display=swap');

/* Universal Box Model */
*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

/* Body Styling */
body {
    background: linear-gradient(rgb(227, 5, 5),rgb(182, 0, 202));
    font-family: 'Poppins', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh; /* Use min-height to ensure content fits and scrolls */
    margin: 0; /* Remove default body margin */
    padding: 20px; /* Add padding for overall spacing on smaller screens */
}

/* Text Selection Style */
::selection{
    color: #fff;
    background: linear-gradient(rgb(157, 0, 255),rgb(0, 0, 0));
}

/* Positioning for main content boxes */
.start_btn,
.info_box,
.quiz_box,
.result_box{
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2),
                0 6px 20px 0 rgba(0, 0, 0, 0.19);
    width: 90%; /* Make boxes responsive to width */
    max-width: 550px; /* Max width for larger screens */
    box-sizing: border-box; /* Include padding/border in element's total width */
}

/* Active state for boxes */
.info_box.activeInfo,
.quiz_box.activeQuiz,
.result_box.activeResult{
    opacity: 1;
    z-index: 5;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

/* Start Button */
.start_btn button{
    font-size: 25px;
    font-weight: 500;
    color: #000000;
    padding: 15px 30px;
    outline: none;
    border: 2px solid black;
    border-radius: 5px;
    background: white;
    cursor: pointer;
    /* Removed `width: 50%;` */
    max-width: 250px; /* Max width for consistency */
    margin: 0 auto; /* Center the button horizontally */
    display: block; /* Ensure margin auto works by making it a block element */
}

.start_btn button:hover{
    color: white;
    background: black;
    transition: all 0.3s ease;
}

/* Info Box */
.info_box{
    background: #fff;
    border-radius: 5px;
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

.info_box .info-title{
    height: 60px;
    width: 100%;
    border-bottom: 1px solid lightgrey;
    display: flex;
    align-items: center;
    padding: 0 30px;
    border-radius: 5px 5px 0 0;
    font-size: 20px;
    font-weight: 600;
    box-sizing: border-box;
}

.info_box .info-list{
    padding: 15px 30px;
}

.info_box .info-list .info{
    margin: 5px 0;
    font-size: 17px;
}

.info_box .info-list .info span{
    font-weight: 600;
    color: #000000;
}
.info_box .buttons{
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 30px;
    /* Removed float:left; - better to manage layout with flexbox/grid */
    border-top: 1px solid lightgrey;
    width: 100%; /* Full width for button container */
    box-sizing: border-box;
}
.info_box .buttons button{
    margin: 0 5px;
    height: 40px;
    width: 100px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    outline: none;
    border-radius: 5px;
    border: 1px solid #000000;
    transition: all 0.3s ease;
}

/* Quiz Box */
.quiz_box{
    background: #fff;
    border-radius: 5px;
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

.quiz_box header{
    position: relative;
    z-index: 2;
    height: 70px;
    padding: 0 30px;
    background: #fff;
    border-radius: 5px 5px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0px 3px 5px 1px rgba(0,0,0,0.1);
    box-sizing: border-box;
}

.quiz_box header .title{
    font-size: 20px;
    font-weight: 600;
}

.quiz_box header .timer{
    color: #ffffff;
    background: #000000;
    border: 1px solid #b8daff;
    height: 45px;
    padding: 0 8px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 145px;
}

.quiz_box header .timer .time_left_txt{
    font-weight: 400;
    font-size: 17px;
    user-select: none;
}

.quiz_box header .timer .timer_sec{
    font-size: 18px;
    font-weight: 500;
    height: 30px;
    width: 45px;
    color: #fff;
    border-radius: 5px;
    line-height: 30px;
    text-align: center;
    background: #343a40;
    border: 1px solid #343a40;
    user-select: none;
}

.quiz_box header .time_line{
    position: absolute;
    bottom: 0px;
    left: 0px;
    height: 3px;
    background: #000000;
}

/* Quiz Section */
section{
    padding: 25px 30px 20px 30px;
    background: #fff;
}

section .que_text{
    font-size: 25px;
    font-weight: 600;
}

section .option_list{
    padding: 20px 0px;
    display: block;
}

section .option_list .option{
    background: aliceblue;
    border: 1px solid #84c5fe;
    border-radius: 5px;
    padding: 8px 15px;
    font-size: 17px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

section .option_list .option:last-child{
    margin-bottom: 0px;
}

section .option_list .option:hover{
    color: #ffffff;
    background: black;
    border: 1px solid #b8daff;
    transition: all 0.3s ease;
}

section .option_list .option.correct{
    color: #155724;
    background: #d4edda;
    border: 1px solid #c3e6cb;
}

section .option_list .option.incorrect{
    color: #721c24;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
}

section .option_list .option.disabled{
    pointer-events: none;
}

section .option_list .option .icon{
    height: 26px;
    width: 26px;
    border: 2px solid transparent;
    border-radius: 50%;
    text-align: center;
    font-size: 13px;
    pointer-events: none;
    transition: all 0.3s ease;
    line-height: 24px;
}
.option_list .option .icon.tick{
    color: #23903c;
    border-color: #23903c;
    background: #d4edda;
}

.option_list .option .icon.cross{
    color: #a42834;
    background: #f8d7da;
    border-color: #a42834;
}

/* Quiz Footer */
footer{
    height: 60px;
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid lightgrey;
    box-sizing: border-box;
}

footer .total_que span{
    display: flex;
    user-select: none;
}

footer .total_que span p{
    font-weight: 500;
    padding: 0 5px;
}

footer .total_que span p:first-child{
    padding-left: 0px;
}

footer button{
    height: 40px;
    padding: 0 13px;
    font-size: 18px;
    font-weight: 400;
    cursor: pointer;
    border: 2px solid black;
    outline: none;
    color: #000000;
    border-radius: 5px;
    background: none;
    border: 1px solid #000000;
    line-height: 10px;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.95);
    transition: all 0.3s ease;
}


footer button:hover{
    color: white;
    background: black;
    transition: all 0.3s ease;
}

footer button.show{
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

/* Result Box */
.result_box{
    background: #fff;
    border-radius: 5px;
    display: flex;
    padding: 25px 30px;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

.result_box .icon{
    font-size: 100px;
    color: rgb(175, 190, 42);
    margin-bottom: 10px;
}

.result_box .complete_text{
    font-size: 20px;
    font-weight: 500;
    text-align: center;
}

.result_box .score_text span{
    display: flex;
    margin: 10px 0;
    font-size: 18px;
    font-weight: 500;
    flex-wrap: wrap;
    justify-content: center;
}

.result_box .score_text span p{
    padding: 0 4px;
    font-weight: 600;
}

.result_box .buttons{
    display: flex;
    margin: 20px 0;
    flex-wrap: wrap;
    justify-content: center;
}

.result_box .buttons button{
    margin: 5px 10px;
    height: 45px;
    padding: 0 20px;
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    outline: none;
    border-radius: 5px;
    border: 1px solid #000000;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 150px;
}

.buttons button.restart{
    color: #000000;
    background: #ffffff;
    border: 1px solid black;
}

.buttons button.restart:hover{
    background:black;
    color: white;
    transition: all 0.3s ease;
}

.buttons button.quit{
    color: #0d0e0e;
    background: #fff;
    border: 1px solid black;
}

.buttons button.quit:hover{
    color: #ffffff;
    background: black;
    transition: all 0.3s ease;
}

/* Media Queries for general responsiveness */
@media (max-width: 768px) {
    .info_box,
    .quiz_box,
    .result_box {
        padding: 15px;
    }

    .info_box .info-title,
    .quiz_box header {
        padding: 0 15px;
        font-size: 18px;
    }

    .quiz_box header .timer {
        width: 120px;
        height: 40px;
    }

    .quiz_box header .timer .time_left_txt {
        font-size: 15px;
    }

    .quiz_box header .timer .timer_sec {
        font-size: 16px;
        height: 28px;
        width: 40px;
    }

    section {
        padding: 15px;
    }

    section .que_text {
        font-size: 20px;
    }

    section .option_list .option {
        padding: 10px;
        font-size: 16px;
    }

    footer {
        padding: 0 15px;
        height: 50px;
    }

    footer button {
        font-size: 16px;
        height: 35px;
    }

    .result_box .icon {
        font-size: 80px;
    }

    .result_box .complete_text {
        font-size: 18px;
    }

    .result_box .score_text span {
        font-size: 16px;
    }

    .result_box .buttons button {
        height: 40px;
        font-size: 16px;
        margin: 5px;
        width: calc(50% - 10px);
        max-width: none;
    }
}

@media (max-width: 480px) {
    /* Adjusted .start_btn button for smaller screens */
    .start_btn button {
        font-size: 20px;
        padding: 12px 20px;
        width: 90%; /* Make it take up more width on smaller screens */
        max-width: 250px; /* Still limit its max width */
    }

    .info_box,
    .quiz_box,
    .result_box {
        width: 95%;
        padding: 10px;
    }

    .info_box .info-title,
    .quiz_box header {
        font-size: 16px;
        height: 55px;
        padding: 0 10px;
    }

    .info_box .buttons button {
        width: 80px;
        height: 35px;
        font-size: 14px;
    }

    .quiz_box header .timer {
        width: 100px;
        height: 35px;
    }

    .quiz_box header .timer .time_left_txt {
        font-size: 14px;
    }

    .quiz_box header .timer .timer_sec {
        font-size: 15px;
        height: 25px;
        width: 35px;
    }

    section .que_text {
        font-size: 18px;
    }

    section .option_list .option {
        padding: 8px 10px;
        font-size: 15px;
    }

    footer {
        padding: 0 10px;
        height: 45px;
    }

    footer button {
        font-size: 15px;
        height: 30px;
    }

    .result_box .icon {
        font-size: 60px;
    }

    .result_box .complete_text {
        font-size: 16px;
    }

    .result_box .score_text span {
        font-size: 15px;
    }

    .result_box .buttons button {
        height: 35px;
        font-size: 15px;
        width: 90%;
        margin: 5px 0;
    }
}