﻿:root {
    --blue: #0072bc;
    --blue-soft: #eef7ff;
    --red: #e30613;
    --red-soft: #fff1f2;
    --glass: rgba(255, 255, 255, 0.7);
    --shadow: 0 20px 40px rgba(0,0,0,0.08);
    --shadow-hover: 0 30px 60px rgba(0,0,0,0.12);
}

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

html {
    overflow-x: hidden; /* moved here so iOS Safari body-scroll isn't blocked */
    height: -webkit-fill-available;
}

body {
    font-family: 'Tajawal', sans-serif;
    background: #fff;
    color: #2d3436;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    -webkit-overflow-scrolling: touch;
}

/* ===================== LANGUAGE SWITCHER ===================== */

.lang-switcher {
    position: fixed;
    top: 20px;
    left: 24px;
    z-index: 500;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 50px;
    padding: 10px 18px 10px 14px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: all 0.25s ease;
    color: #2d3436;
}
.lang-btn:hover {
    background: white;
    box-shadow: 0 6px 28px rgba(0,0,0,0.13);
    transform: translateY(-1px);
}
.lang-btn:active { transform: scale(0.97); }

.lang-icon {
    width: 18px;
    height: 18px;
    color: #0072bc;
    flex-shrink: 0;
}

.lang-label {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.8rem;
    background: linear-gradient(135deg, #0072bc, #e30613);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.5px;
}

.lang-current {
    font-family: 'Tajawal', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
    border-right: 1px solid rgba(0,0,0,0.12);
    padding-right: 10px;
    margin-right: 2px;
}

/* ===================== HERO HEADER ===================== */

.hero-header {
    position: absolute;
    top: 12%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    pointer-events: none;
    white-space: nowrap;
}

.hero-title {
    font-family: 'Tajawal', sans-serif;
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    font-weight: 900;
    color: #1a1a2e;
    margin: 0 0 6px;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 12px;
    text-shadow: 0 2px 20px rgba(255,255,255,0.8);
}

.hero-sparkle {
    font-size: 0.75em;
    background: linear-gradient(135deg, #0072bc, #e30613);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: sparkle-pulse 2.5s ease-in-out infinite;
}
.hero-sparkle:last-child { animation-delay: 1.25s; }

@keyframes sparkle-pulse {
    0%, 100% { opacity: 1; transform: scale(1) rotate(0deg); }
    50%       { opacity: 0.6; transform: scale(1.3) rotate(20deg); }
}

.hero-sub {
    font-family: 'Tajawal', sans-serif;
    font-size: clamp(0.85rem, 1.5vw, 1rem);
    font-weight: 400;
    color: #555;
    margin: 0;
    letter-spacing: 0.02em;
    text-shadow: 0 1px 10px rgba(255,255,255,0.9);
}

/* ===================== LANDING PAGE ===================== */

.landing-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
    min-height: 100svh;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.blob {
    position: absolute;
    filter: blur(80px);
    z-index: 0;
    opacity: 0.4;
    border-radius: 50%;
}
.blob-1 { width: 600px; height: 600px; background: var(--blue-soft); top: -200px; right: -100px; }
.blob-2 { width: 600px; height: 600px; background: var(--red-soft); bottom: -200px; left: -100px; }

.brand-section {
    flex: 1;
    min-height: 100vh;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    padding: 60px 40px;
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.gerber {
    background: linear-gradient(135deg, rgba(255,255,255,0.8) 0%, rgba(240,249,255,0.9) 100%), url('/images/gerber-bg.png') center/cover no-repeat;
}
.cerelac {
    background: linear-gradient(135deg, rgba(255,255,255,0.8) 0%, rgba(255,245,246,0.9) 100%), url('/images/cerelac-bg.png') center/cover no-repeat;
}

.content-wrapper {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.brand-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 40px;
}

.logo-box {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 180px;
}

.brand-logo-img {
    height: 100%;
    width: auto;
    object-fit: contain;
}

.hero-layout {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cards-side {
    display: flex;
    flex-direction: row;
    gap: 30px;
    justify-content: center;
    width: 100%;
}

.baby-card {
    background: var(--glass);
    backdrop-filter: blur(12px);
    border-radius: 30px;
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255,255,255,0.5);
    transition: all 0.4s ease;
    cursor: pointer;
    position: relative;
}

.baby-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: var(--shadow-hover);
}

.card-label {
    font-family: 'Outfit';
    font-weight: 800;
    color: var(--blue);
    font-size: 1.1rem;
    margin-top: 12px;
    text-align: center;
}
.pink .card-label { color: var(--red); }

.image-frame {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    aspect-ratio: 3 / 4;
    background: #eee;
}
.image-frame img { width: 100%; height: 100%; object-fit: cover; }

.heart {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* ===================== FEATURES BAR ===================== */

.features-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(255,255,255,0.9);
    padding: 14px 40px;
    box-shadow: 0 -4px 30px rgba(0,0,0,0.06);
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    justify-content: center;
    padding: 6px 20px;
}

.feature-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    color: #0072bc;
    stroke-width: 1.8;
}

.feature-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.feature-title {
    font-family: 'Tajawal', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1;
}

.feature-desc {
    font-family: 'Tajawal', sans-serif;
    font-size: 0.78rem;
    color: #777;
    line-height: 1;
}

.feature-divider {
    width: 1px;
    height: 36px;
    background: rgba(0,0,0,0.1);
    flex-shrink: 0;
}

/* ===================== CAMERA MODAL ===================== */

/*
 * Layout: flex column fills fixed overlay.
 * Viewfinder: flex:1 + min-height:0 → fills remaining space, never overflows.
 */

.camera-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: #000;
}
.camera-modal.active {
    display: flex;
    flex-direction: column;
}

