/* =====================================================
   AI Selfie Microsite — Figma Design System v2
   ===================================================== */

:root {
    --primary:        #F89F2A; /* Orange from screenshot */
    --primary-dark:   #E08719;
    --primary-light:  #FFF6EB;
    --hero-from:      #1A3D0A;
    --hero-to:        #2D6A12;
    --white:          #FFFFFF;
    --text:           #1A1A1A;
    --text-light:     #666666;
    --text-muted:     #999999;
    --border:         #E8E8E8;
    --input-bg:       #F5F5F5;
    --wa:             #25D366;
    --fb:             #1877F2;
    --error:          #E53935;
    --shadow-sm:      0 2px 8px rgba(0,0,0,.08);
    --shadow-md:      0 8px 24px rgba(0,0,0,.12);
    --shadow-top:     0 -4px 20px rgba(0,0,0,.1);
    --radius-sm:      10px;
    --radius-md:      16px;
    --radius-lg:      24px;
    --radius-pill:    999px;
    --font:           'Noto Sans Devanagari', 'Noto Sans Gurmukhi', 'Inter', system-ui, sans-serif;
    --max-w:          430px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    font-family: var(--font);
    background: #F0F0F0; /* Desktop bg */
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

img { display: block; max-width: 100%; }
a   { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* ── Utility ───────────────────────────────────────── */
.text-primary { color: var(--primary); }
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-2 { margin-top: 16px; }

/* ── Root container ─────────────────────────────────── */
#ms-root {
    position: relative;
    width: 100%;
    max-width: var(--max-w);
    height: 100dvh;
    height: 100vh;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 0 48px rgba(0,0,0,.18);
    overflow: hidden; /* Main container hides outside overflow */
}

/* Base screen style */
.screen {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    background: #fff;
}
.screen.active {
    display: flex;
}

/* The scrollable landing view */
.main-screen {
    overflow-y: hidden; /* Let the inner scrollable-content scroll */
}

/* ══════════════════════════════════════════════════════
   1. LANDING PAGE
   ══════════════════════════════════════════════════════ */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #fff;
    flex-shrink: 0;
}

.lang-switcher {
    display: flex;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
}

.lang-link {
    color: var(--text-muted);
    transition: color .2s;
}

.lang-link.active {
    color: var(--primary);
}

.corn-separator {
    width: 100%;
    background: #fff;
    flex-shrink: 0;
}

.corn-img-placeholder {
    width: 100%;
    height: auto;
    object-fit: contain;
}

/* Scroll area for main page content */
.scrollable-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 20px;
    background: #fff;
}

.hero-text-section {
    padding: 24px 20px;
}

.landing-h1 {
    font-size: 32px;
    line-height: 1.25;
    font-weight: 800;
    color: var(--text);
}

/* Carousel Banner */
.banner-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
    margin-bottom: 24px;
}

.slider-track {
    display: flex;
    transition: transform 0.4s ease-out;
}

.slide {
    flex: 0 0 100%;
    padding: 0 20px;
}

.slide img {
    width: 100%;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    object-fit: cover;
    aspect-ratio: 16/7; /* similar to screenshot */
}

.slider-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}

.slide-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #D9D9D9;
    cursor: pointer;
    transition: background 0.3s;
}

.slide-dot.active {
    background: #1A1A1A;
}

/* Video section */
.video-section-wrap {
    padding: 0 20px 24px;
}

.video-section {
    background: #F3F3F3; /* Grey box */
    border-radius: var(--radius-lg);
    padding: 24px 20px;
}

.section-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 16px;
}

.video-container {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    aspect-ratio: 16/9;
}

