/* Smart Centered Design with Elegant UI */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Centralized Color System */
:root {
    /* Primary Color Configuration */
    --primary-hue: 16;        /* Orange hue (change this to change entire theme) */
    --primary-saturation: 100%;
    --primary-lightness: 50%;
    
    /* Primary Color RGB Values (for rgba usage) */
    --primary-rgb: 255, 64, 0;  /* RGB values of primary color */
    
    /* Core Colors */
    --primary: hsl(var(--primary-hue), var(--primary-saturation), var(--primary-lightness));
    --primary-dark: hsl(var(--primary-hue), var(--primary-saturation), 40%);
    --primary-darker: hsl(var(--primary-hue), var(--primary-saturation), 30%);
    --primary-light: hsl(var(--primary-hue), var(--primary-saturation), 60%);
    --primary-lighter: hsl(var(--primary-hue), var(--primary-saturation), 70%);
    
    /* Primary with Alpha */
    --primary-alpha-10: rgba(var(--primary-rgb), 0.1);
    --primary-alpha-20: rgba(var(--primary-rgb), 0.2);
    --primary-alpha-25: rgba(var(--primary-rgb), 0.25);
    --primary-alpha-30: rgba(var(--primary-rgb), 0.3);
    --primary-alpha-35: rgba(var(--primary-rgb), 0.35);
    --primary-alpha-40: rgba(var(--primary-rgb), 0.4);
    --primary-alpha-50: rgba(var(--primary-rgb), 0.5);
    
    /* Neutral Colors */
    --text-primary: #fff;
    --text-muted: #666;
    --text-dim: #444;
    --border-color: #222;
    --border-light: rgba(255, 255, 255, 0.1);
    --border-lighter: rgba(255, 255, 255, 0.08);
    --border-lightest: rgba(255, 255, 255, 0.05);
    
    /* Background Colors */
    --bg-dark: #000;
    --bg-surface: #0a0a0a;
    --bg-elevated: #050505;
    --bg-overlay: rgba(255, 255, 255, 0.02);
    --bg-overlay-hover: rgba(255, 255, 255, 0.03);
    --bg-overlay-active: rgba(255, 255, 255, 0.05);
    
    /* Dynamic Viewport */
    --vh: 1vh;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height */
    overflow: hidden;
    position: relative;
}

.container {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: clamp(16px, 3vh, 24px);
    max-width: 500px;
    margin: 0 auto;
    position: relative;
}

/* Progress Bar - Minimal & Elegant */
.progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border-lightest);
    z-index: 100;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
    box-shadow: 0 0 10px var(--primary-alpha-50);
}

/* Steps - Optimized for No Scroll */
.step {
    display: none;
    width: 100%;
    max-width: 440px;
    animation: fadeInScale 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.step.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 0; /* Important for flex shrinking */
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Question Number - Subtle */
.question-number {
    color: var(--text-dim);
    font-size: clamp(10px, 1.5vh, 11px);
    margin-bottom: clamp(12px, 2vh, 16px);
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: 0.6;
}

/* Questions - Responsive Sizing */
.question {
    font-size: clamp(24px, 4vh, 32px);
    font-weight: 200;
    margin-bottom: clamp(20px, 3.5vh, 32px);
    line-height: 1.2;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

/* Input Groups - Compact */
.input-group {
    margin-bottom: clamp(16px, 2.5vh, 24px);
    position: relative;
}

/* Beautiful Animated Underline */
.input-group::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.input-group:focus-within::after {
    width: 100%;
}

/* Inputs - Clean & Minimal */
input, textarea, select {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: clamp(10px, 1.5vh, 14px) 0;
    font-size: clamp(16px, 2.5vh, 20px);
    font-family: inherit;
    transition: all 0.3s;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-bottom-color: var(--primary);
}

input::placeholder {
    color: var(--text-dim);
    font-weight: 300;
}

/* Phone Group - Compact */
.phone-group {
    display: flex;
    gap: clamp(12px, 2vh, 20px);
    align-items: flex-end;
}

.country-code {
    width: 100px;
    flex-shrink: 0;
    background: transparent;
    color: #888;
    padding-bottom: clamp(10px, 1.5vh, 14px);
    font-size: clamp(14px, 2vh, 16px);
}

.country-code option {
    background: var(--bg-dark);
    color: var(--text-primary);
}

/* Optional Tag - Minimal */
.optional-tag {
    display: inline-block;
    color: var(--text-dim);
    font-size: 10px;
    padding: 2px 8px;
    margin-left: 8px;
    font-weight: 400;
    letter-spacing: 1px;
    opacity: 0.5;
}

/* Social Grid - Compact */
.social-grid {
    display: grid;
    gap: clamp(12px, 2vh, 16px);
}

.social-input {
    display: flex;
    align-items: center;
    gap: 12px;
}

.social-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    opacity: 0.6;
}

/* Navigation - Elegant Buttons */
.navigation {
    display: flex;
    gap: 10px;
    margin-top: clamp(20px, 4vh, 32px);
    align-items: center;
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 24px;
    font-size: clamp(14px, 2vh, 15px);
    font-weight: 400;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
}

/* Elegant Continue Button */
.btn-next {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    flex: 1;
    box-shadow: 0 4px 15px var(--primary-alpha-20);
    position: relative;
    z-index: 1;
}

.btn-next::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    opacity: 0;
    transition: opacity 0.3s;
    z-index: -1;
}

