/**
 * Mobile Flow CSS - My Little Journeys
 * Storybook AI v2.0 - COMPLET avec upload & checkboxes
 */

/* === VARIABLES === */
:root {
    --orange: #FF8C42;
    --orange-dark: #E67A32;
    --orange-light: #FFB67A;
    --cream: #FFF8F0;
    --cream-dark: #F5E6D3;
    --gray-50: #FAFAFA;
    --gray-100: #F5F5F5;
    --gray-200: #EEEEEE;
    --gray-300: #E0E0E0;
    --gray-600: #757575;
    --gray-800: #424242;
    --white: #FFFFFF;
    --text-dark: #2C2416;
    --text-light: #6B5D4F;
    --success: #4CAF50;
    --error: #F44336;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

/* === RESET === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Fredoka', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--gray-50);
    color: var(--text-dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === MOBILE CONTAINER === */
.mobile-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--white);
    position: relative;
}

/* === URGENCY BANNER === */
.urgency-banner {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
    color: var(--white);
    padding: 12px 20px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.urgency-banner strong {
    font-weight: 700;
}

/* === LOGO === */
.logo {
    text-align: center;
    padding: 24px 20px;
}

.logo-text {
    font-size: 32px;
    font-weight: 700;
    color: var(--orange);
    line-height: 1.2;
}

/* === PROGRESS DOTS === */
.progress-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 20px;
}

.progress-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gray-300);
    transition: all 0.3s;
}

.progress-dot.active {
    background: var(--orange);
    width: 24px;
    border-radius: 5px;
}

/* === BACK BUTTON === */
.back-button {
    position: absolute;
    top: 80px;
    left: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--white);
    border: 2px solid var(--gray-300);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    cursor: pointer;
    transition: all 0.3s;
}

.back-button:active {
    transform: scale(0.95);
    border-color: var(--orange);
}

.back-button svg {
    width: 24px;
    height: 24px;
    stroke: var(--gray-800);
    stroke-width: 2;
}

/* === STEP CONTAINER === */
.step {
    display: none;
    padding: 20px;
}

.step.active {
    display: block;
}

.step-content {
    padding-bottom: 100px;
}

/* === MESSAGES === */
.message {
    margin-bottom: 20px;
    padding: 15px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
}

.message-success {
    background: #E8F5E9;
    color: var(--success);
    border-left: 4px solid var(--success);
}

.message-error {
    background: #FFEBEE;
    color: var(--error);
    border-left: 4px solid var(--error);
}

/* === INSTRUCTIONS CONTAINER === */
.instructions-container {
    padding-bottom: 100px;
}

.instructions-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 30px 0 20px 0;
}

.instruction-item {
    background: var(--cream);
    padding: 15px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-dark);
}

/* === PHOTO UPLOAD ZONE === */
.photo-upload-zone {
    width: 100%;
    aspect-ratio: 1;
    background: linear-gradient(135deg, var(--cream) 0%, #FFE8D6 100%);
    border: 3px dashed var(--orange-light);
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.photo-upload-zone.has-photo {
    background: transparent;
    border-style: solid;
    border-color: var(--orange);
}

.photo-upload-zone:active {
    transform: scale(0.98);
    border-color: var(--orange);
}

.photo-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 15px;
}

.photo-icon svg {
    width: 100%;
    height: 100%;
}

.upload-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--orange);
}

/* Image dans la zone de crop */
#crop-image {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    object-fit: contain;
    z-index: 10;
}

#crop-image:active {
    cursor: grabbing;
}

/* Zone avec photo uploadée */
.photo-upload-zone.has-photo {
    border-style: solid;
    border-color: var(--orange);
    background: var(--white);
}

.photo-upload-zone.has-photo .photo-icon,
.photo-upload-zone.has-photo .upload-text {
    display: none;
}

/* Preview image fallback */
.preview-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--radius-lg);
}

/* === CROP CONTROLS === */
#crop-controls {
    margin-top: 15px;
}

.crop-hint {
    text-align: center;
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
}

.crop-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

.crop-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--white);
    border: 2px solid var(--orange);
    color: var(--orange);
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.crop-btn:active {
    transform: scale(0.95);
    background: var(--orange);
    color: var(--white);
}

.crop-reset {
    padding: 10px 20px;
    background: var(--white);
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-md);
    color: var(--gray-800);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.crop-reset:active {
    background: var(--gray-100);
}

/* === LEGAL CONTAINER === */
.legal-container {
    padding-bottom: 100px;
}

/* === CHECKBOXES CUSTOM === */
.checkbox-group {
    margin: 30px 0;
}

.checkbox-wrapper {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    align-items: flex-start;
}

.custom-checkbox {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: 2px solid var(--gray-300);
    border-radius: 8px;
    background: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.custom-checkbox svg {
    width: 18px;
    height: 18px;
    stroke: var(--white);
    stroke-width: 3;
    opacity: 0;
    transition: opacity 0.3s;
}

.custom-checkbox.checked {
    background: var(--orange);
    border-color: var(--orange);
}

.custom-checkbox.checked svg {
    opacity: 1;
}

.custom-checkbox:active {
    transform: scale(0.95);
}

.checkbox-label {
    flex: 1;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-dark);
}

.checkbox-label a {
    color: var(--orange);
    text-decoration: underline;
}

.checkbox-label strong {
    font-weight: 700;
    color: var(--orange-dark);
}

/* === LOADING CONTAINER (STEP 5) === */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: 40px 20px;
}

