/* ========================================
   DLS Façade - Simulateur ITE
   Design System Premium - Compact Version
   Target: 500px width, 700px height
   ======================================== */

:root {
    /* Colors - DLS Brand */
    --primary: #7C3AED;
    --primary-dark: #6D28D9;
    --primary-light: #A78BFA;
    --secondary: #1F2937;
    --secondary-light: #374151;
    --accent: #F9FAFB;
    --white: #FFFFFF;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --error: #EF4444;
    --success: #10B981;

    /* Typography - Compact */
    --font-heading: 'Poppins', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Spacing - Reduced for compact layout */
    --space-xs: 0.25rem;
    --space-sm: 0.375rem;
    --space-md: 0.75rem;
    --space-lg: 1rem;
    --space-xl: 1.25rem;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-body);
    background: linear-gradient(135deg, #EDE9FE 0%, #F3E8FF 50%, #FCE7F3 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-sm);
}

/* App Wrapper */
.app-wrapper {
    width: 100%;
    max-width: 500px;
    min-width: 320px;
    max-height: 700px;
    display: flex;
    flex-direction: column;
}

/* Simulator Container */
.simulator-container {
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: calc(700px - 28px);
    /* Leave room for footer */
}

/* Header - Compact */
.simulator-header {
    padding: var(--space-md) var(--space-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    border-bottom: 1px solid var(--gray-200);
    flex-shrink: 0;
}

.header-top {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 2px;
    background: none;
    border: none;
    color: var(--gray-500);
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    padding: var(--space-xs);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.btn-back:hover {
    color: var(--primary);
    background: var(--gray-100);
}

.btn-back svg {
    width: 18px;
    height: 18px;
}

.progress-container {
    width: 100%;
    height: 4px;
    background: var(--gray-200);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 14.28%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 2px;
    transition: width var(--transition-base);
}

.step-indicator {
    font-size: 0.75rem;
    color: var(--gray-500);
    font-weight: 500;
}

/* Header Hidden State */
.simulator-header.hidden {
    display: none;
}

/* Welcome Screen (Step 0) */
.welcome-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-xl) 0;
    min-height: 300px;
}

.welcome-icon {
    font-size: 3.5rem;
    margin-bottom: var(--space-md);
    line-height: 1;
}

.welcome-content h2 {
    font-size: 1.25rem;
    margin-bottom: var(--space-sm);
}

.welcome-content .step-subtitle {
    margin-bottom: var(--space-xl);
    color: var(--gray-500);
}

.welcome-content .btn-submit {
    max-width: 280px;
}

/* Main Content - Scrollable */
.simulator-main {
    padding: var(--space-lg);
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Steps */
.step {
    display: none;
    animation: fadeIn var(--transition-base);
}

.step.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Headings - Compact */
h2 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: var(--space-sm);
    line-height: 1.3;
}

.step-subtitle {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-bottom: var(--space-md);
}

/* Options Grid - Compact 2x2 */
.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
}

/* Option Cards - Compact */
.option-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-sm) var(--space-md);
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
    min-height: 75px;
}

.option-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.option-card.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.05), rgba(167, 139, 250, 0.1));
}

.option-icon {
    font-size: 1.5rem;
    margin-bottom: var(--space-xs);
    line-height: 1;
}

.option-title {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--secondary);
    margin-bottom: 2px;
    line-height: 1.2;
}

.option-desc {
    font-size: 0.7rem;
    color: var(--gray-500);
    line-height: 1.3;
}

/* Option Card Wrapper */
.option-card-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.option-card-wrapper .option-card {
    flex: 1;
    width: 100%;
}

/* Form Groups - Compact */
.form-group {
    margin-bottom: var(--space-md);
}

.form-group label {
    display: block;
    font-weight: 500;
    color: var(--secondary);
    margin-bottom: var(--space-xs);
    font-size: 0.8rem;
}

.form-group input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-family: var(--font-body);
    transition: border-color var(--transition-fast);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group input::placeholder {
    color: var(--gray-400);
}

.input-hint {
    display: block;
    font-size: 0.7rem;
    color: var(--gray-400);
    margin-top: 2px;
}

.error-message {
    display: block;
    font-size: 0.7rem;
    color: var(--error);
    margin-top: 2px;
    min-height: 1em;
}

/* Toggle - Compact */
.toggle-container {
    margin-bottom: var(--space-sm);
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--gray-500);
}

.toggle-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

/* Buttons - Compact but touchable */
.btn-next,
.btn-submit {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    min-height: 44px;
}

.btn-next:hover,
.btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(124, 58, 237, 0.3);
}

.btn-submit {
    background: linear-gradient(135deg, var(--success), #059669);
}

.btn-submit:hover {
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3);
}

.btn-next:disabled,
.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Disqualified Screen */
.disqualified .disqualified-content {
    text-align: center;
    padding: var(--space-lg) 0;
}

.disqualified-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: var(--space-md);
}

.disqualified h2 {
    color: var(--gray-500);
}

.disqualified p {
    color: var(--gray-500);
    line-height: 1.5;
    margin-bottom: var(--space-sm);
    font-size: 0.875rem;
}

/* Success Screen */
.success .success-content {
    text-align: center;
    padding: var(--space-lg) 0;
}

.success-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: var(--space-md);
}

.success h2 {
    color: var(--success);
}

.success p {
    color: var(--gray-500);
    line-height: 1.5;
    font-size: 0.875rem;
}

/* Loading State */
.btn-submit.loading {
    position: relative;
    color: transparent;
}

.btn-submit.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Footer - Compact */
.simulator-footer {
    background: #6e0282;
    color: var(--white);
    text-align: center;
    padding: var(--space-xs) var(--space-sm);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.75rem;
    border-bottom-left-radius: var(--radius-xl);
    border-bottom-right-radius: var(--radius-xl);
    width: 100%;
    flex-shrink: 0;
}

/* Split Column (Step 5) - Compact */
.split-column {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    height: 100%;
}

.half-height {
    flex: 1;
    min-height: 0;
    padding: var(--space-xs);
    justify-content: center;
    min-height: 38px;
    display: flex;
    align-items: center;
}

.half-height .option-title {
    margin-bottom: 0;
    font-size: 0.75rem;
    line-height: 1.2;
}

/* Styled Input for Autre Swap */
#autreInputStep5 {
    height: 38px;
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.8rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    width: 100%;
    margin-top: 0 !important;
    box-sizing: border-box;
    font-family: var(--font-body);
}

#autreInputStep5:focus {
    border-color: var(--primary);
    outline: none;
}

/* Form Row (Step 7) */
.form-row {
    display: flex;
    gap: var(--space-sm);
}

.half-width {
    flex: 1;
    width: 50%;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .app-wrapper {
        max-height: none;
    }

    .simulator-container {
        max-height: none;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }

    .simulator-footer {
        border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    .option-card {
        min-height: 70px;
        flex-direction: column;
        gap: var(--space-xs);
        text-align: center;
    }

    .option-icon {
        font-size: 1.25rem;
        margin-bottom: var(--space-xs);
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .half-width {
        width: 100%;
    }
}