/* ═══════════════════════════════════════════════════════════════════════════
   TI CORP PRIVE × CROCS — BRAND TUNING LAYER
   ───────────────────────────────────────────────────────────────────────────
   Loaded AFTER vendor/crocs/css/style.brand.css so these rules win the cascade.

   Division of labour:
     • public/vendor/crocs/css/*.css        pristine template, never edited
     • public/vendor/crocs/build-brand.py   swaps Crocs' hardcoded palette for
                                            the brand palette -> *.brand.css
     • THIS FILE                            everything a colour swap can't do:
                                            typography, surfaces the template
                                            leaves light in dark mode, the
                                            split-screen auth shell, and the
                                            handful of class collisions between
                                            Bootstrap 5 and our own JS.

   Brand values come from resources/views/partials/brand-tokens.blade.php,
   which remains the single source of truth and is loaded before this file.
   ═══════════════════════════════════════════════════════════════════════════ */


/* ───────────────────────────────────────────────────────────────────────────
   1. TYPOGRAPHY
   Crocs ships Lexend. The brand runs Montserrat for UI, Cinzel for display and
   Cormorant Garamond for italic accents — shared with the Flutter app, the
   landing site and the email templates.
   ─────────────────────────────────────────────────────────────────────────── */
body,
body.dark-only {
    font-family: var(--font-body);
    letter-spacing: 0.01em;
}

h1, h2, h3, h4, h5, h6,
.card .card-header h4,
.card .card-header h5 {
    font-family: var(--font-display);
    letter-spacing: 0.01em;
}

/* Numerals, ids and money keep the mono face so columns align. */
.txt-mono { font-family: var(--font-mono); }


/* ───────────────────────────────────────────────────────────────────────────
   2. CLASS COLLISIONS
   Bootstrap 5 defines `.toast` with `display:none` unless `.show` is present,
   and our showToast() builds `.toast.toast-{type}` nodes of its own. Rather
   than rename classes in JS (which several pages call), the panel's toast
   rules are re-scoped under #toast-container so they outrank Bootstrap.
   ─────────────────────────────────────────────────────────────────────────── */
#toast-container .toast {
    display: block;
    max-width: 420px;
    background-clip: border-box;
    background-color: var(--luxe-bg);
    border-radius: 0;
    font-size: inherit;
    pointer-events: auto;
}

/* Tailwind is not loaded on the auth layout, but several auth views toggle
   visibility with `.hidden`. Keep the utility alive on its own. */
.hidden { display: none !important; }


/* ───────────────────────────────────────────────────────────────────────────
   3. DARK SURFACES CROCS LEAVES LIGHT
   `body.dark-only` covers most of the template, but a few login surfaces keep
   their light-mode values because the stock demo uses a photographic backdrop.
   ─────────────────────────────────────────────────────────────────────────── */
body.dark-only .login-card {
    background: var(--navy);
    padding: 0;
    min-height: 100vh;
    min-height: 100dvh;
}

/* Crocs' .login-main is a white card in light mode and gets no dark-mode
   background, so it needs a raised navy surface of its own. */