.loading-logo {
    margin-bottom: 40px;
    animation: pulse 2s ease-in-out infinite;
}

.loading-logo .logo-text {
    font-size: 28px;
    font-weight: 700;
    color: var(--orange);
    line-height: 1.2;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(0.98);
    }
}

.loading-icons {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
}

.loading-icon {
    font-size: 48px;
    animation: bounce 1.5s ease-in-out infinite;
}

.loading-icon:nth-child(1) {
    animation-delay: 0s;
}

.loading-icon:nth-child(2) {
    animation-delay: 0.3s;
}

.loading-icon:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

.loading-text {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 40px;
    line-height: 1.4;
}

.progress-bar {
    width: 100%;
    max-width: 300px;
    height: 12px;
    background: var(--gray-200);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--orange) 0%, var(--orange-light) 100%);
    border-radius: 6px;
    transition: width 0.5s ease;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* === GALLERY (STEP 6) === */
.gallery-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
    text-align: center;
    margin-bottom: 12px;
    line-height: 1.3;
}

.gallery-subtitle {
    font-size: 16px;
    color: var(--text-light);
    text-align: center;
    margin-bottom: 30px;
    line-height: 1.5;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 30px;
}

.gallery-item {
    position: relative;
    aspect-ratio: 3/4;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--gray-100);
    border: 2px solid var(--gray-200);
    transition: all 0.3s;
    cursor: pointer;
}

.gallery-item:active {
    transform: scale(0.98);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-item.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(
        135deg,
        var(--cream) 0%,
        var(--gray-100) 100%
    );
    animation: skeleton 1.5s ease-in-out infinite;
}

@keyframes skeleton {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

.gallery-item.loading::before {
    content: '⏳';
    font-size: 32px;
    opacity: 0.5;
}

.page-number {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-dark);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.gallery-item.loading .page-number {
    bottom: auto;
    top: 8px;
    left: 8px;
    background: var(--orange-light);
    color: var(--white);
}

/* === BOTTOM NAV === */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 480px;
    margin: 0 auto;
    background: var(--white);
    padding: 16px 20px;
    border-top: 1px solid var(--gray-200);
    box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.05);
}

/* === BUTTONS === */
.btn {
    display: block;
    width: 100%;
    padding: 16px 24px;
    border-radius: var(--radius-md);
    font-size: 17px;
    font-weight: 700;
    text-align: center;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--orange) 0%, var(--orange-dark) 100%);
    color: var(--white);
    box-shadow: 0 4px 16px rgba(255, 140, 66, 0.3);
}

.btn-primary:active {
    transform: scale(0.96) translateY(2px);
    box-shadow: 0 2px 6px rgba(255, 140, 66, 0.15);
    background: linear-gradient(135deg, var(--orange-dark) 0%, #d67332 100%);
    filter: brightness(0.95);
}

.btn-primary:disabled {
    background: var(--gray-300);
    color: var(--gray-600);
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
}

.btn-secondary {
    background: var(--white);
    color: var(--orange);
    border: 2px solid var(--orange);
}

.btn-secondary:active {
    background: var(--cream);
}

/* === RESPONSIVE === */
@media (max-width: 380px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .loading-icons {
        gap: 20px;
    }
    
    .loading-icon {
        font-size: 40px;
    }
    
    .logo-text {
        font-size: 28px;
    }
}

/* === SAFE AREA (iPhone notch) === */
@supports (padding: max(0px)) {
    .mobile-container {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .bottom-nav {
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
}

/* === UTILITY CLASSES === */
.text-center {
    text-align: center;
}

.mb-20 {
    margin-bottom: 20px;
}

.mt-20 {
    margin-top: 20px;
}

.hidden {
    display: none !important;
}

/* === FORM STYLES === */
.form-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--orange);
    text-align: left;
    margin-bottom: 10px;
    line-height: 1.2;
}

.form-subtitle {
    font-size: 14px;
    color: var(--gray-600);
    margin-bottom: 30px;
    line-height: 1.5;
}

.form-group {
    margin-bottom: 20px;
}

.form-input,
.form-select {
    width: 100%;
    padding: 16px 20px;
    font-size: 16px;
    font-family: inherit;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    background: var(--white);
    color: var(--text-dark);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.form-input:focus,
.form-select:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(255, 140, 66, 0.15);
}

.form-input::placeholder {
    color: var(--gray-300);
}

.form-input.error {
    border-color: var(--error);
}

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23757575' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.gender-buttons {
    display: flex;
    gap: 12px;
}

.gender-btn {
    flex: 1;
    padding: 14px 20px;
    font-size: 16px;
    font-family: inherit;
    font-weight: 600;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    background: var(--white);
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.gender-btn:hover {
    border-color: var(--orange-light);
}

.gender-btn.active {
    border-color: var(--orange);
    background: var(--orange);
    color: var(--white);
}

.gender-btn:active {
    transform: scale(0.98);
}

/* === MODAL ZOOM === */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    padding: 0;
    overflow-y: auto;
    flex-direction: column;
    align-items: center;
}

.modal.show {
    display: flex !important;
}

.modal-close {
    position: fixed;
    top: 10px;
    right: 10px;
    color: var(--white);
    font-size: 36px;
    font-weight: 700;
    cursor: pointer;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.5);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.modal-content {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0;
    object-fit: contain;
}

.modal-text {
    display: block;
    width: 100%;
    padding: 20px;
    color: var(--white);
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    line-height: 1.5;
    background: rgba(0, 0, 0, 0.8);
}