@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@700;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

:root {
    --bg-color: #f4f7f6;
    --surface-color: #ffffff;
    --primary-text: #212121;
    --secondary-text: #666666;
    --accent-gradient: linear-gradient(90deg, #0ABAB5, #008B8B);
    --accent-color-1: #0ABAB5;
    --accent-color-2: #008B8B;
    --border-color: #e0e0e0;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --error-color: #dc3545;
    --focus-color: #0ABAB5;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-color);
    color: var(--primary-text);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    line-height: 1.6;
}

/* Survey Container */
.survey-container {
    background: var(--surface-color);
    padding: 40px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 600px;
    position: relative;
    overflow: hidden;
    min-height: 500px;
}

/* Logo */
.logo {
    font-family: 'Montserrat', sans-serif;
    font-weight: 900;
    font-size: 36px;
    text-align: center;
    margin-bottom: 20px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
}

/* Typography */
h2 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 28px;
    margin-bottom: 10px;
    text-align: center;
    line-height: 1.3;
}

p {
    font-size: 16px;
    color: var(--secondary-text);
    margin-bottom: 20px;
    text-align: center;
    line-height: 1.6;
}

p.quote {
    font-style: italic;
    color: var(--primary-text);
    border-left: 3px solid var(--accent-color-1);
    padding-left: 15px;
    margin: 20px auto;
    max-width: 90%;
    text-align: left;
}

/* Persistent Header */
.persistent-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    visibility: hidden;
}

.progress-bar-container {
    width: 100%;
    position: relative;
    background-color: var(--border-color);
    border-radius: 5px;
    height: 12px;
}

.progress-bar {
    background: var(--accent-gradient);
    height: 100%;
    border-radius: 5px;
    transition: width 0.4s ease;
    width: 0%;
}

.progress-text {
    position: absolute;
    width: 100%;
    top: -2px;
    text-align: center;
    line-height: 16px;
    color: var(--primary-text);
    font-size: 12px;
    font-weight: bold;
}

.timer {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--secondary-text);
}

/* Welcome Steps */
.welcome-steps-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 40px 0;
    padding: 0 10px;
    flex-wrap: wrap;
}

.welcome-step {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    flex: 1;
    min-width: 120px;
    position: relative;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.07);
    background: var(--surface-color);
}

.welcome-step + .welcome-step::before {
    content: '›';
    font-size: 28px;
    color: var(--border-color);
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
}

.welcome-step span {
    font-size: 12px;
    color: var(--secondary-text);
    display: block;
}

.welcome-step strong {
    font-size: 14px;
    font-family: 'Montserrat', sans-serif;
    color: var(--primary-text);
    display: block;
    margin-top: 5px;
}

/* Start Button */
#start-btn {
    width: 80%;
    margin: 40px auto 0 auto;
    display: block;
}

/* Requirement Box */
.requirement-box {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin: 30px auto 0 auto;
    max-width: 90%;
}

.requirement-box h3 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    color: var(--primary-text);
    margin-top: 0;
    text-align: center;
}

.requirement-box p {
    font-size: 15px;
    margin-bottom: 0;
    text-align: left;
}

.requirement-box ul {
    text-align: left;
    margin: 15px 0;
    padding-left: 20px;
}

.requirement-box li {
    margin-bottom: 8px;
    color: var(--primary-text);
}

/* Form Elements */
input[type=text], 
input[type=email], 
input[type=tel], 
input[type=date], 
input[type=number], 
input[type=time], 
select {
    width: 100%;
    padding: 15px;
    margin-top: 10px;
    border: 1px solid var(--border-color);
    background-color: #fdfdfd;
    color: var(--primary-text);
    font-size: 16px;
    border-radius: 8px;
    box-sizing: border-box;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    font-family: 'Roboto', sans-serif;
}

input:focus, 
select:focus {
    outline: none;
    border-color: var(--focus-color);
    box-shadow: 0 0 0 3px rgba(10, 186, 181, 0.1);
}

input:invalid {
    border-color: var(--error-color);
}

input:disabled, 
select:disabled {
    background-color: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

input[type=date]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    border-radius: 4px;
    margin-left: 8px;
    opacity: 0.6;
}

/* Buttons */
button {
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.navigation-buttons button, 
.submit-btn {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: none;
}

.navigation-buttons button:hover, 
.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.navigation-buttons button:disabled,
.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.secondary-btn {
    width: 100%;
    background: transparent;
    border: 2px solid var(--accent-color-1);
    color: var(--accent-color-1);
}

.secondary-btn:hover {
    background: var(--accent-color-1);
    color: white;
}

#prev-btn {
    background: #e0e0e0;
    color: #333;
}

#prev-btn:hover {
    background: #d0d0d0;
}

/* Skip Button */
.skip-btn {
    background: #6c757d !important;
    color: white !important;
    font-size: 14px !important;
    padding: 12px 20px !important;
}

.skip-btn:hover {
    background: #5a6268 !important;
}

