/* ==========================================================================
   Sarafkhane Landing — Dark/Gold Theme (inline form layout)
   ========================================================================== */

:root {
    --bg: #0f0f10;
    --bg-elevated: #18181b;
    --surface: #1e1e22;
    --surface-2: #26262b;
    --border: #2a2a30;
    --border-strong: #3a3a42;
    --text: #f5f5f7;
    --text-muted: #a1a1aa;
    --text-dim: #71717a;

    --gold: #f5b942;
    --gold-2: #facc6b;
    --gold-soft: rgba(245, 185, 66, 0.12);
    --gold-ring: rgba(245, 185, 66, 0.35);

    --danger: #ef4444;
    --success: #22c55e;

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.6);

    --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --container: 1200px;
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Vazirmatn', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    font-size: 18px;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero { width: 100%; }

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition);
}

img, svg {
    display: block;
    max-width: 100%;
}

button {
    font: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

ul, ol {
    list-style: none;
}

input {
    font: inherit;
    color: inherit;
}

::selection {
    background: var(--gold);
    color: var(--bg);
}

.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

.text-gold {
    color: var(--gold);
}

/* ==========================================================================
   Animated background glow
   ========================================================================== */

.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    z-index: 0;
    pointer-events: none;
    will-change: transform;
}

.bg-glow-1 {
    width: 680px;
    height: 680px;
    background: radial-gradient(circle, rgba(245, 185, 66, 1) 0%, rgba(245, 185, 66, 0.4) 35%, transparent 70%);
    top: -240px;
    inset-inline-start: -180px;
    opacity: 0.55;
    animation: drift1 22s ease-in-out infinite;
}

.bg-glow-2 {
    width: 560px;
    height: 560px;
    background: radial-gradient(circle, rgba(250, 204, 107, 0.9) 0%, rgba(250, 204, 107, 0.3) 35%, transparent 70%);
    bottom: -220px;
    inset-inline-end: -160px;
    opacity: 0.5;
    animation: drift2 28s ease-in-out infinite;
}

.bg-glow-3 {
    width: 460px;
    height: 460px;
    background: radial-gradient(circle, rgba(245, 185, 66, 0.75) 0%, transparent 65%);
    top: 40%;
    inset-inline-start: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.35;
    animation: drift3 32s ease-in-out infinite;
}

@keyframes drift1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%      { transform: translate(80px, 120px) scale(1.1); }
    66%      { transform: translate(-40px, 80px) scale(0.95); }
}

@keyframes drift2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(-120px, -100px) scale(1.15); }
}

@keyframes drift3 {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    25%      { transform: translate(-30%, -60%) scale(1.2); }
    50%      { transform: translate(-70%, -40%) scale(0.9); }
    75%      { transform: translate(-50%, -30%) scale(1.1); }
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 18px;
    line-height: 1;
    transition: all var(--transition);
    white-space: nowrap;
    position: relative;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.btn:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
}

.btn-sm  { padding: 9px 18px; font-size: 18px; }
.btn-lg  { padding: 16px 32px; font-size: 20px; }
.btn-block { width: 100%; }

.btn-primary {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-2) 100%);
    color: #1a1500;
    box-shadow: 0 4px 14px -2px var(--gold-ring);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px -4px var(--gold-ring);
}
.btn-primary:active {
    transform: translateY(0);
}
.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-ghost {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border-strong);
}
.btn-ghost:hover {
    background: var(--surface-2);
    border-color: var(--gold-ring);
}

.btn-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.btn.is-loading .btn-label { opacity: 0.4; }
.btn.is-loading .btn-spinner { display: block; }
.btn.is-loading { pointer-events: none; }

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

.link-btn {
    color: var(--text-muted);
    font-size: 18px;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 8px;
    transition: all var(--transition);
}
.link-btn:hover:not(:disabled) {
    color: var(--gold);
    background: var(--gold-soft);
}
.link-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
    padding: 48px 0 64px;
    position: relative;
}

.hero-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    text-align: center;
    max-width: 600px;
    margin-inline: auto;
}

.hero-content {
    display: contents;
}