.btn-next:hover::before {
    opacity: 1;
}

.btn-next:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-alpha-30);
}

.btn-next:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px var(--primary-alpha-20);
}

/* Back Button - Minimal */
.btn-back {
    width: 44px;
    height: 44px;
    padding: 0;
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.btn-back:hover {
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-muted);
    background: var(--bg-overlay-hover);
}

/* Skip Button - Ghost Style */
.btn-skip {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-dim);
    flex: 1;
}

.btn-skip:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: var(--bg-overlay-hover);
    color: var(--text-muted);
}

/* Submit Button - Premium Feel */
.btn-submit {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    flex: 1;
    font-weight: 500;
    box-shadow: 0 4px 20px var(--primary-alpha-30);
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { box-shadow: 0 4px 20px var(--primary-alpha-30); }
    50% { box-shadow: 0 4px 25px var(--primary-alpha-40); }
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px var(--primary-alpha-40);
}

/* Textarea - Compact & Clean */
textarea {
    min-height: clamp(80px, 12vh, 120px);
    max-height: clamp(100px, 15vh, 150px);
    resize: none;
    line-height: 1.5;
    padding: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-lightest);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: clamp(14px, 2vh, 16px);
}

textarea::placeholder {
    color: var(--text-muted);
    font-weight: 300;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--primary-alpha-10);
}

/* Context Options - Compact Grid */
.context-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: clamp(16px, 2.5vh, 24px);
}

.context-btn {
    background: var(--bg-overlay);
    border: 1px solid var(--border-lighter);
    color: var(--text-muted);
    padding: clamp(10px, 1.5vh, 14px) 8px;
    border-radius: 12px;
    font-size: clamp(12px, 1.8vh, 14px);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-family: inherit;
}

.context-btn:hover {
    border-color: var(--primary-alpha-30);
    background: var(--primary-alpha-10);
    color: #999;
}

.context-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    font-weight: 500;
    box-shadow: 0 2px 10px var(--primary-alpha-30);
}

/* Success Screen - Centered */
.success-screen {
    display: none;
    text-align: center;
    animation: fadeInScale 0.5s ease-out;
}

.success-screen.show {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.success-icon {
    width: clamp(56px, 8vh, 64px);
    height: clamp(56px, 8vh, 64px);
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    margin-bottom: clamp(20px, 3vh, 28px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(24px, 4vh, 32px);
    color: white;
    box-shadow: 0 4px 20px var(--primary-alpha-30);
    animation: successPulse 0.6s ease-out;
}

@keyframes successPulse {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.download-btn {
    display: inline-block;
    padding: 12px 28px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    text-decoration: none;
    border-radius: 24px;
    font-weight: 400;
    margin-top: clamp(16px, 2.5vh, 24px);
    transition: all 0.3s;
    box-shadow: 0 4px 15px var(--primary-alpha-25);
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-alpha-35);
}

/* Loading State */
.loading {
    display: none;
    text-align: center;
}

.loading.show {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 2px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Mobile Optimizations */
@media (max-width: 480px) {
    .container {
        padding: 16px;
    }
    
    .question {
        font-size: clamp(20px, 5vw, 24px);
    }
    
    input, textarea, select {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .context-options {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .navigation {
        margin-top: clamp(16px, 3vh, 24px);
    }
}

/* Small Height Screens (Landscape phones) */
@media (max-height: 600px) {
    .question-number {
        display: none;
    }
    
    .question {
        font-size: 20px;
        margin-bottom: 16px;
    }
    
    .input-group {
        margin-bottom: 12px;
    }
    
    .navigation {
        margin-top: 16px;
    }
    
    button {
        padding: 10px 20px;
    }
    
    textarea {
        min-height: 60px;
        max-height: 80px;
    }
}

/* Very Small Heights (keyboard open) */
@media (max-height: 450px) {
    .container {
        justify-content: flex-start;
        padding-top: 40px;
    }
    
    .question {
        font-size: 18px;
        margin-bottom: 12px;
    }
    
    .context-options {
        margin-bottom: 12px;
    }
}

/* Smooth animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Accessibility - Focus Visible */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Hide number input spinners */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Prevent text selection on buttons */
button {
    -webkit-user-select: none;
    user-select: none;
}