.link-btn {
    background: none;
    border: none;
    color: var(--secondary-text);
    text-decoration: underline;
    padding: 5px;
    font-size: 14px;
    text-transform: none;
}

/* Physique Options */
.physique-options {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.physique-option {
    cursor: pointer;
    border: 2px solid var(--border-color);
    background-color: var(--surface-color);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    transition: all 0.2s ease-in-out;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1 1 150px;
    max-width: 180px;
    min-width: 140px;
}

.physique-option:hover {
    border-color: var(--accent-color-1);
    transform: translateY(-2px);
}

.physique-option img {
    max-width: 100%;
    height: 150px;
    margin-bottom: 10px;
    display: block;
    object-fit: contain;
}

.physique-option span {
    font-size: 14px;
    color: var(--secondary-text);
    line-height: 1.4;
}

.physique-option input[type="radio"] {
    display: none;
}

.physique-option.selected {
    border-color: var(--accent-color-2);
    box-shadow: 0 0 15px rgba(10, 186, 181, 0.2);
    background-color: #f0fffe;
}

/* Height Container */
.height-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
}

#ft-in-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

#ft-in-container select {
    width: auto;
    min-width: 80px;
    margin-top: 0;
}

/* Unit Switcher */
.unit-switcher {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.unit-switcher input {
    flex: 1;
    margin-top: 0;
}

.unit-switcher span {
    font-weight: 500;
    color: var(--primary-text);
    font-size: 16px;
}

/* Celebration Video */
.celebration-video {
    width: 100%;
    max-width: 400px;
    margin: 0 auto 20px;
    display: block;
    border-radius: 12px;
}

/* Helper Text */
.helper-text {
    font-size: 14px;
    color: var(--secondary-text);
    text-align: left;
    margin-top: 10px;
    padding-left: 5px;
    line-height: 1.5;
}

/* Question Slides */
.question-slide {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
    min-height: 300px;
}

.question-slide.active {
    display: block;
}

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

/* Navigation Buttons */
.navigation-buttons {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 30px;
}

.navigation-buttons button {
    flex: 1;
    max-width: 120px;
}

/* Loading and Success States */
.hidden {
    display: none !important;
}

#loading-spinner {
    border: 4px solid #e0e0e0;
    border-top: 4px solid var(--accent-color-1);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 40px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#success-message {
    text-align: center;
    padding: 40px 20px;
}

#success-message h3 {
    color: var(--success-color);
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    margin-bottom: 15px;
}

/* Email Error Styling */
#emailError {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 8px 12px;
    margin-top: 8px;
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .survey-container {
        padding: 20px;
        margin: 10px;
        width: calc(100% - 20px);
    }

    .logo {
        font-size: 28px;
        margin-bottom: 15px;
    }

    h2 {
        font-size: 24px;
        line-height: 1.2;
    }

    .welcome-steps-container {
        flex-direction: column;
        gap: 15px;
        margin: 20px 0;
    }

    .welcome-step {
        min-width: auto;
        width: 100%;
    }

    .welcome-step + .welcome-step::before {
        display: none;
    }

    .physique-options {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .physique-option {
        max-width: 280px;
        width: 100%;
    }

    .physique-option img {
        height: 120px;
    }

    .navigation-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .navigation-buttons button {
        max-width: none;
        width: 100%;
    }

    #ft-in-container {
        justify-content: center;
    }

    input[type=text], 
    input[type=email], 
    input[type=tel], 
    input[type=date], 
    input[type=number], 
    select {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

@media (max-width: 480px) {
    .survey-container {
        padding: 15px;
    }

    .logo {
        font-size: 24px;
    }

    h2 {
        font-size: 20px;
    }

    p {
        font-size: 14px;
    }

    button {
        padding: 12px 20px;
        font-size: 14px;
    }

    .physique-option img {
        height: 100px;
    }

    .requirement-box {
        padding: 15px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --secondary-text: #000000;
    }

    .physique-option {
        border-width: 3px;
    }

    input, select {
        border-width: 2px;
    }
}

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

    .question-slide {
        animation: none;
    }
}

/* Focus indicators for accessibility */
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 3px solid var(--focus-color);
    outline-offset: 2px;
}

/* Ensure text remains readable */
.physique-option.selected span {
    color: var(--primary-text);
}

/* Loading state styling */
.loading .survey-container {
    pointer-events: none;
    opacity: 0.7;
}

/* Error states */
.field-error {
    border-color: var(--error-color) !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1) !important;
}

.error-message {
    color: var(--error-color);
    font-size: 14px;
    margin-top: 5px;
    display: block;
}

/* Success states */
.field-success {
    border-color: var(--success-color) !important;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1) !important;
}

/* Print styles */
@media print {
    .survey-container {
        box-shadow: none;
        border: 1px solid #000;
    }

    .navigation-buttons,
    .persistent-header {
        display: none;
    }

    .question-slide {
        display: block !important;
        page-break-after: always;
    }
}