/* ============================================================
   Entain AI Photo Booth — Stylesheet
   Design: Dark theme, neon yellow-green accents, Mulish font
   ============================================================ */

/* ---- Font Face ---- */
@font-face {
    font-family: 'Mulish';
    src: url('fonts/Mulish/Mulish-VariableFont_wght.ttf') format('truetype');
    font-weight: 200 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Mulish';
    src: url('fonts/Mulish/Mulish-Italic-VariableFont_wght.ttf') format('truetype');
    font-weight: 200 900;
    font-style: italic;
    font-display: swap;
}

/* ---- Design Tokens ---- */
:root {
    --bg:          #1A1A1E;
    --bg-card:     #242428;
    --bg-input:    #2A2A2F;
    --accent:      #D4FF00;
    --accent-dim:  rgba(212, 255, 0, 0.15);
    --accent-glow: rgba(212, 255, 0, 0.35);
    --text:        #FFFFFF;
    --text-muted:  #9CA3AF;
    --border:      #3A3A40;
    --radius:      12px;
    --radius-lg:   14px;
    --transition:  0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --font:        'Mulish', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html {
    font-size: 16px;
    height: 100%;
    background: var(--bg);
}

body {
    font-family: var(--font);
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- Entain Brand Background (E-pattern / bg.jpg) ---- */
.bg-pattern {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

/* Entain branded background: E-like geometric pattern image */
.bg-pattern::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--bg) url('new_assets/bg.jpg') center center no-repeat;
    background-size: cover;
}

/* Subtle dark overlay so content stays readable */
.bg-pattern::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(26, 26, 30, 0.4) 0%,
        rgba(26, 26, 30, 0.75) 100%
    );
}


/* ---- App Container ---- */
.app-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
}

/* ---- Screen System ---- */
.screen {
    display: none;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity var(--transition), transform var(--transition);
}

.screen.active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
    animation: screenIn 0.45s ease-out;
}

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

/* ---- Screen Header ---- */
.screen-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 1.25rem 1.5rem 0;
    position: relative;
    z-index: 10;
}

.header-spacer {
    flex: 1;
}

.entain-logo {
    height: 28px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

/* Subtle accent underline on the header area */
.screen-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 1.75rem;
    right: 1.75rem;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
    opacity: 0;
}

/* ---- Screen Body ---- */
.screen-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1.75rem;
    overflow-y: auto;
}

/* ---- Screen Footer ---- */
.screen-footer {
    padding: 1rem 1.75rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* ---- Typography ---- */
.hero-title {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.15;
    color: var(--text);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.hero-title .accent {
    color: var(--accent);
}

.hero-subtitle {
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-bottom: 1.75rem;
    line-height: 1.5;
}

/* ---- Form Styles ---- */
.booth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.01em;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 400;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-group input::placeholder {
    color: #6B7280;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

/* Custom select wrapper */
.select-wrapper {
    position: relative;
}

.select-wrapper select {
    padding-right: 2.5rem;
    cursor: pointer;
}

.select-arrow {
    position: absolute;
    right: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.125rem;
    height: 1.125rem;
    color: var(--text-muted);
    pointer-events: none;
    transition: color var(--transition);
}

.select-wrapper:focus-within .select-arrow {
    color: var(--accent);
}

/* Dark option backgrounds for select dropdowns */
.form-group select option {
    background: var(--bg-input);
    color: var(--text);
    padding: 0.5rem;
}

/* ---- Buttons ---- */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    width: 100%;
    padding: 1rem 1.5rem;
    background: var(--accent);
    color: var(--bg);
    font-family: var(--font);
    font-size: 1.05rem;
    font-weight: 700;
    border: 2px solid var(--accent);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    letter-spacing: 0.01em;
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.15) 0%,
        transparent 50%
    );
    opacity: 0;
    transition: opacity var(--transition);
}

.btn-primary:hover {
    box-shadow: 0 0 24px var(--accent-glow), 0 4px 16px rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
}

