/* Font Declarations */
@font-face {
    font-family: 'iCiel Panton';
    src: url('../font/iCielPanton-Black.otf') format('opentype');
    font-weight: 900;
    font-style: normal;
}

@font-face {
    font-family: 'iCiel Panton';
    src: url('../font/iCielPanton-Light.otf') format('opentype');
    font-weight: 300;
    font-style: normal;
}

@font-face {
    font-family: 'Montserrat';
    src: url('../font/Montserrat-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', sans-serif;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

/* Quiz Section - Background 100% */
.quiz-section {
    width: 100%;
    height: 100vh;
    background: url('../images/quiz-bg.png') no-repeat center center;
    background-size: cover;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    position: relative;
}

/* Main Container - Rectangle Box in Center */
.quiz-main-container {
    width: 100%;
    max-width: 1300px;
    min-height: 700px;
    height: auto;
    max-height: 90vh;
    background: #fff;
    border-radius: 30px;
    border: 8px solid #87CEEB;
    padding: 40px;
    overflow-y: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Close Button */
.quiz-close-btn {
    position: absolute;
    top: 10%;
    right: 15%;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: transform 0.3s ease;
    z-index: 100;
}

.close-icon {
    width: 50px;
    height: 50px;
    display: block;
}

/* Talent Image */
.quiz-talent {
    position: absolute;
    bottom: 8%;
    left: 6%;
    z-index: 1;
}

.talent-img {
    width: 260px;
    height: auto;
    display: block;
}

/* Double Logo */
.quiz-double-logo {
    position: absolute;
    top: 4%;
    right: 2%;
}

.double-logo-img {
    width: 180px;
    height: auto;
    display: block;
}

/* D-MAXX Main Logo */
.quiz-dmax-logo {
    position: absolute;
    top: 4%;
    left: 2%;
    z-index: 10;
    cursor: pointer;
    display: block;
    text-decoration: none;
}

.dmax-logo-img {
    width: 170px;
    height: auto;
    display: block;
}

/* Bottom Line */
.quiz-bottom-line {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    pointer-events: none;
}

.bottom-line-img {
    width: 100%;
    height: auto;
    display: block;
}

/* Subtitle Text */
.quiz-subtitle {
    width: 100%;
    text-align: center;
    margin: 20px 0;
    z-index: 5;
}

.subtitle-text {
    font-size: 14px;
    font-weight: 600;
    color: #0066cc;
    text-align: center;
    line-height: 1.4;
    margin: 0 auto;
    max-width: 800px;
}

/* Header Title with Summary Frame */
.quiz-header-title {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
    position: relative;
    z-index: 5;
}

.header-frame-img {
    width: 100%;
    max-width: 600px;
    height: auto;
    display: block;
}

.header-title-text {
    position: absolute;
    top: 56%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 800;
    font-size: 26px;
    color: #fff;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    margin: 0;
}

/* Quiz Form Container */
.quiz-form-container {
    width: 100%;
    max-width: 700px;
    margin: 30px auto;
    padding: 0 20px;
}

.quiz-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Form Rows */
.form-row {
    display: flex;
    gap: 1em;
    width: 100%;
}

.name-row {
    justify-content: space-between;
}

.double-row {
    justify-content: space-between;
}

.triple-row {
    justify-content: space-between;
}

/* Form Fields */
.form-field {
    display: flex;
    align-items: center;
    gap: 10px;
    /* flex: 1; */
    position: relative;
    z-index: 1;
}


.field-label {
    font-weight: 900;
    font-size: 15px;
    color: #0066cc;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 120px;
}

.input-wrapper {
    position: relative;
    /* flex: 1; */
    max-width: 400px;
    z-index: 1;
}

.input-bg {
    width: 100%;
    height: 40px;
    display: block;
    pointer-events: none;
}

.field-input {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    border: none;
    background: transparent;
    font-size: 16px;
    font-weight: 800;
    color: #ffffff;
    outline: none;
    padding: 5px;
    font-family: 'Montserrat', sans-serif;
}

/* Override browser autofill background */
.field-input:-webkit-autofill,
.field-input:-webkit-autofill:hover,
.field-input:-webkit-autofill:focus,
.field-input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px transparent inset !important;
    box-shadow: 0 0 0 1000px transparent inset !important;
    -webkit-text-fill-color: #ffffff !important;
    background-color: transparent !important;
    transition: background-color 5000s ease-in-out 0s;
}

select.field-input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    padding-right: 40px;
}

select.field-input option {
    background: #fff;
    color: #333;
    padding: 10px;
}

/* Custom Select Dropdown */
.custom-select-wrapper {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: calc(100% - 30px);
}

.custom-select-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 5px 0;
    min-height: 30px;
}