body.dark-only .login-card .login-main {
    width: 100%;
    max-width: 470px;
    padding: 2.75rem 2.5rem;
    background-color: var(--luxe-bg);
    border: 1px solid var(--luxe-line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

body.dark-only .login-card .login-main .theme-form input,
body.dark-only .login-card .login-main .theme-form select,
body.dark-only .form-control,
body.dark-only .form-select {
    background-color: var(--navy-2) !important;
    border: 1px solid var(--luxe-line-strong) !important;
    border-radius: var(--radius-sm);
    color: var(--luxe-ink) !important;
    padding: 12px 14px;
}

body.dark-only .login-card .login-main .theme-form input::placeholder,
body.dark-only .form-control::placeholder {
    color: var(--luxe-ink-soft) !important;
}

body.dark-only .form-control:focus,
body.dark-only .form-select:focus,
body.dark-only .login-card .login-main .theme-form input:focus {
    border-color: var(--gold) !important;
    box-shadow: 0 0 0 3px var(--gold-tint) !important;
    outline: none;
}

/* Crocs paints the select caret dark; on navy it disappears. */
body.dark-only .form-select,
body.dark-only .theme-form select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23C68A42' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    background-size: 16px !important;
    padding-right: 42px !important;
}


/* ───────────────────────────────────────────────────────────────────────────
   4. BUTTONS
   Gold is a mid-tone; white label text on it fails contrast, so the primary
   button carries navy ink. Crocs sets its background with !important, hence
   the matching specificity here.
   ─────────────────────────────────────────────────────────────────────────── */
.btn {
    font-family: var(--font-body);
    font-weight: 500;
    letter-spacing: 0.02em;
    border-radius: var(--radius-sm);
    transition: background-color 220ms var(--luxe-ease),
                border-color 220ms var(--luxe-ease),
                box-shadow 220ms var(--luxe-ease),
                transform 220ms var(--luxe-ease);
}

.btn-primary,
body.dark-only .btn-primary {
    background-color: var(--gold) !important;
    border-color: var(--gold) !important;
    color: var(--navy) !important;
}

.btn-primary:hover,
body.dark-only .btn-primary:hover {
    background-color: var(--gold-bright) !important;
    border-color: var(--gold-bright) !important;
    color: var(--navy) !important;
    box-shadow: var(--glow-gold);
}

.btn-primary:focus-visible,
body.dark-only .btn-primary:focus-visible {
    box-shadow: 0 0 0 3px var(--gold-tint) !important;
    outline: none;
}

.btn-primary:disabled,
body.dark-only .btn-primary:disabled {
    opacity: 0.65;
    box-shadow: none;
}

/* setButtonLoading() swaps the label for a spinner + text; keep them centred. */
.btn .btn-spinner + span { margin-left: 0.55rem; }
.btn:has(.btn-spinner) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@media (prefers-reduced-motion: reduce) {
    .btn { transition: none; }
}


/* ═══════════════════════════════════════════════════════════════════════════
   5. AUTH SHELL — split screen
   Left: navy brand pane. Right: the Crocs .login-card / .login-main form.
   Prefixed `tcp-` so nothing collides with Crocs' own classes.
   ═══════════════════════════════════════════════════════════════════════════ */
.tcp-auth {
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--navy);
}

/* ─── Brand pane ─────────────────────────────────────────────────────────── */
.tcp-auth-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 3.5rem 3.25rem;
    overflow: hidden;
    background:
        radial-gradient(120% 90% at 12% 0%, rgba(198, 138, 66, 0.16) 0%, transparent 58%),
        linear-gradient(160deg, var(--navy-raised) 0%, var(--navy) 55%, #060E1A 100%);
    border-right: 1px solid var(--gold-line);
}

/* Faint diagonal weave — texture without an image request. */
.tcp-auth-brand::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(135deg,
            rgba(255, 255, 255, 0.022) 0px,
            rgba(255, 255, 255, 0.022) 1px,
            transparent 1px,
            transparent 9px);
    pointer-events: none;
}

.tcp-auth-brand > * { position: relative; z-index: 1; }

.tcp-auth-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
    text-decoration: none;
}

.tcp-auth-logo img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    flex-shrink: 0;
}

.tcp-auth-wordmark {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 500;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--on-navy);
    line-height: 1;
}

.tcp-auth-wordmark em {
    font-style: normal;
    color: var(--gold);
}

.tcp-auth-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 1.5rem;
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--gold);
}

.tcp-auth-eyebrow::before {
    content: "";
    width: 30px;
    height: 1px;
    background: var(--gold);
}

.tcp-auth-headline {
    margin: 0 0 1.35rem;
    font-family: var(--font-accent);
    font-size: clamp(2.5rem, 3.6vw, 3.6rem);
    font-weight: 300;
    line-height: 1.08;
    letter-spacing: -0.015em;
    color: var(--on-navy);
}

.tcp-auth-headline em {
    font-style: italic;
    color: var(--gold);
}