.btn-primary:hover::before {
    opacity: 1;
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 0 12px var(--accent-glow);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-primary svg {
    flex-shrink: 0;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 600;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}

.btn-secondary:hover {
    border-color: var(--text-muted);
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
}

.btn-small {
    padding: 0.65rem 2rem;
    font-size: 0.9rem;
    width: auto;
    min-width: 120px;
}

/* ---- Camera Area ---- */
.camera-area {
    flex: 1;
    position: relative;
    width: 100%;
    min-height: 320px;
    max-height: 520px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1.5px solid var(--border);
    margin-top: 0.5rem;
}

/* Video fills the entire camera modal */
.camera-area video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
    transform: scaleX(-1); /* Mirror for selfie */
}

/* On mobile: show full camera feed without cropping (less zoomed-in feel) */
@media (max-width: 480px) {
    .camera-area video {
        object-fit: contain;
    }
    .camera-area .captured-preview {
        object-fit: contain;
    }
}

.camera-area video.visible {
    display: block;
}

/* Captured photo preview (shown after 3,2,1, click) — mirror like selfie view */
.camera-area .captured-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
    transform: scaleX(-1);
}

.camera-area .captured-preview.visible {
    display: block;
}

/* Uploaded images: no mirror (camera capture keeps selfie mirror) */
.camera-area .captured-preview.visible.captured-from-upload {
    transform: none;
}

/* Footer buttons: Upload (row 1), Camera (row 2) */
.screen2-footer-camera {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 0.75rem;
}

.screen2-footer-camera #btn-upload {
    order: 1;
}

.screen2-footer-camera #btn-camera {
    order: 2;
}

.screen2-footer-camera .btn-primary,
.screen2-footer-camera .btn-secondary {
    width: 100%;
}

.screen2-footer-actions {
    display: none;
    width: 100%;
    flex-direction: row;
    gap: 0.75rem;
}

.screen2-footer-actions.visible {
    display: flex;
}

.screen2-footer-actions .btn-secondary,
.screen2-footer-actions .btn-primary {
    flex: 1;
}

.camera-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.camera-placeholder svg {
    opacity: 0.4;
}

/* Countdown overlay */
.countdown-overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.25);
    z-index: 10;
}

.countdown-overlay.visible {
    display: flex;
}

.countdown-number {
    font-size: 7rem;
    font-weight: 800;
    color: var(--accent);
    text-shadow: 0 0 40px var(--accent-glow);
    animation: countPulse 0.9s ease-in-out infinite;
}

@keyframes countPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.1); opacity: 0.85; }
}

/* ---- Result Frame (loot box card + 3D tilt) ---- */
.result-frame {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.5rem;
    padding: 2rem 1.5rem;
    box-sizing: border-box;
    perspective: 800px;
    perspective-origin: center;
    overflow: visible;
}

.result-card {
    position: relative;
    width: 100%;
    max-width: 340px;
    overflow: visible;
    border-radius: var(--radius-lg);
}

/* Thick card effect: darker “edge” behind the card */
.result-card::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: calc(var(--radius-lg) + 4px);
    background: linear-gradient(145deg, var(--bg-input) 0%, #1A1A1E 100%);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.3);
    z-index: -1;
}

/* Shine on front face so it tilts with the card (avoids ghost artifact) */
.result-card-front {
    position: relative;
    width: 100%;
    backface-visibility: hidden;
    border-radius: var(--radius-lg);
    transform: rotateY(0deg);
    display: block;
}

.result-card-front::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    background: linear-gradient(
        105deg,
        transparent 0%,
        transparent 35%,
        rgba(255, 255, 255, 0.08) 45%,
        rgba(212, 255, 0, 0.12) 50%,
        rgba(255, 255, 255, 0.08) 55%,
        transparent 65%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: cardShine 6s ease-in-out infinite;
}

@keyframes cardShine {
    0%, 12% {
        background-position: 200% 0;
    }
    18% {
        background-position: -200% 0;
    }
    18.01%, 100% {
        background-position: -200% 0;
    }
}

.result-card-inner {
    position: relative;
    width: 100%;
    transform-style: preserve-3d;
    transform: rotateY(180deg);
}

