/* ==========================================================================
   Mera Gym — sign-in pages (owner, staff, trainer, OTP login, forgot password)
   Markup lives in resources/views/components/business/auth/*.blade.php.
   Everything is prefixed .auth- so it cannot collide with the app's global CSS.
   ========================================================================== */

:root {
    --auth-primary: #dc3545;
    --auth-primary-hover: #c22a39;
    --auth-primary-ink: #b91c1c;          /* brand red used for text links (6.5:1 on white) */
    --auth-ink: #0f172a;
    --auth-text: #334155;
    --auth-muted: #64748b;
    --auth-line: #cbd5e1;
    --auth-soft: #f1f5f9;
    --auth-danger: #b42318;
    --auth-radius: 12px;
    --auth-font-head: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* The app's stylesheet forces a grey body; sign-in pages are white on desktop. */
body:has(.auth-shell) { background-color: #fff !important; margin: 0; }

.auth-shell {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--auth-text);
    -webkit-font-smoothing: antialiased;
}
.auth-shell *, .auth-shell *::before, .auth-shell *::after { box-sizing: border-box; }

/* ---------- Brand panel (desktop only) ---------- */
.auth-hero {
    position: relative;
    display: none;
    flex: 0 0 46%;
    max-width: 660px;
    color: #fff;
    background:
        radial-gradient(110% 80% at 0% 0%, rgba(255, 90, 90, .55) 0%, transparent 60%),
        radial-gradient(90% 70% at 100% 100%, rgba(255, 138, 76, .40) 0%, transparent 60%),
        linear-gradient(150deg, #c81e1e 0%, #8b1414 58%, #5c0d0d 100%);
}
.auth-hero::before {                       /* faint white doodles over the red */
    content: '';
    position: absolute;
    inset: 0;
    background: url('./bg_gym_doodles.webp') repeat;
    background-size: 560px 560px;
    filter: brightness(0) invert(1);
    opacity: .13;
    pointer-events: none;
}
.auth-hero__inner {
    position: sticky; top: 0;
    display: flex; flex-direction: column; justify-content: space-between;
    width: 100%;
    height: 100vh; height: 100dvh;
    min-height: 560px;
    padding: 48px 56px;
}
.auth-hero__logo { display: block; width: 168px; height: auto; }
.auth-hero__title {
    margin: 0 0 28px;
    font-family: var(--auth-font-head);
    font-weight: 700;
    font-size: clamp(30px, 3.1vw, 42px);
    line-height: 1.15;
    letter-spacing: -.02em;
}
.auth-hero__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.auth-hero__list li { display: flex; align-items: flex-start; gap: 14px; font-size: 16px; line-height: 1.45; color: rgba(255, 255, 255, .92); }
.auth-hero__list .bi {
    flex: 0 0 auto;
    display: grid; place-items: center;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .16);
    font-size: 15px;
}
.auth-hero__foot { font-size: 13px; color: rgba(255, 255, 255, .7); }

/* ---------- Form column ---------- */
.auth-main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    min-width: 0;
}
.auth-card { width: 100%; max-width: 420px; }
.auth-card--wide { max-width: 520px; }
.auth-mobile-brand { display: block; margin: 0 auto 24px; width: 150px; height: auto; }

