/* MOBILE-FIRST QUIZ - 100VH ENFORCEMENT */
/* Target: iPhone 390-430px width, ZERO vertical scroll */

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #F9F8F6;
    overflow: hidden; /* Prevent body scroll */
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
}

#quizApp {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* PROGRESS BAR - STICKY TOP WITH SHADOW */
.quiz-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: #E5E3DF;
    z-index: 1000;
    /* Safe area padding for notch */
    padding-top: env(safe-area-inset-top);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.quiz-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #8B7E74 0%, #2C2520 100%);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
    position: relative;
}

/* Progress bar glow effect */
.quiz-progress-bar::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 40px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3));
    opacity: 0.6;
}

/* QUIZ CONTAINER - FILLS REMAINING SPACE */
.quiz-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: max(env(safe-area-inset-top), 16px) 20px max(env(safe-area-inset-bottom), 20px);
    overflow: hidden;
    justify-content: space-between; /* Push content to edges */
    min-height: 0; /* Allow flexbox shrinking */
}

/* QUESTION NUMBER - COMPACT */
.question-number {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: #8B7E74;
    text-transform: uppercase;
    margin-bottom: 8px;
    text-align: center;
}

/* QUESTION TEXT - OPTIMIZED SIZE */
.question-text {
    font-family: 'Cormorant', serif;
    font-size: clamp(22px, 5vw, 28px); /* Responsive but capped */
    font-weight: 600;
    color: #2C2520;
    text-align: center;
    margin-bottom: 16px;
    line-height: 1.3;
    padding: 0 10px;
}

/* ANSWER OPTIONS - OPTIMIZED FOR NO SCROLL */
.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 12px; /* Reduced from 16px */
    flex: 1;
    justify-content: center;
    overflow-y: auto; /* Fallback if absolutely needed */
    -webkit-overflow-scrolling: touch;
    padding: 8px 0;
    min-height: 0; /* Allow shrinking */
}

.quiz-option {
    background: white;
    border: 2px solid #E5E3DF;
    border-radius: 12px;
    padding: 16px 20px; /* Reduced from 20px 24px */
    cursor: pointer;
    transition: all 0.15s ease; /* Fast transition */
    -webkit-tap-highlight-color: rgba(139, 126, 116, 0.1);
    /* Minimum tap target */
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.quiz-option:active {
    transform: scale(0.98);
}

.quiz-option.selected {
    border-color: #8B7E74;
    background: #FFF9F0;
    box-shadow: 0 2px 8px rgba(139, 126, 116, 0.15);
}

.option-icon {
    font-size: 20px; /* Reduced from 24px */
    margin-bottom: 6px; /* Reduced from 8px */
}

.option-text {
    font-family: 'Inter', sans-serif;
    font-size: 15px; /* Reduced from 16px */
    font-weight: 600;
    color: #2C2520;
    margin-bottom: 3px; /* Reduced from 4px */
}

.option-subtext {
    font-family: 'Inter', sans-serif;
    font-size: 13px; /* Reduced from 14px */
    color: #6B645D;
    line-height: 1.4;
}

/* BACK BUTTON - COMPACT */
.quiz-back {
    background: transparent;
    border: none;
    color: #8B7E74;
    font-size: 14px;
    padding: 8px 0;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    text-align: center;
    margin-top: 12px;
}

/* LEAD FORM - COMPACT */
#leadForm {
    display: flex;
    flex-direction: column;
    gap: 12px; /* Reduced from 16px */
    flex: 1;
    justify-content: center;
    padding: 8px 0;
}

.form-group {
    margin: 0;
}

.form-group label {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #2C2520;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 14px 16px; /* Reduced from 16px 18px */
    border: 2px solid #E5E3DF;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    background: white;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #8B7E74;
}

.btn-submit {
    width: 100%;
    background: #2C2520;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 16px;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
}

.btn-submit:active {
    transform: scale(0.98);
}

/* RESPONSIVE - EXTRA SMALL SCREENS */
@media (max-height: 667px) {
    /* iPhone SE, 8, etc - AGGRESSIVE SPACE SAVING */
    .question-text {
        font-size: 20px;
        margin-bottom: 12px;
    }
    
    .quiz-options {
        gap: 10px;
    }
    
    .quiz-option {
        padding: 12px 16px;
        min-height: 54px;
    }
    
    .option-icon {
        font-size: 18px;
        margin-bottom: 4px;
    }
    
    .option-text {
        font-size: 14px;
        margin-bottom: 2px;
    }
    
    .option-subtext {
        font-size: 12px;
    }
}

/* LANDSCAPE MODE - HORIZONTAL LAYOUT */
@media (max-height: 500px) and (orientation: landscape) {
    .quiz-container {
        flex-direction: row;
        gap: 20px;
    }
    
    .quiz-options {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .quiz-option {
        flex: 1 1 calc(50% - 4px);
        min-width: 140px;
    }
}

/* TABLET AND DESKTOP - CENTER CONTENT */
@media (min-width: 768px) {
    .quiz-container {
        max-width: 500px;
        margin: 0 auto;
        padding: 40px 20px;
    }
    
    .question-text {
        font-size: 32px;
    }
    
    .quiz-options {
        gap: 16px;
    }
    
    .quiz-option {
        padding: 20px 24px;
        min-height: 70px;
    }
}

/* HIDE ELEMENTS */
.hidden {
    display: none !important;
}

/* FADE TRANSITIONS */
.fade-in {
    animation: fadeIn 0.15s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ENHANCED TAP TARGETS FOR iOS */
.quiz-option {
    min-height: 64px; /* iOS recommended minimum */
    padding: 18px 20px;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(139, 126, 116, 0.1);
}

.quiz-option:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

.btn-submit,
.quiz-back {
    min-height: 60px;
    touch-action: manipulation;
}

/* Ensure form inputs are tappable */
input[type="email"] {
    min-height: 56px;
    padding: 16px;
    font-size: 16px; /* Prevents iOS zoom */
}

/* Increase button padding on mobile */
@media (max-width: 768px) {
    .quiz-option {
        min-height: 68px;
        padding: 20px;
    }
    
    .btn-submit {
        min-height: 64px;
        padding: 20px 32px;
        font-size: 16px;
    }
}