.hero-logo {
    width: auto;
    height: 40px;
    margin-inline: auto;
    filter: brightness(0) invert(1) drop-shadow(0 4px 16px rgba(245, 185, 66, 0.2));
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
}

.hero-desc {
    font-size: 20px;
    color: var(--text-muted);
    max-width: 520px;
    margin-inline: auto;
}

.hero-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, max-content);
    gap: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    margin-inline: auto;
}

.hero-stats li {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hero-stats strong {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}

.hero-stats span {
    font-size: 18px;
    color: var(--text-dim);
}

/* ==========================================================================
   Form card (inline)
   ========================================================================== */

.hero-form-wrap {
    position: relative;
    width: 100%;
    /* Form sits high in the stack (right after the logo) so users on a
       portrait kiosk don't have to bend down to reach the inputs. */
    order: 2;
}

.hero-logo { order: 1; }
.hero-text  { order: 3; }
.hero-stats { order: 4; }

.form-card {
    background: linear-gradient(160deg, rgba(40, 40, 45, 0.55) 0%, rgba(25, 25, 28, 0.45) 100%);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-xl);
    padding: 32px;
    box-shadow:
        var(--shadow-lg),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    position: relative;
    overflow: hidden;
}

/* Inputs in glass card need a slightly different background for contrast */
.form-card .field input,
.form-card .otp-input input {
    background: rgba(15, 15, 16, 0.5);
    border-color: rgba(255, 255, 255, 0.08);
}
.form-card .field input:hover,
.form-card .otp-input input:hover {
    background: rgba(15, 15, 16, 0.65);
    border-color: rgba(255, 255, 255, 0.14);
}
.form-card .field input:focus,
.form-card .otp-input input:focus {
    background: rgba(15, 15, 16, 0.7);
    border-color: var(--gold);
}

.form-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(160deg, var(--gold-ring), transparent 40%, transparent 60%, var(--gold-ring));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0.5;
}

/* Steps */
.steps {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding-bottom: 24px;
    margin-bottom: 28px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: relative;
    z-index: 1;
}

.step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    color: var(--text-dim);
    font-weight: 500;
}

.step-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    transition: all var(--transition);
}

.step:not(:last-child)::after {
    content: '';
    width: 24px;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.step.active {
    color: var(--gold);
}

.step.active .step-icon {
    background: var(--gold);
    color: #1a1500;
    border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(245, 185, 66, 0.15), 0 4px 12px rgba(245, 185, 66, 0.35);
}

.step.completed .step-icon {
    background: var(--gold-soft);
    color: var(--gold);
    border-color: var(--gold-ring);
}

.step-panel {
    display: none;
    animation: fadeInUp 280ms cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    z-index: 1;
}

.step-panel.active {
    display: block;
}

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

.form-head {
    text-align: center;
    margin-bottom: 24px;
}

.form-head h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 6px;
}

.form-head p {
    color: var(--text-muted);
    font-size: 18px;
}

.form-head strong {
    color: var(--text);
    font-weight: 600;
}

/* Form fields */
.field {
    margin-bottom: 16px;
}

.field label {
    display: block;
    font-size: 18px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.field input {
    width: 100%;
    padding: 13px 16px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 18px;
    transition: all var(--transition);
}

.field input,
#mobile { text-align: center; }

.field input::placeholder {
    color: var(--text-dim);
    text-align: center;
}
#mobile::placeholder { letter-spacing: 1px; text-align: center; }

.field input:hover {
    border-color: var(--border-strong);
}

.field input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-soft);
}

.field.has-error input {
    border-color: var(--danger);
}

.field.has-error input:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.field-error {
    display: block;
    font-size: 18px;
    color: var(--danger);
    margin-top: 6px;
    min-height: 16px;
}

.form-meta {
    text-align: center;
    margin-top: 14px;
    font-size: 18px;
    color: var(--text-dim);
}

.form-meta a {
    color: var(--gold);
}

/* OTP input */
.otp-input {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 12px;
}

.otp-input input {
    width: 52px;
    height: 60px;
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    transition: all var(--transition);
    padding: 0;
}

.otp-input input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-soft);
    transform: translateY(-1px);
}

.otp-input input.filled {
    border-color: var(--gold-ring);
    background: var(--gold-soft);
}

