/* quiz-styles.css - Mobile-First Quiz Experience
   Version 2.0 - Updated with Outfit font and refined aesthetics
*/

/* =================================================================
   QUIZ CONTAINER
   ================================================================= */

.quiz-container {
    min-height: 100vh;
    background: var(--dark);
    position: relative;
    overflow-x: hidden;
}

/* =================================================================
   QUIZ SCREENS - Base Layout
   ================================================================= */

.quiz-screen {
    min-height: 100vh;
    display: none;
    opacity: 0;
}

.quiz-screen.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.4s ease forwards;
}

/* =================================================================
   WELCOME SCREEN
   ================================================================= */

.welcome-content {
    text-align: center;
    max-width: 560px;
    padding: var(--space-6);
    animation: fadeIn 0.6s ease;
}

/* Lab badge */
.welcome-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: rgba(6, 255, 165, 0.08);
    border: 1px solid rgba(6, 255, 165, 0.2);
    border-radius: var(--radius-full);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--accent-green);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--space-6);
}

.badge-dot {
    width: 6px;
    height: 6px;
    background: var(--accent-green);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
    box-shadow: 0 0 8px var(--accent-green);
}

.welcome-title {
    font-family: var(--font-display);
    font-size: clamp(2.25rem, 7vw, 3.5rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: var(--space-4);
    color: var(--white);
    line-height: 1.1;
}

.welcome-title .gradient-text {
    display: block;
}

.welcome-subtitle {
    font-size: clamp(1rem, 2.5vw, var(--text-lg));
    color: var(--gray-400);
    margin-bottom: var(--space-8);
    line-height: 1.5;
}

/* Hook Preview */
.hook-preview {
    background: rgba(30, 58, 95, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-xl);
    padding: var(--space-5) var(--space-6);
    margin-bottom: var(--space-8);
    transition: all var(--transition-base);
    text-align: left;
}

.hook-preview:hover {
    border-color: rgba(6, 255, 165, 0.3);
    background: rgba(30, 58, 95, 0.35);
}

.hook-label {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--space-2);
}

.hook-question {
    font-family: var(--font-display);
    font-size: clamp(1.125rem, 2.5vw, var(--text-xl));
    font-weight: 600;
    color: var(--gray-200);
    line-height: 1.4;
    font-style: italic;
}

/* Start Button */
.start-btn {
    padding: var(--space-4) var(--space-8);
    background: linear-gradient(135deg, var(--accent-green) 0%, #00d68f 100%);
    color: var(--dark);
    border: none;
    border-radius: var(--radius-full);
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 20px rgba(6, 255, 165, 0.35);
    min-height: var(--touch-target);
}

.start-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 30px rgba(6, 255, 165, 0.45);
}

.start-btn:active {
    transform: translateY(-1px) scale(1);
}

.arrow-icon {
    transition: transform var(--transition-base);
}

.start-btn:hover .arrow-icon {
    transform: translateX(4px);
}

/* Trust Badges */
.trust-badges {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-top: var(--space-6);
}

.trust-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--gray-500);
}

.trust-badge svg {
    color: var(--gray-600);
}

/* =================================================================
   QUESTION SCREEN - DESKTOP FIRST (Mobile overrides below)
   ================================================================= */

#question-screen.active {
    padding: 0;
    justify-content: flex-start;
}

/* Quiz Header - Fixed at top */
.quiz-header {
    width: 100%;
    padding: var(--space-4) var(--space-6);
    background: rgba(10, 14, 26, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-sticky);
}

.progress-container {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.progress-info {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    white-space: nowrap;
}

.progress-label {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.progress-count {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--white);
}

.progress-total {
    color: var(--gray-600);
    font-weight: 400;
}

.progress-bar {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-green) 0%, var(--accent-red) 100%);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: var(--radius-full);
    display: block;
}

/* DNA Builder Visual - Desktop Only */
.dna-builder {
    position: fixed;
    right: var(--space-6);
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 350px;
    z-index: var(--z-base);
    pointer-events: none;
}

.dna-strand {
    width: 100%;
    height: 0%;
    background: linear-gradient(180deg, var(--accent-green) 0%, var(--accent-red) 100%);
    border-radius: 30px;
    transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 40px rgba(6, 255, 165, 0.25);
    opacity: 0.5;
}

/* Question Content - Desktop */
.question-content {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: var(--space-8) var(--space-6);
    padding-top: 120px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.question-context {
    margin-bottom: var(--space-4);
}

.dimension-tag {
    display: inline-block;
    padding: var(--space-2) var(--space-4);
    background: rgba(6, 255, 165, 0.08);
    border: 1px solid rgba(6, 255, 165, 0.25);
    border-radius: var(--radius-full);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--accent-green);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

.question-text {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.02em;
    margin-bottom: var(--space-10);
    color: var(--white);
}

.question-text.question-enter {
    animation: questionFadeIn 0.4s ease;
}

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

/* =================================================================
   RESPONSE OPTIONS - DESKTOP
   ================================================================= */

.response-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-bottom: var(--space-8);
}