.result-card-inner.reveal {
    animation: cardReveal 0.7s ease-out forwards;
}

.result-card-inner.reveal.card-subtle-animate {
    transform: rotateY(0deg); /* keep front visible when switching from cardReveal to cardSlowRotateY */
    animation: cardSlowRotateY 6s ease-in-out infinite;
}

@keyframes cardReveal {
    0% { transform: rotateY(180deg); }
    100% { transform: rotateY(0deg); }
}

@keyframes cardSlowRotateY {
    0%, 100% { transform: rotateY(-10deg); }
    50% { transform: rotateY(10deg); }
}

.result-card-back {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--radius-lg);
}

.result-card-back {
    background: linear-gradient(145deg, var(--bg-card) 0%, var(--bg-input) 100%);
    border: 2px solid rgba(212, 255, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotateY(180deg);
}

.result-card-back::before {
    content: '';
    width: 96px;
    height: 96px;
    background: url('new_assets/Entain_logo.png') center/contain no-repeat;
    opacity: 0.55;
}

.result-card-front .result-image {
    width: 100%;
    height: auto;
    display: block;
    vertical-align: top;
    border-radius: var(--radius-lg);
    border: 2px solid rgba(212, 255, 0, 0.3);
    box-shadow:
        0 0 20px rgba(212, 255, 0, 0.15),
        0 0 60px rgba(212, 255, 0, 0.08),
        0 8px 32px rgba(0, 0, 0, 0.4);
    animation: resultGlow 3s ease-in-out infinite alternate;
    display: block;
}

@keyframes resultGlow {
    0% {
        box-shadow:
            0 0 20px rgba(212, 255, 0, 0.15),
            0 0 60px rgba(212, 255, 0, 0.08),
            0 8px 32px rgba(0, 0, 0, 0.4);
    }
    100% {
        box-shadow:
            0 0 30px rgba(212, 255, 0, 0.25),
            0 0 80px rgba(212, 255, 0, 0.12),
            0 8px 32px rgba(0, 0, 0, 0.4);
    }
}

/* Reduced motion: skip flip, rotation and shine */
@media (prefers-reduced-motion: reduce) {
    .result-card-front::after {
        animation: none;
        opacity: 0;
    }
    .result-card-inner {
        transform: rotateY(0deg);
    }
    .result-card-inner.reveal {
        animation: none;
    }
    .result-card-inner.reveal.card-subtle-animate {
        animation: none;
    }
    .result-card-back {
        display: none;
    }
}

/* ---- Processing Overlay ---- */
.processing-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 12, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.processing-overlay.visible {
    display: flex;
    animation: overlayIn 0.3s ease-out;
}

@keyframes overlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.processing-content {
    text-align: center;
    padding: 2rem;
    max-width: 320px;
    width: 100%;
}

.spinner {
    width: 52px;
    height: 52px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1.5rem;
    box-shadow: 0 0 16px var(--accent-dim);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.processing-text {
    color: var(--text);
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.progress-bar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), #E8FF66, var(--accent));
    background-size: 200% 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
    animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.progress-percent {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* ---- Error Modal ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 12, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-overlay.visible {
    display: flex;
    animation: overlayIn 0.25s ease-out;
}

.modal-overlay.visible .modal-card {
    animation: modalPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 360px;
    width: 90%;
    text-align: center;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.modal-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.modal-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* ---- Utility / Accessibility ---- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ---- Responsive ---- */
@media (max-width: 380px) {
    .hero-title {
        font-size: 1.65rem;
    }

    .screen-body {
        padding: 1.25rem 1.25rem;
    }

    .screen-footer {
        padding: 1rem 1.25rem 1.75rem;
    }
}

@media (min-width: 481px) {
    .app-container {
        max-width: 480px;
    }
}

/* Tall phones — give camera more room */
@media (min-height: 740px) {
    .camera-area {
        min-height: 400px;
    }
}

@media (min-height: 840px) {
    .camera-area {
        min-height: 460px;
    }
}