.custom-select-display .selected-value {
    font-size: 16px;
    font-weight: 800;
    color: #ffffff;
    flex: 1;
    font-family: 'Montserrat', sans-serif;
}

.custom-select-dropdown {
    position: absolute;
    width: max-content;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 2px solid #87CEEB;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 2000;
    display: none;
    max-height: 250px;
    overflow-y: auto;
}

.custom-select-dropdown.active {
    display: block;
}

.form-field:has(.custom-select-dropdown.active) {
    z-index: 2001;
}

.custom-option {
    padding: 12px 15px;
    font-size: 15px;
    font-weight: 800;
    color: #0066cc;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.custom-option:hover {
    background: #e6f3ff;
}

.custom-option:active {
    background: #cce7ff;
}

.field-unit {
    position: absolute;
    right: 17px;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 900;
    font-size: 15px;
    color: #ffffff;
}

.input-khung-plus {
    position: absolute;
    right: -8%;
    top: 50%;
    transform: translateY(-50%);
    width: 23px;
    height: 23px;
    display: block;
}

/* Gender Field */
.gender-options {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 20px;
}

.gender-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.gender-option input[type="radio"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.gender-option span {
    font-weight: 900;
    font-size: 14px;
    color: #0066cc;
}

/* Form Buttons */
.form-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 20px;
}

.form-btn {
    position: relative;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    width: 180px;
    height: 60px;
    transition: transform 0.3s ease;
}

.form-btn:hover {
    transform: scale(1.05);
}

.btn-img {
    width: 100%;
    height: 100%;
    display: block;
}

.btn-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 900;
    font-size: 18px;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    font-family: 'Montserrat', sans-serif;
}

/* Warning Section */
.warning-section {
    width: 100%;
    max-width: 600px;
    margin: 10px auto 40px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    z-index: 5;
    position: relative;
}

.warning-text {
    font-size: 12px;
    font-weight: 600;
    color: #0066cc;
    margin: 0;
    text-align: center;
}

.warning-text strong {
    font-weight: 900;
    color: #0066cc;
}

/* Error Container */
.form-error-container {
    background: #ff4444;
    color: white;
    padding: 10px 18px;
    border-radius: 10px;
    margin-top: 10px;
    text-align: center;
    z-index: 10;
}

.form-error-text {
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 600;
    margin: 0;
    white-space: pre-line;
}

.form-error-container.shake {
    animation: shake 0.5s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-8px);
    }

    40% {
        transform: translateX(8px);
    }

    60% {
        transform: translateX(-5px);
    }

    80% {
        transform: translateX(5px);
    }
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(3px);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top: 5px solid #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}


@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Back to Home Button */
.home-btn-fixed {
    position: absolute;
    bottom: 5%;
    right: 5%;
    width: 180px;
    height: 60px;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.3s ease;
    z-index: 10;
}

.home-btn-fixed:hover {
    transform: scale(1.05);
}

.home-btn-fixed .btn-bg-img {
    width: 100%;
    height: 100%;
    display: block;
}

.home-btn-fixed .btn-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 900;
    font-size: 15px;
    white-space: nowrap;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Fix field-label base font-size (was 1vw which breaks at small screens) */
@media (max-width: 1600px) {
    .quiz-main-container {
        max-width: 1200px;
        min-height: 600px;
    }

    .header-title-text {
        font-size: 20px;
    }

    .quiz-form-container {
        width: 100%;
        max-width: 600px;
        margin: 0;
        padding: 0;
    }

    .form-btn {
        width: 150px;
        height: 40px;
    }

    .btn-text {
        font-size: 15px;
    }

    .quiz-header-title {
        margin-bottom: 10px;
        margin-top: 0;
    }

    .subtitle-text {
        font-size: 12px;
        white-space: break-spaces;
    }

    .header-frame-img {
        max-width: 500px;
    }

    .talent-img {
        width: 230px;
    }

    .home-btn-fixed {
        width: 150px;
        height: 50px;
    }
}