.response-btn {
    padding: var(--space-4) var(--space-6);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    color: var(--gray-300);
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: var(--touch-target);
    font-size: var(--text-base);
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.response-btn::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: transparent;
    transition: background var(--transition-base);
}

.response-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--white);
    transform: translateX(4px);
}

.response-btn:active {
    transform: translateX(2px);
}

.response-btn.selected {
    background: rgba(6, 255, 165, 0.12);
    border-color: var(--accent-green);
    color: var(--white);
    transform: scale(1.01);
    box-shadow: 0 0 25px rgba(6, 255, 165, 0.15);
}

.response-btn.selected::before {
    background: var(--accent-green);
}

/* Response type specific hover states */
.response-btn.strongly-agree:hover::before {
    background: var(--accent-green);
}

.response-btn.agree:hover::before {
    background: rgba(6, 255, 165, 0.6);
}

.response-btn.neutral:hover::before {
    background: var(--gray-500);
}

.response-btn.disagree:hover::before {
    background: rgba(230, 57, 70, 0.6);
}

.response-btn.strongly-disagree:hover::before {
    background: var(--accent-red);
}

.response-label {
    font-family: var(--font-display);
    font-size: var(--text-base);
    font-weight: 600;
    display: block;
}

/* Keyboard navigation support */
.response-btn:focus-visible {
    outline: 2px solid var(--accent-green);
    outline-offset: 2px;
    z-index: 1;
}

/* =================================================================
   QUIZ CONTROLS
   ================================================================= */

.quiz-controls {
    display: flex;
    gap: var(--space-4);
    justify-content: center;
}

.control-btn {
    padding: var(--space-3) var(--space-5);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    color: var(--gray-400);
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: var(--font-display);
    font-size: var(--text-sm);
    font-weight: 600;
    min-height: var(--touch-target);
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--white);
    border-color: rgba(255, 255, 255, 0.2);
}

.control-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.control-btn.hidden {
    display: none;
}

/* =================================================================
   LOADING SCREEN
   ================================================================= */

.loading-content {
    text-align: center;
    padding: var(--space-6);
}

.dna-animation {
    width: 100px;
    height: 100px;
    margin: 0 auto var(--space-8);
}

/* New helix loader with bars */
.helix-loader {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.helix-bar {
    width: 6px;
    height: 40px;
    background: linear-gradient(180deg, var(--accent-green) 0%, var(--accent-red) 100%);
    border-radius: 3px;
    animation: helixPulse 1.2s ease-in-out infinite;
}

.helix-bar:nth-child(1) { animation-delay: 0s; }
.helix-bar:nth-child(2) { animation-delay: 0.2s; }
.helix-bar:nth-child(3) { animation-delay: 0.4s; }

@keyframes helixPulse {
    0%, 100% {
        transform: scaleY(1);
        opacity: 0.5;
    }
    50% {
        transform: scaleY(1.8);
        opacity: 1;
    }
}

.loading-title {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 700;
    margin-bottom: var(--space-3);
    color: var(--white);
}

.loading-message {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--gray-500);
    transition: opacity 0.3s ease;
}

/* =================================================================
   MOBILE OPTIMIZATIONS
   ================================================================= */