.tcp-auth-copy {
    max-width: 34rem;
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.75;
    color: var(--on-navy-soft);
}

.tcp-auth-points {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1.75rem;
    margin: 2.25rem 0 0;
    padding: 0;
    list-style: none;
}

.tcp-auth-points li {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.78rem;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--on-navy-muted);
}

.tcp-auth-points li::before {
    content: "";
    width: 5px;
    height: 5px;
    flex-shrink: 0;
    transform: rotate(45deg);
    background: var(--gold);
}

.tcp-auth-footnote {
    padding-top: 1.35rem;
    border-top: 1px solid var(--navy-line);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--on-navy-muted);
}

/* ─── Form pane ──────────────────────────────────────────────────────────── */
.tcp-auth-form-pane {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 3rem 1.5rem;
    background: var(--navy);
}

.tcp-auth-heading {
    margin: 0 0 0.5rem;
    font-family: var(--font-display);
    font-size: 1.45rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--luxe-ink);
}

.tcp-auth-sub {
    margin: 0 0 2rem;
    font-size: 0.875rem;
    line-height: 1.65;
    color: var(--luxe-ink-muted);
}

body.dark-only .theme-form .col-form-label,
.tcp-auth-form-pane .col-form-label {
    margin-bottom: 0.45rem;
    padding: 0;
    font-size: 0.7rem !important;
    font-weight: 600;
    letter-spacing: 0.16em !important;
    text-transform: uppercase;
    color: var(--luxe-ink-muted);
}

.tcp-auth-form-pane .form-group { margin-bottom: 1.35rem; }

/* The submit sits in a `.form-group.mb-0`; give it room off the last field. */
.tcp-auth-form-pane .form-group.mb-0 { margin-top: 2rem; }

.tcp-auth-form-pane .btn-primary {
    padding: 0.8rem 1.25rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

/* Eye toggle. togglePasswordVisibility() flips the two SVGs by id, so this is
   presentation only — the ids and the handler are untouched. */
.tcp-pw-toggle {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: var(--radius-sm);
    color: var(--luxe-ink-muted);
    cursor: pointer;
    transition: color 200ms var(--luxe-ease), background-color 200ms var(--luxe-ease);
}

.tcp-pw-toggle:hover { color: var(--gold); background: var(--gold-whisper); }
.tcp-pw-toggle:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
    color: var(--gold);
}

/* Crocs reserves 60px on the right of every text/password input in the login
   card for its own "show / hide" *text* toggle, via
   `.login-card input[type=text] { padding: … !important }` — specificity
   (0,0,1,1), so a plain `.tcp-otp-input { padding: 0 !important }` loses to it.
   Ours is an icon button, so reset the padding at a higher specificity and
   re-add clearance only where a toggle actually sits. */
body.dark-only .login-card input[type=text],
body.dark-only .login-card input[type=password] {
    padding: 12px 14px !important;
}

body.dark-only .login-card input[type=password],
body.dark-only .login-card input[type=text].tcp-has-toggle {
    padding-right: 52px !important;
}

/* Must come last: the code boxes are centred single characters, so any
   horizontal padding pushes their min-content width past the flex basis and
   the row overflows its card. */
body.dark-only .login-card input.tcp-otp-input,
.login-card input.tcp-otp-input {
    padding: 0 !important;
}

/* Server-rendered flash message (session('error')). */
.tcp-auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    margin-bottom: 1.5rem;
    padding: 0.85rem 1rem;
    background: var(--danger-tint);
    border: 1px solid rgba(var(--danger-rgb), 0.45);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--luxe-ink);
}

.tcp-auth-alert svg { flex-shrink: 0; margin-top: 1px; color: var(--danger); }

.tcp-auth-alert.tcp-auth-alert-success {
    background: rgba(97, 174, 65, 0.12);
    border-color: rgba(97, 174, 65, 0.45);
}

