/* Shared by the sign in and sign up screens. They look the same, so the styles live in one global file. */

.login-page { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; min-height: 100dvh; background: var(--color-surface); }

.login-form-side {
    display: flex; align-items: center; justify-content: center; padding: 48px 40px;
    background:
        radial-gradient(520px 320px at 0% 0%, rgba(18, 165, 118, 0.10), transparent 70%),
        radial-gradient(420px 320px at 0% 100%, rgba(18, 165, 118, 0.10), transparent 70%),
        var(--color-surface);
}
.login-form-box { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 26px; }

.login-heading { display: flex; flex-direction: column; gap: 8px; }
.login-heading h1 { font-size: 36px; letter-spacing: -0.015em; word-spacing: 0.05em; line-height: 1.1; }
.login-heading p { font-size: 16px; line-height: 1.5; }

/* The form element comes from EditForm, so I reach it with to set its spacing. */
.login-form-box .login-fields { display: flex; flex-direction: column; gap: 20px; }

.login-note {
    display: flex; align-items: center; gap: 12px; padding: 16px 18px;
    border-radius: var(--radius-md); background: #D6EEE2; border: 1.5px solid #7DBF9F;
    color: var(--color-primary-ink); font-size: 14px; font-weight: 700; line-height: 1.5;
}
.login-note svg { color: var(--color-primary-deep); flex: 0 0 auto; }

.login-secure { display: flex; align-items: center; gap: 16px; padding-top: 6px; color: var(--color-text-muted); font-size: 13px; }
.login-secure::before, .login-secure::after { content: ""; flex: 1 1 0; height: 1px; background: var(--color-border); }
.login-secure-text { display: flex; align-items: center; gap: 10px; }
.login-secure svg { color: var(--color-primary); flex: 0 0 auto; }
.login-secure-text div { display: flex; flex-direction: column; line-height: 1.4; }
.login-secure strong { color: var(--color-text-nav); font-weight: 700; }