@media (max-width: 767px) {
    /* Hide DNA builder on mobile */
    .dna-builder {
        display: none;
    }
    
    /* iOS Safari viewport height fix */
    html {
        height: -webkit-fill-available;
    }
    
    body {
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }
    
    .quiz-container {
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }
    
    .quiz-screen {
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }
    
    /* Question screen uses natural scroll flow */
    #question-screen.active {
        display: block;
        min-height: 100vh;
        min-height: -webkit-fill-available;
        padding-bottom: 0;
    }
    
    /* Header - compact mobile version */
    .quiz-header {
        padding: var(--space-3) var(--space-4);
        padding-top: max(var(--space-3), env(safe-area-inset-top));
    }
    
    .progress-container {
        gap: var(--space-3);
    }
    
    .progress-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
    }
    
    .progress-label {
        font-size: 0.625rem;
    }
    
    .progress-count {
        font-size: var(--text-sm);
    }
    
    /* Question content flows naturally */
    .question-content {
        padding: var(--space-4);
        padding-top: calc(80px + var(--space-4));
        padding-bottom: var(--space-4);
        min-height: auto;
        width: 100%;
        display: block;
    }
    
    .question-context {
        margin-bottom: var(--space-3);
    }
    
    .dimension-tag {
        font-size: 0.625rem;
        padding: var(--space-1) var(--space-3);
    }
    
    .question-text {
        font-size: 1.375rem;
        margin-bottom: var(--space-6);
        margin-top: var(--space-2);
    }
    
    /* Response options - sticky at bottom */
    .response-options {
        position: sticky;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(10, 14, 26, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid rgba(255, 255, 255, 0.06);
        padding: var(--space-3);
        padding-bottom: max(var(--space-3), env(safe-area-inset-bottom));
        z-index: var(--z-dropdown);
        margin-top: var(--space-6);
        margin-bottom: 0;
        display: flex;
        flex-direction: column;
        gap: var(--space-2);
    }
    
    /* Mobile button styling */
    .response-btn {
        width: 100%;
        padding: var(--space-3) var(--space-4);
        font-size: 0.9375rem;
        border-radius: var(--radius-md);
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 52px;
        transform: none;
        background: rgba(30, 58, 95, 0.3);
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    
    .response-btn:hover {
        transform: none;
    }
    
    .response-btn:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
    
    .response-btn.selected {
        transform: none;
        border-width: 2px;
        background: rgba(6, 255, 165, 0.2);
        border-color: var(--accent-green);
    }
    
    /* Color-coded buttons for mobile */
    .response-btn.strongly-disagree {
        background: rgba(230, 57, 70, 0.12);
        border-color: rgba(230, 57, 70, 0.25);
    }
    
    .response-btn.disagree {
        background: rgba(230, 57, 70, 0.06);
        border-color: rgba(230, 57, 70, 0.15);
    }
    
    .response-btn.neutral {
        background: rgba(156, 163, 175, 0.08);
        border-color: rgba(156, 163, 175, 0.15);
    }
    
    .response-btn.agree {
        background: rgba(6, 255, 165, 0.06);
        border-color: rgba(6, 255, 165, 0.15);
    }
    
    .response-btn.strongly-agree {
        background: rgba(6, 255, 165, 0.12);
        border-color: rgba(6, 255, 165, 0.25);
    }
    
    .response-label {
        font-size: 0.9375rem;
        font-weight: 700;
        text-align: center;
        line-height: 1.3;
    }
    
    /* Quiz controls below response buttons */
    .quiz-controls {
        margin-top: var(--space-3);
        padding-top: var(--space-3);
        border-top: 1px solid rgba(255, 255, 255, 0.06);
    }
    
    .control-btn {
        padding: var(--space-2) var(--space-4);
        font-size: 0.875rem;
        min-height: 44px;
    }
    
    /* Welcome screen mobile adjustments */
    .welcome-content {
        padding: var(--space-4);
        padding-top: var(--space-8);
    }
    
    .welcome-badge {
        margin-bottom: var(--space-4);
    }
    
    .welcome-title {
        font-size: 2rem;
    }
    
    .hook-preview {
        padding: var(--space-4);
        margin-bottom: var(--space-6);
    }
    
    .hook-question {
        font-size: 1.125rem;
    }
    
    .start-btn {
        padding: var(--space-4) var(--space-6);
        font-size: var(--text-base);
        width: 100%;
        max-width: 300px;
    }
    
    .trust-badges {
        gap: var(--space-3);
    }
    
    .trust-badge {
        font-size: var(--text-xs);
    }
}

/* =================================================================
   TABLET BREAKPOINT
   ================================================================= */

@media (min-width: 768px) and (max-width: 1023px) {
    .question-content {
        max-width: 700px;
        padding-left: var(--space-8);
        padding-right: var(--space-8);
    }
    
    .response-options {
        gap: var(--space-3);
    }
    
    .dna-builder {
        right: var(--space-4);
        width: 50px;
        height: 280px;
    }
}

/* =================================================================
   LARGE DESKTOP
   ================================================================= */

@media (min-width: 1440px) {
    .question-content {
        max-width: 900px;
    }
    
    .response-options {
        gap: var(--space-4);
    }
    
    .dna-builder {
        right: var(--space-12);
        width: 70px;
        height: 400px;
    }
}

/* =================================================================
   ACCESSIBILITY & PERFORMANCE
   ================================================================= */

/* High contrast mode support */
@media (prefers-contrast: high) {
    .response-btn {
        border-width: 2px;
    }
    
    .dimension-tag {
        border-width: 2px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .progress-fill,
    .dna-strand,
    .response-btn,
    .start-btn {
        transition: none;
    }
    
    .helix-bar {
        animation: none;
        opacity: 1;
    }
    
    .badge-dot {
        animation: none;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .response-btn {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    
    .response-btn:hover {
        background: rgba(255, 255, 255, 0.03);
        transform: none;
    }
    
    .response-btn:active {
        background: rgba(255, 255, 255, 0.08);
        transform: scale(0.98);
    }
}