.video-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.play-btn {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 60px;
    height: 48px;
    background: rgba(0,0,0,0.6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    backdrop-filter: blur(4px);
}

.play-icon {
    width: 24px;
    height: 24px;
    margin-left: 4px; /* visually center play triangle */
}

/* Bottom CTA & Space */
.bottom-padding {
    height: 90px; /* Space so content isn't under CTA */
}

.cta-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 16px 20px 24px;
    background: linear-gradient(to top, #fff 70%, rgba(255,255,255,0));
    z-index: 10;
}

/* Buttons */
.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    background: var(--primary);
    color: var(--text);
    font-family: var(--font);
    font-size: 20px; /* Big button text like screenshot */
    font-weight: 700;
    border-radius: var(--radius-pill);
    padding: 16px 28px;
    transition: transform .15s, box-shadow .2s;
    box-shadow: 0 4px 16px rgba(248, 159, 42, 0.4);
}

.btn-primary:active {
    transform: scale(.97);
}

.arrow-icon {
    width: 28px;
    height: 28px;
}

/* ══════════════════════════════════════════════════════
   2. OVERLAYS & SHEETS (Form, OTP, Choose)
   ══════════════════════════════════════════════════════ */
.screen-overlay {
    background: transparent;
    pointer-events: none;
    z-index: 100;
}
.screen-overlay.active {
    pointer-events: auto;
}

.overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.3s;
}
.screen-overlay.active .overlay-backdrop {
    opacity: 1;
}

.bottom-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #fff;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 32px 24px;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
    max-height: 90vh;
    overflow-y: auto;
}

.screen-overlay.active .bottom-sheet {
    transform: translateY(0);
}

.sheet-close {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--input-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
}

.sheet-title {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 24px;
    padding-right: 32px;
}

.sheet-subtitle {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 24px;
    line-height: 1.5;
}

/* Form Styles */
.form-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
}

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.input-prefix {
    gap: 4px;
    color: var(--text);
}

.prefix-text {
    font-size: 14px;
    font-weight: 600;
}

.field-input {
    width: 100%;
    padding: 16px 14px 16px 44px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    font-family: inherit;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.field-input.input-with-prefix {
    padding-left: 72px;
}

.field-input:focus {
    border-color: var(--primary);
    background: #fff;
}

.terms-label {
    display: flex;
    gap: 10px;
    cursor: pointer;
    align-items: flex-start;
}
.terms-checkbox {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--primary);
}
.terms-text {
    font-size: 12px;
    color: var(--text-light);
    line-height: 1.4;
}

.error-msg {
    font-size: 13px;
    color: var(--error);
    background: rgba(229,57,53,0.1);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 16px;
    text-align: center;
}

/* OTP text boxes */
.otp-label-text {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}
.otp-row {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
}
.otp-box {
    width: 64px;
    height: 64px;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    outline: none;
}
.otp-box:focus { border-color: var(--primary); background: #fff;}
.resend-row { font-size: 13px; color: var(--text-muted); margin-top: 16px; text-align: center;}
.resend-link { color: var(--primary-dark); font-weight: bold; cursor: pointer; text-decoration: underline;}

/* Choose Options */
.choose-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 8px;
}
.choose-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: #fff;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}
.choose-option:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}
.choose-icon { font-size: 32px; }
.choose-label { font-size: 18px; font-weight: bold; }
.hidden-file-input { display: none; }


/* ══════════════════════════════════════════════════════
   3. OTHER SCREENS (Preview, Loader, Result)
   ══════════════════════════════════════════════════════ */
/* Loading spinner inner */
.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(0,0,0,.15);
    border-top-color: var(--text);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Preview */