.login-brand-side {
    position: relative; overflow: hidden;
    display: flex; flex-direction: column; justify-content: center; gap: 56px;
    padding: 64px 72px 170px; color: #FFFFFF;
    /* The picture has an empty green top for the text and the capsules at the bottom right. */
    background: #0A5F44 url("../../images/login-bg.jpg") right bottom / cover no-repeat;
}
.login-pitch, .login-cards { position: relative; z-index: 1; }
.login-pitch { max-width: 620px; display: flex; flex-direction: column; gap: 18px; }
.login-pitch h2 { font-size: 46px; line-height: 1.12; letter-spacing: -0.015em; word-spacing: 0.06em; }
.login-pitch p { font-size: 18px; line-height: 1.6; color: #CDEBDD; }

.login-cards { max-width: 560px; display: flex; flex-direction: column; gap: 22px; padding-left: 30px; }
.login-cards-label {
    display: flex; align-items: center; gap: 10px; margin-bottom: 0;
    font-size: 12.5px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: #BFE5D3;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #5EE0A8; box-shadow: 0 0 0 0 rgba(94, 224, 168, 0.7); animation: live-pulse 2s infinite; }

/* The round icon sits half outside the card, over its curved left edge. The cards float up and down very slowly, each on its own beat. */
.feature-card {
    position: relative;
    display: flex; align-items: center; gap: 18px; padding: 24px 30px 24px 58px;
    background: linear-gradient(180deg, #FFFFFF 0%, #F6FBF8 100%);
    color: var(--color-text); border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 16px 38px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: card-rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) backwards, card-float 7s ease-in-out infinite;
    animation-delay: calc(var(--i) * 120ms + 150ms), calc(var(--i) * -2.3s);
}
.feature-card:hover { box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 24px 50px rgba(0, 0, 0, 0.3); }
.feature-card .stat-chip {
    position: absolute; left: -30px; top: 50%; translate: 0 -50%; width: 62px; height: 62px;
    box-shadow: 0 0 0 5px #FFFFFF, 0 10px 24px rgba(0, 0, 0, 0.16);
}

.fc-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 auto; }
.fc-text strong { font-size: 18px; }
.fc-text span { font-size: 15px; color: var(--color-text-muted); }

.fc-pill {
    display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: var(--radius-pill);
    font-size: 14px; font-weight: 800; white-space: nowrap;
}
.fc-pill-danger { background: var(--color-danger-bg); color: var(--color-danger-ink); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: #E5483A; animation: live-pulse-red 1.8s infinite; }

/* The sales line draws itself, holds for a moment, then fades and draws again. */
.fc-spark { width: 112px; height: 42px; flex: 0 0 auto; color: #12A576; animation: fc-spark-fade 6s ease-in-out infinite; }
.fc-spark path:last-child { stroke-dasharray: 100; animation: fc-draw 6s ease-in-out infinite; }

/* The low stock bar slowly breathes between nearly empty and a bit fuller. */
.fc-bar { width: 100px; height: 10px; border-radius: 999px; background: #F3E6C4; overflow: hidden; flex: 0 0 auto; }
.fc-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #F0A81C, #E58A0B); transform-origin: left; animation: fc-breathe 5s ease-in-out infinite; }

@keyframes card-rise { from { opacity: 0; transform: translateY(18px); } }
@keyframes card-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -5px; } }
@keyframes fc-draw { 0% { stroke-dashoffset: 100; } 40%, 100% { stroke-dashoffset: 0; } }
@keyframes fc-spark-fade { 0%, 8% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; } }
@keyframes fc-breathe { 0%, 100% { transform: scaleX(0.16); } 50% { transform: scaleX(0.34); } }
@keyframes live-pulse { 70% { box-shadow: 0 0 0 8px rgba(94, 224, 168, 0); } 100% { box-shadow: 0 0 0 0 rgba(94, 224, 168, 0); } }
@keyframes live-pulse-red { 0% { box-shadow: 0 0 0 0 rgba(229, 72, 58, 0.55); } 70% { box-shadow: 0 0 0 7px rgba(229, 72, 58, 0); } 100% { box-shadow: 0 0 0 0 rgba(229, 72, 58, 0); } }

@media (prefers-reduced-motion: reduce) {
    .feature-card { animation: none; transition: none; }
    .live-dot, .pulse, .fc-spark, .fc-spark path:last-child, .fc-bar span { animation: none; }
    .fc-spark path:last-child { stroke-dashoffset: 0; }
    .fc-bar span { transform: scaleX(0.18); }
}

/* Phones and small tablets: only the sign in form, full width. */
@media (max-width: 900px) {
    .login-page { grid-template-columns: 1fr; }
    .login-brand-side { display: none; }
    .login-form-side { padding: 32px 20px; align-items: flex-start; }
    .login-form-box { padding-top: 8px; }
    .login-heading h1 { font-size: 30px; }
}

.login-form-box .form-row-2 { display: grid; grid-template-columns: 1fr; gap: 20px; }
.login-link { align-self: flex-end; margin-top: -8px; font-size: 14px; font-weight: 700; color: var(--color-primary-deep); text-decoration: none; }
.login-link:hover { text-decoration: underline; }
a.login-note { text-decoration: none; transition: border-color 0.15s ease, background 0.15s ease; }
a.login-note:hover { background: #CBE8D9; border-color: var(--color-primary); }
.login-note .login-note-go { margin-left: auto; }


/* Continue with Google. */
.google-btn {
    display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 52px;
    border: 1.5px solid var(--color-border); border-radius: var(--radius-md); background: #fff;
    color: var(--color-text); font-size: 16px; font-weight: 700; text-decoration: none; cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.google-btn:hover { background: var(--color-bg); border-color: var(--color-primary); }

.auth-divider { display: flex; align-items: center; gap: 14px; margin: 4px 0; color: var(--color-text-muted); font-size: 13px; font-weight: 600; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--color-border); }

/* While the Google popup is open, the button shows a spinner and cannot be clicked again. */
.google-spinner { display: none; width: 18px; height: 18px; border: 2.5px solid var(--color-border); border-top-color: var(--color-primary); border-radius: 50%; animation: google-spin 0.8s linear infinite; }
.google-btn.is-loading { pointer-events: none; opacity: 0.85; }
.google-btn.is-loading svg { display: none; }
.google-btn.is-loading .google-spinner { display: inline-block; }
@keyframes google-spin { to { transform: rotate(360deg); } }

/* The agreement line under the sign up form. */
.auth-legal { margin: 16px 0 0; font-size: 12.5px; line-height: 1.55; text-align: center; color: var(--color-text-muted); }
.auth-legal a { color: var(--color-primary-ink); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }

/* On a computer the sign in screens are drawn at the same 85% as the app (--z lives in layout.css), so the text size matches once you are inside. */
@media (min-width: 1100px) {
    body:has(.login-page) { zoom: var(--z); }
    .login-page { min-height: calc(100vh / var(--z)); min-height: calc(100dvh / var(--z)); }
}


/* The 6 digit code screen, shared by "Forgot password" and "Confirm your email". */
.login-heading .code-badge { width: 64px; height: 64px; margin-bottom: 6px; }
.code-boxes { display: flex; gap: 10px; }
.code-box {
    flex: 1 1 0; min-width: 0; height: 64px; padding: 0; text-align: center;
    font: inherit; font-size: 28px; font-weight: 800; color: var(--color-ink); caret-color: var(--color-primary);
    background: #FFFFFF; border: 1.5px solid var(--color-border-input); border-radius: var(--radius-md);
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.code-box:focus { outline: none; border-color: var(--color-primary); box-shadow: var(--focus-ring); }
.code-box.is-filled { background: var(--color-primary-soft); border-color: var(--color-primary); }
.code-boxes.is-error .code-box { background: var(--color-danger-bg); border-color: #E5483A; animation: code-shake 0.4s ease; }
@keyframes code-shake { 20% { translate: -6px 0; } 40% { translate: 6px 0; } 60% { translate: -4px 0; } 80% { translate: 4px 0; } }

/* The flip clock. Each card is two halves that show the top and bottom of one big digit.
   A half draws the digit at full card height (200% of itself) and clips it, so the two halves always line up. */
.flip-timer { --flip-w: clamp(38px, 11vw, 50px); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.flip-caption { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--color-text-muted); }
.flip-clock { display: flex; align-items: flex-start; justify-content: center; gap: 12px; }
.flip-clock[hidden], .flip-caption[hidden], .flip-over[hidden] { display: none; }
.flip-group { display: grid; justify-items: center; gap: 8px; }
.flip-cards { display: flex; gap: 5px; }
.flip-label { font-size: 10.5px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--color-text-muted); }
.flip-sep { align-self: flex-start; width: 5px; height: 5px; margin-top: calc(var(--flip-w) * 0.5); border-radius: 50%; background: var(--color-accent); box-shadow: 0 calc(var(--flip-w) * 0.3) 0 0 var(--color-accent); }

.flip-digit {
    position: relative; display: block; width: var(--flip-w); height: calc(var(--flip-w) * 1.32); perspective: 420px;
    border-radius: 9px; background: #0A3329; color: #FFFFFF;
    font-size: calc(var(--flip-w) * 0.86); font-weight: 800; font-variant-numeric: tabular-nums;
    box-shadow: 0 8px 16px -8px rgba(12, 61, 48, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.flip-digit b { position: absolute; left: 0; right: 0; height: 50%; overflow: hidden; backface-visibility: hidden; }
.flip-digit i { position: absolute; left: 0; right: 0; height: 200%; display: grid; place-items: center; font-style: normal; line-height: 1; }
.flip-top, .flip-flap-t { top: 0; border-radius: 9px 9px 0 0; background: #0C3D30; border-bottom: 1px solid rgba(0, 0, 0, 0.35); }
.flip-bot, .flip-flap-b { bottom: 0; border-radius: 0 0 9px 9px; background: #0A3329; }
.flip-top i, .flip-flap-t i { top: 0; }
.flip-bot i, .flip-flap-b i { bottom: 0; }
.flip-flap-t { transform-origin: bottom center; z-index: 3; opacity: 0; }
.flip-flap-b { transform-origin: top center; z-index: 2; opacity: 0; }
.flip-digit[data-flip] .flip-flap-t { opacity: 1; animation: flip-fall 0.32s ease-in forwards; }
.flip-digit[data-flip] .flip-flap-b { opacity: 1; animation: flip-rise 0.32s ease-out 0.32s forwards; }
@keyframes flip-fall { from { transform: rotateX(0deg); } to { transform: rotateX(-90deg); } }
@keyframes flip-rise { from { transform: rotateX(90deg); } to { transform: rotateX(0deg); } }

/* In the last minute the cards turn red, so the person knows to hurry. */
.flip-timer.is-low .flip-top, .flip-timer.is-low .flip-flap-t { background: #8E241B; }
.flip-timer.is-low .flip-bot, .flip-timer.is-low .flip-flap-b, .flip-timer.is-low .flip-digit { background: #761D16; }

.flip-over {
    display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px 16px; border-radius: var(--radius-pill);
    background: var(--color-danger-bg); color: var(--color-danger-ink); font-size: 13.5px; font-weight: 700;
}

.code-help { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px 6px; font-size: 14px; color: var(--color-text-muted); text-align: center; }
.code-help form { display: inline; }
.code-resend-btn { padding: 4px 6px; border: 0; border-radius: 8px; background: none; font: inherit; font-weight: 800; color: var(--color-primary-deep); cursor: pointer; }
.code-resend-btn:hover:not(:disabled) { text-decoration: underline; }
.code-resend-btn:disabled { color: var(--color-text-muted); cursor: default; font-variant-numeric: tabular-nums; }

@media (max-width: 400px) {
    .code-boxes { gap: 7px; }
    .code-box { height: 56px; font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
    .code-boxes.is-error .code-box { animation: none; }
    .flip-digit[data-flip] .flip-flap-t, .flip-digit[data-flip] .flip-flap-b { animation: none; opacity: 0; }
}

/* The waiting room: shown alone, with no menu, while a new pharmacy waits for approval. */
.wait-page {
    min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
    background: radial-gradient(900px 520px at 12% 8%, var(--tile-lime) 0%, transparent 62%),
                radial-gradient(820px 520px at 92% 92%, var(--tile-mint) 0%, transparent 62%),
                var(--color-bg);
}
.wait-card {
    width: 100%; max-width: 520px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px;
    padding: 40px 32px 32px; background: var(--color-surface); border: 1px solid var(--color-border-soft);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-card); animation: wait-in 0.45s ease both;
}
.wait-card h1 { font-size: 26px; }
.wait-card p { max-width: 400px; line-height: 1.55; }
.wait-badge {
    width: 76px; height: 76px; margin-top: 10px; position: relative; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; background: var(--tile-lime); color: var(--color-ink);
}
.wait-badge::after {
    content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--color-primary);
    opacity: 0; animation: wait-ring 2.2s ease-out infinite;
}
.wait-badge.is-ok { background: var(--gradient-primary); color: #FFFFFF; box-shadow: 0 10px 24px rgba(11, 127, 90, 0.35); animation: wait-pop 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.3) both; }
.wait-badge.is-no { background: var(--color-danger-bg); color: var(--color-danger-ink); }
.wait-badge.is-no::after { display: none; }
.wait-pharmacy {
    padding: 6px 14px; border-radius: var(--radius-pill); background: var(--color-primary-soft);
    color: var(--color-primary-ink); font-size: 13px; font-weight: 800;
}
.wait-steps { list-style: none; margin: 6px 0 0; padding: 0; width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: 12px; text-align: left; }
.wait-steps li { display: flex; align-items: center; gap: 12px; font-weight: 700; color: var(--color-text-muted); }
.wait-steps li.is-done { color: var(--color-ink); }
.wait-steps li.is-now { color: var(--color-text); }
.wait-dot {
    flex: none; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; border: 2px solid var(--color-border-input); background: var(--color-surface);
}
.is-done .wait-dot { background: var(--color-ink); border-color: var(--color-ink); color: #FFFFFF; }
.is-now .wait-dot { border-color: var(--color-primary); animation: wait-dot 1.8s ease-out infinite; }
.is-now .wait-dot::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--color-primary); }
.wait-live { display: inline-flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 13px; color: var(--color-text-muted); }
.wait-actions { width: 100%; max-width: 340px; margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.wait-actions .btn { width: 100%; justify-content: center; }
.wait-actions form { margin: 0; }
.wait-bar { width: 100%; max-width: 260px; height: 6px; margin-top: 6px; overflow: hidden; border-radius: var(--radius-pill); background: var(--color-primary-soft); }
.wait-bar > span { display: block; width: 40%; height: 100%; border-radius: var(--radius-pill); background: var(--gradient-primary); animation: wait-slide 1.2s ease-in-out infinite; }
@keyframes wait-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes wait-pop { from { opacity: 0; transform: scale(0.5); } to { opacity: 1; transform: none; } }
@keyframes wait-ring { 0% { opacity: 0.55; transform: scale(1); } 100% { opacity: 0; transform: scale(1.6); } }
@keyframes wait-dot { 0% { box-shadow: 0 0 0 0 rgba(11, 127, 90, 0.4); } 70% { box-shadow: 0 0 0 8px rgba(11, 127, 90, 0); } 100% { box-shadow: 0 0 0 0 rgba(11, 127, 90, 0); } }
@keyframes wait-slide { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
@media (prefers-reduced-motion: reduce) {
    .wait-card, .wait-badge, .wait-badge::after, .is-now .wait-dot, .wait-bar > span { animation: none; }
    .wait-bar > span { width: 100%; }
}
@media (max-width: 520px) {
    .wait-page { padding: 16px 12px; }
    .wait-card { padding: 32px 20px 24px; }
}
/* On a computer it is drawn at the same 85% as the sign in screens. */
@media (min-width: 1100px) {
    body:has(.wait-page) { zoom: var(--z); }
    .wait-page { min-height: calc(100vh / var(--z)); min-height: calc(100dvh / var(--z)); }
}

/* The approved moment: a bar that fills over 5 seconds while three steps tick one by one. */
.wait-bar.is-timed > span { width: 100%; transform-origin: left; animation: wait-fill 5s cubic-bezier(0.45, 0.05, 0.3, 1) forwards; }
.wait-steps.is-timed .wait-dot { background: transparent; border-color: var(--color-border); color: transparent; transition: background 0.35s ease, border-color 0.35s ease, color 0.35s ease, transform 0.35s ease; animation: wait-tick 0.4s ease forwards; animation-delay: var(--d); }
.wait-steps.is-timed li { opacity: 0.5; animation: wait-lit 0.4s ease forwards; animation-delay: var(--d); }
@keyframes wait-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes wait-tick { to { background: var(--color-primary); border-color: var(--color-primary); color: #FFFFFF; } }
@keyframes wait-lit { to { opacity: 1; color: var(--color-ink); } }
@media (prefers-reduced-motion: reduce) {
    .wait-bar.is-timed > span { animation: none; transform: none; }
    .wait-steps.is-timed li { animation: none; opacity: 1; }
    .wait-steps.is-timed .wait-dot { animation: none; background: var(--color-primary); border-color: var(--color-primary); color: #FFFFFF; }
}