/* Large Desktop - max-width: 1440px */
@media (max-width: 1440px) {
    .quiz-section {
        padding: 25px;
    }

    .quiz-main-container {
        max-width: 1000px;
        min-height: auto;
        padding: 20px 30px;
        max-height: 92vh;
    }

    .talent-img {
        width: 180px;
    }

    .quiz-talent {
        bottom: 3%;
        left: 3%;
    }

    .double-logo-img {
        width: 130px;
    }

    .dmax-logo-img {
        width: 120px;
    }

    .header-frame-img {
        max-width: 380px;
    }

    .header-title-text {
        font-size: 16px;
    }

    .subtitle-text {
        font-size: 10px;
    }

    .quiz-subtitle {
        margin: 5px 0;
    }

    .quiz-header-title {
        margin: 5px 0;
    }

    .quiz-form-container {
        margin: 8px auto;
    }

    .quiz-form {
        gap: 8px;
    }

    .field-label {
        font-size: 12px;
        min-width: 95px;
    }


    .field-input {
        font-size: 16px;
        transform: translateY(-50%) scale(0.8125);
        transform-origin: left center;
    }

    .field-unit {
        font-size: 12px;
    }

    .form-btn {
        width: 140px;
        height: 46px;
    }

    .btn-text {
        font-size: 14px;
    }

    .form-buttons {
        margin-top: 6px;
    }

    .warning-text {
        font-size: 9px;
    }

    .warning-section {
        margin: 6px auto 35px;
        line-height: 1;
    }

    .close-icon {
        width: 40px;
        height: 40px;
    }

    .home-btn-fixed {
        width: 150px;
        height: 50px;
    }

    .home-btn-fixed .btn-text {
        font-size: 15px;
    }
}

/* Medium Desktop - max-width: 1100px */
@media (max-width: 1100px) {
    .quiz-section {
        padding: 20px;
    }

    .quiz-main-container {
        max-width: 850px;
        padding: 18px 25px;
    }

    .talent-img {
        width: 150px;
    }

    .quiz-talent {
        bottom: 3%;
        left: 2%;
    }

    .double-logo-img {
        width: 110px;
    }

    .dmax-logo-img {
        width: 100px;
    }

    .header-frame-img {
        max-width: 340px;
    }

    .header-title-text {
        font-size: 16px;
    }

    .subtitle-text {
        font-size: 9px;
    }

    .quiz-subtitle {
        margin: 4px 0;
    }

    .quiz-header-title {
        margin: 4px 0;
    }

    .quiz-form-container {
        margin: 6px auto;
    }

    .quiz-form {
        gap: 6px;
    }

    .field-label {
        font-size: 11px;
        min-width: 95px;
    }


    .field-input {
        font-size: 16px;
        transform: translateY(-50%) scale(0.75);
        transform-origin: left center;
    }

    .custom-select-display .selected-value {
        font-size: 16px;
        transform: scale(0.75);
        transform-origin: left center;
        display: inline-block;
    }

    .field-unit {
        font-size: 11px;
    }

    .form-btn {
        width: 130px;
        height: 42px;
    }

    .btn-text {
        font-size: 13px;
    }

    .form-buttons {
        margin-top: 6px;
    }

    .warning-section {
        margin: 5px auto 8px;
    }

    .warning-text {
        font-size: 8px;
    }

    .nav-btn-img {
        width: 40px;
    }

    .home-btn-fixed {
        width: 140px;
        height: 46px;
    }

    .home-btn-fixed .btn-text {
        font-size: 14px;
    }
}