.cam-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding-top:    env(safe-area-inset-top,    0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left:   env(safe-area-inset-left,   0px);
    padding-right:  env(safe-area-inset-right,  0px);
}

.cam-screen {
    display: none;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}
.cam-screen.active { display: flex; }

.cam-bg-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.5;
}
.cam-glow-blue { width: 500px; height: 500px; background: rgba(0,114,188,0.15); top: -150px; right: -100px; }
.cam-glow-red  { width: 400px; height: 400px; background: rgba(227,6,19,0.12);  bottom: -100px; left: -80px; }

.back-cam-btn {
    position: absolute;
    right: 0;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.12);
    color: #fff;
    padding: 9px 18px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-family: 'Tajawal', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    white-space: nowrap;
}
.back-cam-btn:hover { background: rgba(255,255,255,0.2); }

.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

/* ══ SCREEN 1 — Live Camera ══ */
#screen-camera {
    background: radial-gradient(circle at center, #0f172a 0%, #020617 100%);
    position: relative;
}

.cam-top-bar {
    flex: 0 0 auto;
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 20px 10px;
}

.cam-brand-logo {
    height: clamp(40px, 9vh, 88px);
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 3px 12px rgba(255,255,255,0.35));
}

/* KEY: fills all remaining height, never overflows */
.cam-viewfinder {
    flex: 1;
    min-height: 0;
    position: relative;
    z-index: 2;
    overflow: hidden;
    margin: 0 16px;
    border-radius: 16px;
    background: #000;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.12), 0 20px 60px rgba(0,0,0,0.7);
}

#video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.vf-corner {
    position: absolute;
    width: 36px; height: 36px;
    z-index: 5;
    pointer-events: none;
    border-color: rgba(255,255,255,0.75);
    border-style: solid;
    border-width: 0;
}
.vf-tl { top: 18px;    left: 18px;    border-top-width: 2.5px;    border-left-width: 2.5px;   border-radius: 10px 0 0 0; }
.vf-tr { top: 18px;    right: 18px;   border-top-width: 2.5px;    border-right-width: 2.5px;  border-radius: 0 10px 0 0; }
.vf-bl { bottom: 18px; left: 18px;    border-bottom-width: 2.5px; border-left-width: 2.5px;   border-radius: 0 0 0 10px; }
.vf-br { bottom: 18px; right: 18px;   border-bottom-width: 2.5px; border-right-width: 2.5px;  border-radius: 0 0 10px 0; }