.tcp-auth-alert.tcp-auth-alert-success svg { color: #61AE41; }

/* Inline per-field validation text (e.g. #codeError). */
.tcp-field-error {
    margin-top: 0.45rem;
    font-size: 0.78rem;
    color: #E2707A;
}

.tcp-auth-meta {
    margin-top: 1.6rem;
    padding-top: 1.35rem;
    border-top: 1px solid var(--luxe-line);
    font-size: 0.85rem;
    text-align: center;
    color: var(--luxe-ink-muted);
}

.tcp-auth-meta a,
.tcp-auth-link {
    color: var(--gold);
    font-weight: 500;
    text-decoration: none;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    transition: color 200ms var(--luxe-ease);
}

.tcp-auth-meta a:hover,
.tcp-auth-link:hover { color: var(--gold-bright); text-decoration: underline; }

/* Six separate boxes — the OTP screen and the reset-code field. */
.tcp-otp-row {
    display: flex;
    justify-content: space-between;
    gap: 0.55rem;
}

.tcp-otp-input {
    flex: 1 1 0;
    min-width: 0;
    height: 60px;
    padding: 0 !important;
    font-family: var(--font-mono);
    font-size: 1.35rem !important;
    font-weight: 500;
    text-align: center;
}

.tcp-otp-resend {
    margin: 1.25rem 0 0;
    text-align: center;
}

.tcp-otp-resend p {
    margin: 0 0 0.3rem;
    font-size: 0.85rem;
    color: var(--luxe-ink-muted);
}

.tcp-otp-resend .tcp-auth-link { font-size: 0.85rem; }

/* Reset-code boxes, once the code has been accepted / rejected. The verify
   handler tags the hidden `#code` field; a MutationObserver in the view mirrors
   that onto this row. */
/* Outranking `body.dark-only .login-card .login-main .theme-form input`, which
   sets the `border` shorthand with !important at (0,0,4,2). */
body.dark-only .login-card .tcp-otp-row.is-verified input.tcp-otp-input,
.tcp-otp-row.is-verified .tcp-otp-input {
    border-color: rgba(97, 174, 65, 0.6) !important;
    color: #61AE41 !important;
}

body.dark-only .login-card .tcp-otp-row.is-invalid input.tcp-otp-input,
.tcp-otp-row.is-invalid .tcp-otp-input {
    border-color: var(--danger) !important;
}

.tcp-otp-input[readonly] { cursor: default; }

/* Validation states toggled from JS on the reset-code field. These class
   names come from reset-password.blade.php's handler, which is left as-is;
   defining them here is what finally makes that feedback visible, since the
   auth layout never loaded Tailwind. */
.tcp-auth-form-pane .form-control.border-red-500 {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px rgba(var(--danger-rgb), 0.18) !important;
}

.tcp-auth-form-pane .form-control.border-green-300,
.tcp-auth-form-pane .form-control.bg-green-50 {
    border-color: rgba(97, 174, 65, 0.6) !important;
    box-shadow: 0 0 0 3px rgba(97, 174, 65, 0.15) !important;
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1199.98px) {
    /* Brand pane becomes a compact banner above the form. */
    .tcp-auth-brand {
        min-height: auto;
        padding: 2.25rem 1.75rem;
        border-right: 0;
        border-bottom: 1px solid var(--gold-line);
    }

    .tcp-auth-brand .tcp-auth-points,
    .tcp-auth-brand .tcp-auth-footnote { display: none; }

    .tcp-auth-headline { font-size: clamp(1.9rem, 6vw, 2.5rem); margin-bottom: 0.9rem; }
    .tcp-auth-copy { font-size: 0.875rem; }
    .tcp-auth-brand-body { margin-top: 2rem; }

    .tcp-auth-form-pane {
        min-height: auto;
        padding: 2.5rem 1.25rem 3.5rem;
    }

    body.dark-only .login-card { min-height: auto; }
}

@media (max-width: 575.98px) {
    .tcp-auth-brand { padding: 1.75rem 1.25rem; }
    .tcp-auth-eyebrow { margin-bottom: 1rem; }
    .tcp-auth-copy { display: none; }
    .tcp-auth-form-pane { padding: 2rem 1.1rem 3rem; }
}