/* ---------- "Sign in as" switcher ---------- */
.auth-roles-label { display: block; margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--auth-muted); }
.auth-roles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: 4px;
    margin-bottom: 28px;
    background: var(--auth-soft);
    border-radius: var(--auth-radius);
}
.auth-role {
    display: flex; align-items: center; justify-content: center; gap: 7px;
    min-height: 44px;
    padding: 8px 6px;
    border: 0; border-radius: 9px;
    background: transparent;
    font: inherit; font-size: 14px; font-weight: 500;
    color: var(--auth-text);
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, color .15s, box-shadow .15s;
}
.auth-role:hover { color: var(--auth-ink); background: rgba(255, 255, 255, .6); }
.auth-role.is-active { background: #fff; color: var(--auth-primary-ink); font-weight: 600; box-shadow: 0 1px 3px rgba(15, 23, 42, .14); }
.auth-role .bi { font-size: 16px; }

/* ---------- Headings ---------- */
.auth-back {
    display: inline-flex; align-items: center; gap: 6px;
    margin: 0 0 16px; padding: 4px 0;
    border: 0; background: none;
    font: inherit; font-size: 14px; font-weight: 500;
    color: var(--auth-muted);
    text-decoration: none;
    cursor: pointer;
}
.auth-back:hover { color: var(--auth-ink); }
.auth-title {
    margin: 0 0 6px;
    font-family: var(--auth-font-head);
    font-weight: 600;
    font-size: 28px;
    line-height: 1.2;
    letter-spacing: -.01em;
    color: var(--auth-ink);
}
.auth-sub { margin: 0 0 24px; font-size: 15px; line-height: 1.5; color: var(--auth-muted); }
.auth-sub strong { color: var(--auth-ink); font-weight: 600; overflow-wrap: anywhere; }

/* ---------- Fields ---------- */
.auth-field { margin-bottom: 18px; }
.auth-label { display: block; margin: 0 0 6px; font-size: 14px; font-weight: 500; color: var(--auth-ink); }
.auth-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.auth-label-row .auth-label { margin: 0; }
.auth-input { position: relative; }
.auth-input__icon {
    position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
    font-size: 17px; color: #94a3b8; pointer-events: none;
}
.auth-control {
    display: block; width: 100%;
    height: 50px;
    padding: 0 16px 0 44px;
    border: 1.5px solid var(--auth-line);
    border-radius: var(--auth-radius);
    background: #fff;
    font: inherit; font-size: 16px;           /* 16px stops iOS zooming on focus */
    color: var(--auth-ink);
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none; appearance: none;
}
.auth-control::placeholder { color: #94a3b8; }
.auth-control:hover { border-color: #94a3b8; }
.auth-control:focus { outline: 0; border-color: var(--auth-primary); box-shadow: 0 0 0 4px rgba(220, 53, 69, .16); }
.auth-control[readonly] { background: var(--auth-soft); color: var(--auth-text); }
.auth-input--toggle .auth-control { padding-right: 48px; }
.auth-input.is-invalid .auth-control { border-color: var(--auth-danger); }
.auth-input.is-invalid .auth-control:focus { box-shadow: 0 0 0 4px rgba(180, 35, 24, .16); }
.auth-input__toggle {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    display: grid; place-items: center;
    width: 42px; height: 42px;
    border: 0; border-radius: 10px; background: transparent;
    font-size: 19px; color: var(--auth-muted);
    cursor: pointer;
}
.auth-input__toggle:hover { color: var(--auth-ink); background: var(--auth-soft); }
select.auth-control { padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.auth-hint { margin: 6px 0 0; font-size: 13px; line-height: 1.45; color: var(--auth-muted); }
.auth-error { display: flex; gap: 6px; align-items: flex-start; margin: 6px 0 0; font-size: 13px; line-height: 1.45; color: var(--auth-danger); }
.auth-error .bi { margin-top: 2px; }

/* One-time code */
.auth-control--code { padding: 0 16px; height: 60px; text-align: center; font-size: 28px; font-weight: 600; letter-spacing: .42em; text-indent: .42em; font-variant-numeric: tabular-nums; }
.auth-control--code::placeholder { letter-spacing: .3em; }

/* Section headings inside the long sign-up form */
.auth-section { margin: 26px 0 14px; padding-top: 22px; border-top: 1px solid #e2e8f0; font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--auth-muted); }
.auth-section:first-of-type { margin-top: 4px; padding-top: 0; border-top: 0; }
.auth-grid { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
@media (min-width: 560px) { .auth-grid--2 { grid-template-columns: 1fr 1fr; } }

/* ---------- Buttons ---------- */
.auth-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; min-height: 50px;
    padding: 0 20px;
    border: 1.5px solid transparent;
    border-radius: var(--auth-radius);
    font: inherit; font-size: 16px; font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
}
.auth-btn:active { transform: translateY(1px); }
.auth-btn[disabled], .auth-btn.is-loading { opacity: .72; cursor: progress; }
.auth-btn--primary { background: var(--auth-primary); color: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .12), 0 6px 16px -8px rgba(220, 53, 69, .8); }
.auth-btn--primary:hover { background: var(--auth-primary-hover); color: #fff; }
.auth-btn--secondary { background: #fff; color: var(--auth-ink); border-color: var(--auth-line); }
.auth-btn--secondary:hover { background: #f8fafc; border-color: #94a3b8; color: var(--auth-ink); }
.auth-shell a:focus-visible, .auth-shell button:focus-visible { outline: 3px solid rgba(220, 53, 69, .45); outline-offset: 2px; }
.auth-spinner { width: 18px; height: 18px; border: 2.5px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 50%; animation: auth-spin .7s linear infinite; }
.auth-btn--secondary .auth-spinner { border-color: rgba(15, 23, 42, .2); border-top-color: var(--auth-ink); }
@keyframes auth-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .auth-spinner { animation-duration: 1.6s; } .auth-btn, .auth-control { transition: none; } }

.auth-divider { display: flex; align-items: center; gap: 14px; margin: 22px 0; font-size: 13px; color: var(--auth-muted); }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: #e2e8f0; }

/* ---------- Links & footer ---------- */
.auth-link { color: var(--auth-primary-ink); font-weight: 500; text-decoration: none; cursor: pointer; background: none; border: 0; padding: 0; font: inherit; font-weight: 500; }
.auth-link:hover { text-decoration: underline; color: #991b1b; }
.auth-switch { margin: 22px 0 0; text-align: center; font-size: 15px; color: var(--auth-text); }
.auth-foot { margin-top: 28px; padding-top: 20px; border-top: 1px solid #e2e8f0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; font-size: 14px; color: var(--auth-muted); }
.auth-foot .bi { margin-right: 4px; }
.auth-resend { margin-top: 18px; text-align: center; font-size: 14px; color: var(--auth-muted); }

/* Signed-in-as chip (staff / trainer password step) */
.auth-chip { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; margin-bottom: 18px; border: 1.5px solid #e2e8f0; border-radius: var(--auth-radius); background: #f8fafc; font-size: 15px; color: var(--auth-ink); }
.auth-chip span { min-width: 0; overflow-wrap: anywhere; display: flex; gap: 10px; align-items: center; }
.auth-chip .bi { color: var(--auth-muted); }

/* Gym picker */
.auth-gyms { display: grid; gap: 10px; }
.auth-gym {
    display: flex; align-items: center; gap: 14px;
    width: 100%; min-height: 64px; padding: 10px 14px;
    border: 1.5px solid #e2e8f0; border-radius: var(--auth-radius);
    background: #fff; text-align: left;
    font: inherit; font-size: 16px; font-weight: 600; color: var(--auth-ink);
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.auth-gym:hover { border-color: var(--auth-primary); background: #fffafa; box-shadow: 0 4px 14px -8px rgba(220, 53, 69, .6); }
.auth-gym img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; background: var(--auth-soft); border: 1px solid #e2e8f0; }
.auth-gym__name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.auth-gym .bi { color: #94a3b8; }

/* Small "how to" video link */
.auth-help { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }

/* ---------- Responsive ---------- */
@media (min-width: 992px) {
    .auth-hero { display: flex; }
    .auth-main { padding: 48px 56px; }
    .auth-mobile-brand { display: none; }
}

/* Phones and small tablets: soft gradient page with the form as a white card */
@media (max-width: 991.98px) {
    body:has(.auth-shell) {
        background-color: #fff7f5 !important;
        background-image:
            url('./bg_gym_doodles.webp'),
            radial-gradient(60vmax 60vmax at 8% 12%, rgba(220, 53, 69, .20), transparent 62%),
            radial-gradient(55vmax 55vmax at 95% 6%, rgba(99, 102, 241, .16), transparent 62%),
            radial-gradient(60vmax 60vmax at 92% 96%, rgba(251, 146, 60, .18), transparent 62%),
            linear-gradient(160deg, #fff8f6 0%, #fdf4ff 55%, #f4f6ff 100%);
        background-size: 620px 620px, auto, auto, auto, auto;
        background-repeat: repeat, no-repeat, no-repeat, no-repeat, no-repeat;
    }
    .auth-main { padding: 28px 16px 40px; justify-content: flex-start; }
    .auth-card {
        padding: 24px 20px 26px;
        background: #fff;
        border-radius: 20px;
        box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 18px 40px -18px rgba(15, 23, 42, .28);
    }
    .auth-title { font-size: 24px; }
}
@media (max-width: 380px) {
    .auth-role { flex-direction: column; gap: 2px; font-size: 12.5px; }
}