#screen-preview { background: #000; }
.preview-screen-inner { display: flex; flex-direction: column; height: 100%; }
.camera-video { flex: 1; width: 100%; object-fit: cover; transform: scaleX(-1); }
.preview-img-wrap { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; background: #111; overflow: hidden; }
.preview-img { width: 100%; height: 100%; object-fit: cover; }
.preview-placeholder { font-size: 64px; opacity: 0.5; position: absolute; }
.preview-title { position: absolute; top: 20px; color: #fff; font-weight: bold; z-index: 2; text-shadow: 0 1px 4px rgba(0,0,0,0.5); }
.preview-action-bar { padding: 24px; background: rgba(0,0,0,0.8); display: flex; gap: 16px; justify-content: center; }
.btn-capture-circle { width: 80px; height: 80px; border-radius: 50%; border: 4px solid #fff; display: flex; align-items: center; justify-content: center; }
.capture-inner { width: 60px; height: 60px; border-radius: 50%; background: #fff; }
.btn-outline { background: transparent; border: 2px solid #fff; color: #fff; padding: 16px; border-radius: var(--radius-pill); font-weight: bold; flex: 1; text-align: center; }
.btn-half { flex: 1; }

/* Loader Screen */
#screen-loader {
    align-items: center;
    justify-content: center;
    background: #fff;
}
.loader-content { text-align: center; padding: 32px; }
.loader-brand .loader-img-anim { 
    width: 120px; 
    height: auto; 
    margin-bottom: 24px;
    animation: loaderPulse 2s ease-in-out infinite;
}
@keyframes loaderPulse {
    0% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(248,159,42,0)); }
    50% { transform: scale(1.1); filter: drop-shadow(0 0 20px rgba(248,159,42,0.4)); }
    100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(248,159,42,0)); }
}
.loader-progress-wrap { width: 240px; height: 8px; background: var(--input-bg); border-radius: 4px; overflow: hidden; margin: 0 auto; }
.loader-progress-bar { height: 100%; width: 0%; background: var(--primary); transition: width 0.3s; animation: loaderAnim 4s ease-in-out infinite;}
@keyframes loaderAnim { 0% {width: 0%;} 50% {width: 70%;} 100% {width: 95%;} }
.loader-text { font-size: 20px; font-weight: bold; margin-top: 24px; }
.loader-dots { display: flex; justify-content: center; gap: 8px; margin-top: 16px;}
.loader-dots .dot { width: 12px; height: 12px; background: var(--border); border-radius: 50%; animation: pulse 1s infinite; }
.loader-dots .dot:nth-child(2) { animation-delay: 0.2s;}
.loader-dots .dot:nth-child(3) { animation-delay: 0.4s;}
@keyframes pulse { 50% { background: var(--primary); transform: scale(1.2);} }

/* Result */
.result-screen { overflow-y: auto; }
.result-img-wrap { width: 100%; aspect-ratio: 1; background: #eee; }
.result-img { width: 100%; height: 100%; object-fit: cover; }
.feedback-row { display: flex; gap: 16px; padding: 24px 20px 12px; justify-content: center; }
.feedback-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px; background: var(--input-bg); border-radius: var(--radius-pill); font-weight: bold; font-size: 15px; border: 1.5px solid var(--border); transition: all 0.2s; }
.feedback-btn.active-like { background: rgba(37,211,102,0.1); border-color: var(--wa); color: var(--wa); }
.feedback-btn.active-dislike { background: rgba(229,57,53,0.1); border-color: var(--error); color: var(--error); }
.result-actions-grid { display: flex; gap: 12px; padding: 12px 20px; }
.btn-action { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 16px; background: var(--input-bg); border-radius: var(--radius-sm); font-weight: 600;}
.share-prompt { text-align: center; padding: 16px 20px; font-weight: bold; line-height: 1.4; }
.share-buttons { display: flex; gap: 12px; padding: 12px 20px 48px;}
.btn-share { flex: 1; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 16px; border-radius: var(--radius-pill); color: #fff; font-weight: bold; font-size: 16px; }
.btn-wa { background: var(--wa); }
.btn-fb { background: var(--fb); }

/* Desktop centering helpers */
@media (min-width: 480px) {
    #ms-root {
        left: 50%;
        transform: translateX(-50%);
        position: fixed;
        top: 0;
        bottom: 0;
    }
}