.otp-input.has-error input {
    border-color: var(--danger);
    animation: shake 400ms ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

#otp-error {
    text-align: center;
    margin-bottom: 16px;
}

.demo-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--gold-soft);
    border: 1px solid var(--gold-ring);
    color: var(--gold);
    border-radius: var(--radius);
    font-size: 18px;
    margin-bottom: 18px;
    justify-content: center;
}
.demo-hint strong {
    color: var(--gold-2);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.otp-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
}

/* Success state */
.success-state {
    text-align: center;
    padding: 12px 0;
}

.success-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--gold-soft);
    color: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    animation: scaleIn 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleIn {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

.success-state h2 {
    font-size: 26px;
    margin-bottom: 10px;
}

.success-state p {
    color: var(--text-muted);
    font-size: 18px;
    margin-bottom: 24px;
    max-width: 360px;
    margin-inline: auto;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 24px 0;
    margin-top: auto;
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
}

.footer-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    text-align: center;
}

.footer-brand .brand-logo {
    height: 28px;
}

.site-footer p {
    color: var(--text-dim);
    font-size: 13px;
}

/* ==========================================================================
   Toast
   ========================================================================== */

.toast-container {
    position: fixed;
    top: 24px;
    inset-inline-end: 24px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 14px 18px;
    color: var(--text);
    font-size: 14px;
    box-shadow: var(--shadow-md);
    min-width: 260px;
    max-width: 360px;
    animation: toastIn 280ms cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.success { border-inline-start: 3px solid var(--success); }
.toast.error   { border-inline-start: 3px solid var(--danger); }
.toast.info    { border-inline-start: 3px solid var(--gold); }

.toast.hide {
    animation: toastOut 200ms ease forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    to { opacity: 0; transform: translateX(-20px); }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Portrait kiosk / digital signage stand (e.g. 1080×1920).
   Anchor content near the top so the form is comfortably reachable
   for a standing user — no bending required. */
@media (orientation: portrait) and (min-width: 981px) {
    main {
        align-items: flex-start;
        padding-top: 8vh;
    }
    .hero { padding: 0 0 40px; }
    .hero-logo { height: 56px; }
    .form-card { padding: 40px; max-width: 640px; }
}

@media (max-width: 980px) {
    .hero-inner { gap: 28px; }
    .hero-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
        width: 100%;
        max-width: 480px;
        padding-top: 16px;
    }
    .form-card {
        max-width: 520px;
        margin-inline: auto;
        width: 100%;
    }
    .bg-glow { filter: blur(80px); }
}

@media (max-width: 640px) {
    .container { padding: 0 16px; }
    .hero { padding: 24px 0 40px; }
    .hero-logo { height: 32px; margin-bottom: 0; }
    .hero-title { font-size: 1.75rem; line-height: 1.3; margin-bottom: 12px; }
    .hero-desc { font-size: 18px; }
    .hero-stats {
        gap: 8px;
        padding-top: 20px;
    }
    .hero-stats strong { font-size: 18px; }
    .hero-stats span { font-size: 18px; }
    .form-card { padding: 24px 20px; border-radius: var(--radius-lg); }
    .form-card .field input,
    .form-card #mobile { text-align: center; }
    .form-card .field input::placeholder,
    .form-card #mobile::placeholder { text-align: center; }
    .form-head h2 { font-size: 22px; }
    .otp-input { gap: 6px; }
    .otp-input input {
        width: 48px;
        height: 56px;
        font-size: 20px;
    }
    .steps { gap: 4px; }
    .step:not(:last-child)::after { width: 16px; }
    .step { font-size: 18px; }
    .bg-glow-1 { width: 380px; height: 380px; top: -120px; }
    .bg-glow-2 { width: 320px; height: 320px; }
    .bg-glow-3 { width: 280px; height: 280px; }
    .toast-container {
        top: 12px;
        inset-inline-end: 12px;
        inset-inline-start: 12px;
    }
    .toast { min-width: 0; max-width: none; }
}

@media (max-width: 380px) {
    .otp-input { gap: 4px; }
    .otp-input input { width: 42px; height: 52px; font-size: 18px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    .bg-glow { animation: none !important; }
}