/* Tablet - max-width: 900px */
@media (max-width: 900px) {
    .quiz-section {
        padding: 15px;
    }

    .quiz-main-container {
        max-width: 700px;
        padding: 15px;
        border-width: 6px;
        border-radius: 25px;
        overflow-y: auto;
    }

    /* Custom Scrollbar for Mobile */
    .quiz-main-container::-webkit-scrollbar {
        width: 6px;
    }

    .quiz-main-container::-webkit-scrollbar-track {
        background: rgba(135, 206, 235, 0.1);
        border-radius: 10px;
    }

    .quiz-main-container::-webkit-scrollbar-thumb {
        background: rgba(135, 206, 235, 0.6);
        border-radius: 10px;
    }

    .quiz-main-container::-webkit-scrollbar-thumb:hover {
        background: rgba(135, 206, 235, 0.8);
    }

    .quiz-talent {
        display: none;
    }

    .double-logo-img {
        width: 100px;
    }

    .dmax-logo-img {
        width: 90px;
    }

    .header-frame-img {
        max-width: 350px;
    }

    .header-title-text {
        font-size: 16px;
    }

    .quiz-subtitle {
        margin: 8px 0;
    }

    .subtitle-text {
        font-size: 10px;
    }

    .quiz-header-title {
        margin: 8px 0;
    }

    .quiz-form-container {
        margin: 10px auto;
        padding: 0 10px;
    }

    .quiz-form {
        gap: 8px;
    }

    .field-label {
        font-size: 11px;
        min-width: 95px;
    }


    .field-input {
        font-size: 16px;
        left: 10px;
        transform: translateY(-50%) scale(0.85);
        transform-origin: left center;
    }

    .custom-select-display .selected-value {
        font-size: 16px;
        transform: scale(0.75);
        transform-origin: left center;
        display: inline-block;
    }

    .custom-select-wrapper {
        left: 10px;
        width: calc(100% - 20px);
    }

    .field-unit {
        font-size: 11px;
        right: 12px;
    }

    .form-btn {
        width: 130px;
        height: 42px;
    }

    .btn-text {
        font-size: 13px;
    }

    .form-buttons {
        margin-top: 8px;
        gap: 15px;
    }

    .warning-section {
        margin: 10px auto;
    }

    .warning-text {
        font-size: 9px;
    }

    .home-btn-fixed {
        width: 130px;
        height: 42px;
        bottom: 3%;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }

    .home-btn-fixed:hover {
        transform: translateX(-50%) scale(1.05);
    }

    .home-btn-fixed .btn-text {
        font-size: 13px;
    }
}

/* Mobile Landscape / Small Tablet - max-width: 768px */
@media (max-width: 768px) {
    body {
        overflow-y: auto;
        height: auto;
    }

    .quiz-section {
        padding: 10px;
        height: auto;
        min-height: 100vh;
    }

    .quiz-main-container {
        max-width: 100%;
        padding: 15px;
        max-height: none;
        overflow-y: visible;
        border-width: 5px;
        border-radius: 20px;
    }

    .quiz-double-logo {
        display: none;
    }

    .double-logo-img {
        width: 100px;
    }

    .quiz-dmax-logo {
        position: relative;
        top: auto;
        left: auto;
        display: flex;
        justify-content: center;
    }

    .dmax-logo-img {
        width: 90px;
    }

    .header-frame-img {
        max-width: 300px;
    }

    .header-title-text {
        font-size: 14px;
    }

    .form-row.name-row {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    .form-row.double-row {
        flex-wrap: wrap;
        gap: 8px;
    }

    .form-field {
        width: fit-content;
    }

    .input-wrapper {
        width: fit-content;
    }

    .home-btn-fixed {
        width: 130px;
        height: 42px;
        bottom: 2%;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }

    .home-btn-fixed:hover {
        transform: translateX(-50%) scale(1.05);
    }

    .home-btn-fixed .btn-text {
        font-size: 13px;
    }
}

/* Mobile Portrait - max-width: 576px */
@media (max-width: 576px) {
    .quiz-section {
        padding: 8px;
    }

    .quiz-main-container {
        padding-bottom: 50px;
        overflow-y: auto;
    }

    .double-logo-img {
        width: 80px;
    }

    .dmax-logo-img {
        width: 130px;
    }

    .header-frame-img {
        max-width: 350px;
    }

    .header-title-text {
        font-size: 12px;
    }

    .subtitle-text {
        font-size: 12px;
    }

    .field-label {
        font-size: 12px;
    }


    .field-input {
        font-size: 16px;
        transform: translateY(-50%) scale(0.85);
        transform-origin: left center;
    }

    .form-btn {
        width: 120px;
        height: 40px;
    }

    .btn-text {
        font-size: 12px;
    }

    .warning-text {
        font-size: 10px;
        font-weight: 500;
    }
    .warning-section {
        margin: 5px auto 20px;
    }

    .home-btn-fixed {
        width: 120px;
        height: 40px;
        bottom: 2%;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }

    .home-btn-fixed:hover {
        transform: translateX(-50%) scale(1.05);
    }

    .home-btn-fixed .btn-text {
        font-size: 12px;
    }

    .subtitle-text {
        font-size: 12px;
        white-space: normal;
    }

    .nowrap {
        white-space: nowrap;
    }
}