.vf-scan-line {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 3px;
    background: linear-gradient(90deg, transparent, rgba(0,114,188,0.8), rgba(227,6,19,0.8), transparent);
    box-shadow: 0 0 16px rgba(255,255,255,0.4);
    z-index: 6;
    animation: scanLine 3s ease-in-out infinite;
    pointer-events: none;
}
@keyframes scanLine {
    0%   { top: 0%;   opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

.vf-hint {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'Tajawal', sans-serif;
    padding: 7px 20px;
    border-radius: 30px;
    border: 1px solid rgba(255,255,255,0.2);
    white-space: nowrap;
    z-index: 5;
}

.countdown-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(80px, 20vmin, 160px);
    font-weight: 900;
    font-family: 'Outfit', sans-serif;
    color: white;
    text-shadow: 0 0 60px rgba(0,114,188,0.8);
    z-index: 10;
    pointer-events: none;
    opacity: 0;
}
.countdown-overlay.active { animation: countPop 0.9s ease-out forwards; }
@keyframes countPop {
    0%   { opacity: 0; transform: scale(1.6); }
    25%  { opacity: 1; transform: scale(1.05); }
    75%  { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.85); }
}

.cam-viewfinder.flash::after {
    content: '';
    position: absolute;
    inset: 0;
    background: white;
    z-index: 20;
    animation: flashAnim 0.4s ease-out forwards;
    pointer-events: none;
}
@keyframes flashAnim { 0% { opacity: 1; } 100% { opacity: 0; } }

.cam-bottom {
    flex: 0 0 auto;
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 12px 20px 16px;
}

.cam-instruction {
    color: rgba(255,255,255,0.7);
    font-size: clamp(0.8rem, 2vw, 0.95rem);
    font-family: 'Tajawal', sans-serif;
    margin: 0;
    text-align: center;
}

