/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Your brand colors — adjust these */
    --primary: #FF6B35;        /* Warm orange — energy, creativity */
    --primary-dark: #E55A2B;
    --secondary: #1A1A2E;      /* Deep navy — professional */
    --accent: #F7C59F;         /* Soft peach */
    --success: #00C853;
    --error: #FF1744;
    --text: #2D3436;
    --text-light: #636E72;
    --bg: #FAFAFA;
    --card: #FFFFFF;
    --border: #DFE6E9;
    
    /* Spacing scale */
    --space-xs: 0.5rem;
    --space-sm: 0.75rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    
    /* Typography */
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --radius: 12px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    padding: var(--space-md);
}

/* Container — mobile first, max-width for larger screens */
.survey-container {
    max-width: 480px;
    margin: 0 auto;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* Progress Bar */
.progress-bar {
    background: var(--border);
    height: 4px;
    position: relative;
}

.progress-fill {
    background: var(--primary);
    height: 100%;
    width: 20%;
    transition: width 0.3s ease;
}

#stepCounter {
    position: absolute;
    right: var(--space-md);
    top: var(--space-sm);
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Form Steps */
.step {
    display: none;
    padding: var(--space-lg);
    animation: slideIn 0.3s ease;
}

.step.active {
    display: block;
}

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

/* Typography */
h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--space-xs);
    color: var(--secondary);
    line-height: 1.2;
}

.sub {
    color: var(--text-light);
    font-size: 0.875rem;
    margin-bottom: var(--space-lg);
}

/* Form Groups */
.form-group {
    margin-bottom: var(--space-lg);
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
    color: var(--text);
}

label small {
    display: block;
    font-weight: 400;
    color: var(--text-light);
    margin-top: 2px;
    font-size: 0.75rem;
}

/* Inputs */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
select,
textarea {
    width: 100%;
    padding: var(--space-md);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    background: var(--card);
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none; /* Remove iOS default styling */
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255,107,53,0.1);
}

input.error {
    border-color: var(--error);
    background: #FFF5F5;
}

/* Input with prefix (for @handles) */
.input-prefix {
    display: flex;
    align-items: center;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    overflow: hidden;
}

.input-prefix:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255,107,53,0.1);
}

.input-prefix span {
    padding: var(--space-md);
    background: var(--bg);
    color: var(--text-light);
    font-weight: 600;
    border-right: 2px solid var(--border);
}

.input-prefix input {
    border: none;
    box-shadow: none;
    flex: 1;
}

.input-prefix input:focus {
    box-shadow: none;
}

/* Select dropdown arrow */
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23636E72' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 40px;
}

/* Card Select (radio buttons as cards) */
.card-select {
    display: grid;
    gap: var(--space-sm);
}

.card {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    background: var(--card);
}

.card:hover {
    border-color: var(--primary);
    background: #FFF8F5;
}

.card input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.card:has(input:checked) {
    border-color: var(--primary);
    background: #FFF0EB;
    box-shadow: 0 0 0 3px rgba(255,107,53,0.1);
}

/* Card with stacked content */
.card strong {
    display: block;
    font-size: 1rem;
    color: var(--text);
}

.card small {
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 2px;
}

/* Checkbox Group */
.checkbox-group {
    display: grid;
    gap: var(--space-sm);
}

.checkbox-card {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-md);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.checkbox-card:hover {
    border-color: var(--primary);
}

.checkbox-card input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    flex-shrink: 0;
    margin-top: 2px;
}

.checkbox-card span {
    font-size: 0.9375rem;
    line-height: 1.4;
}

.checkbox-card:has(input:checked) {
    border-color: var(--primary);
    background: #FFF0EB;
}

/* Regular checkbox */
.checkbox {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--text-light);
    cursor: pointer;
}

.checkbox input {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    flex-shrink: 0;
    margin-top: 2px;
}

/* Textarea */
textarea {
    min-height: 80px;
    resize: vertical;
}

/* Buttons */
button {
    width: 100%;
    padding: var(--space-md);
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.btn-next,
.btn-submit {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(255,107,53,0.3);
}

.btn-next:hover,
.btn-submit:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(255,107,53,0.4);
}

.btn-next:active,
.btn-submit:active {
    transform: translateY(0);
}

.btn-prev {
    background: var(--bg);
    color: var(--text-light);
    border: 2px solid var(--border);
    margin-bottom: var(--space-sm);
}

.btn-prev:hover {
    background: var(--border);
}

.btn-submit {
    font-size: 1.125rem;
    padding: var(--space-lg);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Navigation buttons container */
.nav-buttons {
    margin-top: var(--space-xl);
}

/* Loading State */
.loading {
    text-align: center;
    padding: var(--space-lg);
    color: var(--text-light);
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: var(--space-sm);
    vertical-align: middle;
}

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

/* Success Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    z-index: 100;
    backdrop-filter: blur(4px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--card);
    border-radius: var(--radius);
    padding: var(--space-xl);
    text-align: center;
    max-width: 360px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-content h2 {
    margin-bottom: var(--space-sm);
}

.coupon-code {
    background: var(--secondary);
    color: var(--accent);
    font-family: 'Courier New', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    padding: var(--space-md);
    border-radius: var(--radius);
    margin: var(--space-lg) 0;
    letter-spacing: 1px;
    word-break: break-all;
}

.expiry {
    color: var(--text-light);
    font-size: 0.875rem;
}

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

/* Terms styling */
.terms {
    background: var(--bg);
    padding: var(--space-md);
    border-radius: var(--radius);
    margin-top: var(--space-lg);
}

/* Mobile Optimizations */
@media (max-width: 380px) {
    html {
        font-size: 15px;
    }
    
    .survey-container {
        border-radius: 0;
        box-shadow: none;
    }
    
    body {
        padding: 0;
        background: var(--card);
    }
    
    .step {
        padding: var(--space-md);
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support (optional, for night scrollers) */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1A1A2E;
        --card: #16213E;
        --text: #E8E8E8;
        --text-light: #A0A0A0;
        --border: #0F3460;
    }
    
    input,
    select,
    textarea {
        background: #0F3460;
        color: var(--text);
        border-color: var(--border);
    }
    
    .btn-prev {
        background: #0F3460;
        color: var(--text);
    }
}