.shutter-btn {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s;
    width: clamp(60px, 9vh, 80px);
    height: clamp(60px, 9vh, 80px);
}
.shutter-btn:hover  { transform: scale(1.05); }
.shutter-btn:active { transform: scale(0.95); }
.shutter-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.shutter-ring {
    width: 100%; height: 100%;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.shutter-circle {
    width: 72%; height: 72%;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.15s, background 0.2s;
}
.shutter-btn:active .shutter-circle { transform: scale(0.9); background: #ddd; }


/* ══ SCREEN 2 — Confirm Photo ══ */
#screen-confirm {
    background: radial-gradient(circle at center, #0f172a 0%, #020617 100%);
    position: relative;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.confirm-top {
    flex: 0 0 auto;
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 20px 10px;
}

.confirm-body {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 20px;
    overflow: hidden;
    position: relative;
    z-index: 2;
}

.confirm-img-wrap {
    position: relative;
    max-height: 100%;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-img {
    display: block;
    max-height: 100%;
    max-width: 100%;
    width: auto;
    height: auto;
    border-radius: 14px;
    object-fit: contain;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

.confirm-img-wrap .vf-corner { border-color: rgba(255,255,255,0.5); }

.confirm-bottom {
    flex: 0 0 auto;
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 20px 16px;
    text-align: center;
}

.confirm-title {
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    font-weight: 800;
    color: #fff;
    font-family: 'Tajawal', sans-serif;
    margin: 0;
}
.confirm-sub {
    font-size: clamp(0.8rem, 1.8vw, 0.95rem);
    color: rgba(255,255,255,0.65);
    font-family: 'Tajawal', sans-serif;
    margin: 0;
}

.confirm-actions {
    display: flex;
    gap: 12px;
    width: 100%;
    max-width: 500px;
    margin-top: 6px;
}

.btn-retake {
    flex: 1;
    padding: 14px 16px;
    border-radius: 50px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-size: clamp(0.85rem, 2vw, 1rem);
    font-family: 'Tajawal', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.btn-retake:hover { background: rgba(255,255,255,0.18); }

.btn-use {
    flex: 2;
    padding: 14px 16px;
    border-radius: 50px;
    border: none;
    background: linear-gradient(135deg, #0072bc, #005fa0);
    color: white;
    font-size: clamp(0.85rem, 2vw, 1rem);
    font-family: 'Tajawal', sans-serif;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(0,114,188,0.4);
    transition: transform 0.15s, box-shadow 0.15s;
}
.btn-use:hover  { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0,114,188,0.5); }
.btn-use:active { transform: scale(0.97); }


/* ══ SCREEN 3 — Loading ══ */
#screen-loading {
    background: linear-gradient(160deg, #dff0ff 0%, #f5f0ff 50%, #ffe0eb 100%);
    align-items: center;
    justify-content: flex-start;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

.ld-deco {
    position: absolute;
    font-size: 1.4rem;
    opacity: 0.3;
    animation: ldFloat 5s ease-in-out infinite;
    pointer-events: none;
    user-select: none;
}
.ld-d1 { top: 8%;  left: 8%;  color: #0072bc; animation-delay: 0s;   font-size: 1.6rem; }
.ld-d2 { top: 20%; left: 5%;  color: #e30613; animation-delay: 1s;   font-size: 1.2rem; }
.ld-d3 { top: 55%; left: 4%;  color: #0072bc; animation-delay: 2.5s; font-size: 1rem;   }
.ld-d4 { top: 80%; left: 10%; color: #e30613; animation-delay: 0.5s; font-size: 1.8rem; }
.ld-d5 { top: 8%;  right: 8%; color: #e30613; animation-delay: 1.5s; font-size: 1.6rem; }
.ld-d6 { top: 25%; right: 5%; color: #0072bc; animation-delay: 0.8s; font-size: 1.2rem; }
.ld-d7 { top: 60%; right: 4%; color: #e30613; animation-delay: 2s;   font-size: 1rem;   }
.ld-d8 { top: 78%; right: 9%; color: #0072bc; animation-delay: 3s;   font-size: 1.8rem; }
@keyframes ldFloat {
    0%,100% { transform: translateY(0) rotate(0deg); }
    50%      { transform: translateY(-14px) rotate(15deg); }
}

.loading-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    text-align: center;
    padding: 28px 20px;
    width: 100%;
    max-width: 480px;
    margin: auto;
}

.loading-ring {
    position: relative;
    width: clamp(100px, 18vmin, 150px);
    height: clamp(100px, 18vmin, 150px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.ring-svg { position: absolute; inset: 0; width: 100%; height: 100%; animation: rotateSvg 2.5s linear infinite; }
@keyframes rotateSvg { to { transform: rotate(360deg); } }
.ring-track    { fill: none; stroke: rgba(0,114,188,0.12); stroke-width: 7; }
.ring-progress { fill: none; stroke: url(#ringGrad); stroke-width: 7; stroke-linecap: round; stroke-dasharray: 260; stroke-dashoffset: 70; }
.ring-emoji { font-size: clamp(2.2rem, 5vmin, 3.8rem); animation: emojiPulse 2s ease-in-out infinite; }
@keyframes emojiPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.1); } }

.loading-title {
    font-size: clamp(1.4rem, 3.5vw, 2rem);
    font-weight: 900;
    color: #1a1a2e;
    font-family: 'Tajawal', sans-serif;
    line-height: 1.2;
    margin: 0;
}
.loading-sub {
    font-size: clamp(0.82rem, 1.8vw, 0.95rem);
    color: #6b7280;
    font-family: 'Tajawal', sans-serif;
    margin: 0;
}

.dots-anim span { display: inline-block; animation: dotBlink 1.4s ease-in-out infinite; color: #0072bc; }
.dots-anim span:nth-child(2) { animation-delay: 0.2s; }
.dots-anim span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotBlink { 0%,80%,100% { opacity: 0; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-5px); } }

.loading-steps-card {
    background: white;
    border-radius: 20px;
    padding: 4px 0 12px;
    width: 100%;
    box-shadow: 0 6px 30px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
}
.lstep {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    gap: 10px;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.95rem;
    color: #b0bec5;
    border-radius: 12px;
    margin: 2px 6px;
    transition: background 0.4s, color 0.4s;
}
.lstep span { flex: 1; text-align: center; }

.lstep-ico { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #e0e0e0; flex-shrink: 0; display: flex; align-items: center; justify-content: center; transition: all 0.4s; background: white; }
.lstep.done { color: #546e7a; }
.lstep.done .lstep-ico { border-color: #0072bc; background: #0072bc; }
.lstep.done .lstep-ico::after { content: ''; width: 9px; height: 5px; border-left: 2px solid white; border-bottom: 2px solid white; transform: rotate(-45deg) translateY(-1px); display: block; }
.lstep.active { background: linear-gradient(135deg, #dff0ff, #f5f0ff); color: #1a1a2e; font-weight: 700; }
.lstep.active .lstep-ico { border-color: #0072bc; border-top-color: transparent; animation: spinStep 0.8s linear infinite; }
@keyframes spinStep { to { transform: rotate(360deg); } }

.lstep-note { font-family: 'Outfit', sans-serif; font-size: 0.75rem; color: #9e9e9e; text-align: center; margin: 6px 0 2px; padding: 0 14px; }

.load-privacy { display: flex; align-items: center; gap: 8px; background: rgba(0,114,188,0.08); border: 1px solid rgba(0,114,188,0.15); border-radius: 50px; padding: 9px 18px; font-family: 'Tajawal', sans-serif; font-size: 0.85rem; color: #0072bc; font-weight: 600; }


/* ===================== RESULT PAGE ===================== */

.result-page {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    background: #f0f4f8;
    animation: resultFadeIn 0.3s ease-out forwards;
}
@keyframes resultFadeIn { from { opacity: 0; } to { opacity: 1; } }

.res-deco { position: absolute; pointer-events: none; user-select: none; animation: resFloat 6s ease-in-out infinite; opacity: 0.15; font-size: 2rem; z-index: 1; }
.res-d1 { top: 6%;    left: 4%;   animation-delay: 0s; }
.res-d2 { top: 12%;   right: 6%;  animation-delay: 1.2s; font-size: 1.5rem; }
.res-d3 { bottom: 8%; left: 6%;   animation-delay: 2s;   font-size: 1.2rem; }
.res-d4 { bottom: 12%;right: 4%;  animation-delay: 0.8s; font-size: 1.6rem; }
@keyframes resFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }

/* Two-column grid — desktop default */
.result-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    position: relative;
    z-index: 2;
    direction: ltr;
}

.result-image-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111;
    overflow: hidden;
    padding: clamp(12px, 2.5vw, 40px);
}

.result-img-card {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.result-canvas-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#result-canvas {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
    animation: popImage 0.5s cubic-bezier(0.16,1,0.3,1) 0.1s both;
}
@keyframes popImage { from { transform: scale(0.9) translateY(16px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }

.canvas-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.5); color: #fff; font-family: 'Tajawal', sans-serif; font-size: 1rem; font-weight: 600; }

.result-action-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    direction: rtl;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    gap: clamp(12px, 1.8vh, 20px);
    padding: clamp(20px, 4vh, 48px) clamp(20px, 4vw, 56px);
    padding-bottom: max(clamp(20px, 4vh, 48px), env(safe-area-inset-bottom, 16px));
    background: white;
}

.res-corner-logo { height: clamp(32px, 5vh, 52px); width: auto; object-fit: contain; flex-shrink: 0; }

.result-title {
    font-family: 'Tajawal', sans-serif;
    font-size: clamp(2rem, 4.5vw, 3.6rem);
    font-weight: 900;
    margin: 0;
    text-align: center;
    line-height: 1.1;
    background: linear-gradient(135deg, #0077b6 0%, #e30613 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    flex-shrink: 0;
}

.result-subtitle { font-family: 'Tajawal', sans-serif; font-size: clamp(0.85rem, 1.4vw, 1.1rem); color: #6b7a8d; margin: 0; text-align: center; flex-shrink: 0; }

.res-qr-card { display: flex; flex-direction: column; align-items: center; gap: 8px; background: #f8fafc; border: 1px solid rgba(0,114,188,0.12); border-radius: 20px; padding: clamp(14px, 2vh, 24px); flex-shrink: 0; }

#final-qr-code { width: clamp(120px, 16vw, 200px); height: clamp(120px, 16vw, 200px); flex-shrink: 0; }
#final-qr-code img    { width: 100%; height: 100%; display: block; border-radius: 6px; }
#final-qr-code canvas { width: 100% !important; height: 100% !important; }

.result-scan-label { font-family: 'Outfit', sans-serif; font-size: 0.78rem; font-weight: 600; color: #94a3b8; letter-spacing: 0.5px; }

.result-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 360px; flex-shrink: 0; }

.btn-result {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 48px;
    padding: 12px 20px;
    border-radius: 50px;
    font-family: 'Tajawal', sans-serif;
    font-size: clamp(0.9rem, 1.6vw, 1rem);
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
    border: none;
}
.btn-result:active { transform: scale(0.97); }

.btn-result-primary { background: linear-gradient(135deg, #0072bc, #005fa0); color: white; box-shadow: 0 6px 24px rgba(0,114,188,0.35); }
.btn-result-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0,114,188,0.45); }
.btn-result-outline { background: white; color: #0072bc; border: 2px solid #0072bc !important; }
.btn-result-outline:hover { background: #eef7ff; }
.btn-result-ghost { background: #f1f5f9; color: #64748b; }
.btn-result-ghost:hover { background: #e2e8f0; }


/* ===================== RESPONSIVE ===================== */

/* iPad portrait (769px–1024px): stack landing sections */
@media (min-width: 769px) and (max-width: 1024px) {
    .landing-container { flex-direction: column; }
    .brand-section     { flex: none; width: 100%; min-height: auto; padding: 32px 24px 44px; }
    .logo-box          { height: 130px; }
    .cards-side        { gap: 20px; justify-content: center; flex-wrap: wrap; }
    .baby-card         { max-width: 180px; }
    .hero-header       { position: relative; top: auto; left: auto; transform: none; margin: 0 auto 4px; }
    .blob-1, .blob-2   { display: none; }
}

/* Mobile (max 768px) */
@media (max-width: 768px) {
    /* Landing */
    .landing-container { flex-direction: column; }
    .brand-section     { flex: none; width: 100%; min-height: auto; padding: 24px 16px 32px; }
    .logo-box          { height: 100px; }
    .cards-side        { gap: 12px; justify-content: center; }
    .baby-card         { padding: 10px; border-radius: 16px; max-width: 140px; min-width: 110px; }
    .card-label        { font-size: 0.85rem; }
    .heart             { width: 26px; height: 26px; top: 6px; right: 6px; }
    .blob-1, .blob-2   { display: none; }
    .hero-header       { position: relative; top: auto; left: auto; transform: none; white-space: normal; margin: 8px auto 0; }
    .hero-title        { font-size: 1.3rem; }
    .hero-sub          { font-size: 0.85rem; }
    .brand-header      { margin-bottom: 16px; }
    .features-bar      { padding: 10px 16px; }
    .feature-item      { padding: 4px 8px; gap: 8px; }
    .feature-title     { font-size: 0.8rem; }
    .feature-desc      { font-size: 0.7rem; }

    /* Confirm actions stack on mobile */
    .confirm-actions { flex-direction: column; }
    .btn-retake, .btn-use { flex: none; width: 100%; }

    /* Result: image top, actions bottom */
    .result-content {
        display: flex;
        flex-direction: column;
        height: 100vh;
        height: 100dvh;
    }
    .result-image-panel  { flex: 0 0 52dvh; padding: 0; }
    .result-action-panel { flex: 1; min-height: 0; padding: 16px 16px 24px; gap: 10px; border-radius: 20px 20px 0 0; box-shadow: 0 -4px 24px rgba(0,0,0,0.08); }
    .result-title        { font-size: 1.8rem; }
    .result-subtitle     { font-size: 0.85rem; }
    #final-qr-code       { width: 130px !important; height: 130px !important; }
    .result-actions      { max-width: 100%; }
    .btn-result          { min-height: 44px; font-size: 0.95rem; }
    .res-corner-logo     { height: 34px; }
}

/* Small phones */
@media (max-width: 420px) {
    .baby-card       { max-width: 120px; min-width: 96px; padding: 8px; }
    .card-label      { font-size: 0.75rem; }
    .brand-section   { padding: 18px 12px 24px; }
    .result-title    { font-size: 1.5rem; }
    .result-image-panel { flex-basis: 48dvh; }
    #final-qr-code   { width: 110px !important; height: 110px !important; }
}

/* Landscape: limit image height so buttons always stay visible */
@media (orientation: landscape) and (max-height: 900px) {
    .confirm-body { flex: 0 0 auto; max-height: 48vh; }
    .confirm-bottom { flex: 0 0 auto; padding: 8px 16px 12px; gap: 4px; }
    .confirm-title { font-size: 1.1rem; }
    .confirm-sub { font-size: 0.78rem; }
    .confirm-actions { margin-top: 4px; }
    .btn-retake, .btn-use { padding: 11px 14px; }
    .cam-brand-logo { height: clamp(36px, 7vh, 64px); }
    .cam-top-bar, .confirm-top { padding: 8px 16px 6px; }
}
