/*
 * Auth screens (login, register, password flows) — the dashboard look in the Airmail palette.
 * Light paper ground, a navy rounded "sidebar" panel, flat white cards, gold icon coins,
 * and a navy pill CTA carrying a gold coin. Plain CSS: the deploy runs no npm build.
 * Scoped to .ce-auth so the Bootstrap form components keep their look elsewhere.
 */

.ce-auth {
    --navy-950: #060D1F;
    --navy-900: #0B1630;
    --navy-850: #0F1C3B;
    --navy-800: #13244A;
    --navy-700: #1C3263;
    --navy-600: #2A4580;
    --navy-line: rgba(247, 241, 227, 0.12);
    --navy-line-strong: rgba(247, 241, 227, 0.22);
    --cream: #F7F1E3;
    --cream-muted: rgba(247, 241, 227, 0.72);
    --cream-faint: rgba(247, 241, 227, 0.52);
    --gold: #D4A437;
    --gold-300: #E8C771;
    --gold-800: #7A5B12;
    --gold-ink: #2A1E05;
    --red: #C8372D;
    --red-700: #A82A21;
    --green: #009246;
    --green-ink: #0B4D2A;
    --paper: #FFFFFF;
    --paper-2: #F3F5FA;
    --paper-3: #E8ECF4;
    --paper-line: rgba(11, 22, 48, 0.1);
    --paper-line-strong: rgba(11, 22, 48, 0.2);
    --ink: #0B1630;
    --ink-muted: #46506A;
    --ink-faint: #5E6880;

    --font-display: 'Anybody', system-ui, sans-serif;
    --font-body: 'Onest', system-ui, sans-serif;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);

    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--paper-3);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    font-feature-settings: 'tnum';
    -webkit-font-smoothing: antialiased;
}

.ce-auth ::selection { background: var(--gold); color: var(--gold-ink); }

.ce-auth__shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 1rem;
}

@media (min-width: 992px) {
    .ce-auth__shell {
        grid-template-columns: minmax(24rem, 0.9fr) minmax(0, 1.1fr);
        padding: 1.25rem;
        gap: 1.25rem;
    }
}

/* ---------- Navy panel (the dashboard sidebar) ---------- */

.ce-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.25rem;
    border-radius: 20px;
    overflow: hidden;
    color: var(--cream);
    background:
        radial-gradient(60% 45% at 100% 0%, rgba(212, 164, 55, 0.16), transparent 70%),
        radial-gradient(70% 60% at 0% 100%, rgba(42, 69, 128, 0.55), transparent 70%),
        linear-gradient(180deg, var(--navy-900), var(--navy-950));
}

@media (min-width: 992px) {
    .ce-panel {
        justify-content: space-between;
        padding: 2rem;
        position: sticky;
        top: 1.25rem;
        height: calc(100dvh - 2.5rem);
        min-height: 36rem;
    }
}

/* Three.js backdrop (auth-scene.js): fades in once the first frame is drawn */
.ce-panel__scene {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1200ms var(--ease);
}
.ce-panel.has-scene .ce-panel__scene { opacity: 1; }
.ce-panel > :not(.ce-panel__scene) { position: relative; z-index: 1; }

.ce-panel__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.ce-panel__brand { display: inline-flex; line-height: 0; border-radius: 6px; }
.ce-panel__brand img { height: 40px; width: auto; }
@media (min-width: 992px) { .ce-panel__brand img { height: 48px; } }

.ce-panel__back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: 40px;
    padding: 0 1rem;
    border-radius: 999px;
    border: 1px solid var(--navy-line-strong);
    color: var(--cream-muted);
    font-size: 0.86rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 160ms var(--ease), color 160ms var(--ease);
}
.ce-panel__back:hover { background: rgba(247, 241, 227, 0.08); color: var(--cream); }
.ce-panel__back svg { width: 16px; height: 16px; transform: scaleX(-1); }
.ce-panel__back-short { display: none; }
@media (max-width: 575.98px) {
    .ce-panel__back-full { display: none; }
    .ce-panel__back-short { display: inline; }
}

.ce-panel__intro { max-width: 30rem; }

.ce-panel__title {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 800;
    font-stretch: 78%;
    font-variation-settings: 'wdth' 78;
    text-transform: uppercase;
    letter-spacing: -0.015em;
    line-height: 1.02;
    font-size: clamp(1.7rem, 1.3rem + 1.6vw, 2.9rem);
    text-wrap: balance;
}
.ce-panel__title em { font-style: normal; color: var(--gold); }

.ce-panel__lede {
    margin: 0.75rem 0 0;
    color: var(--cream-muted);
    max-width: 40ch;
}

/* Feature tiles = the dashboard's KPI cards */
.ce-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ce-tile {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1rem;
    border-radius: 16px;
    background: rgba(19, 36, 74, 0.72);
    border: 1px solid var(--navy-line);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    transition: transform 320ms var(--ease), border-color 320ms var(--ease);
}
.ce-tile:hover { transform: translateY(-4px); border-color: var(--navy-line-strong); }

/* One highlighted card, like the dark "Total Shipment" tile — inverted to cream on navy */
.ce-tile--lead {
    background: var(--cream);
    border-color: transparent;
    color: var(--ink);
}

.ce-tile__head { display: flex; align-items: center; justify-content: space-between; }

.ce-coin {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gold);
    color: var(--gold-ink);
    flex-shrink: 0;
}
.ce-coin svg { width: 20px; height: 20px; }

.ce-tile__arrow {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--navy-line-strong);
    color: var(--cream-muted);
}
.ce-tile__arrow svg { width: 15px; height: 15px; }
.ce-tile--lead .ce-tile__arrow { border-color: var(--paper-line-strong); color: var(--ink-muted); }

.ce-tile__name { margin: 0; font-weight: 600; font-size: 0.95rem; line-height: 1.3; }
.ce-tile__text { margin: 0.25rem 0 0; font-size: 0.82rem; line-height: 1.45; color: var(--cream-faint); }
.ce-tile--lead .ce-tile__text { color: var(--ink-muted); }

.ce-panel__foot {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    font-size: 0.8rem;
    color: var(--cream-faint);
}

.ce-contact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: 0.6rem 1.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.9rem;
}
.ce-contact a {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--cream-muted);
    text-decoration: none;
    overflow-wrap: anywhere;
    transition: color 160ms var(--ease);
}
.ce-contact a:hover { color: var(--cream); }
.ce-contact svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--gold); }

.ce-legal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--navy-line);
}

.ce-credit {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--cream-faint);
    text-decoration: none;
    transition: color 160ms var(--ease);
}
.ce-credit img { height: 26px; width: auto; opacity: 0.85; transition: opacity 160ms var(--ease); }
.ce-credit:hover { color: var(--cream); }
.ce-credit:hover img { opacity: 1; }

/* Phone: the panel becomes a compact header; tiles and footer wait for the desktop */
@media (max-width: 991.98px) {
    .ce-tiles,
    .ce-panel__foot,
    .ce-panel__lede { display: none; }
    .ce-panel { gap: 1.25rem; padding-bottom: 1.5rem; }
}

/* Phone-only credit under the form card, on navy so the white logo reads */
.ce-mcredit { display: none; }
@media (max-width: 991.98px) {
    .ce-main { flex-direction: column; gap: 1rem; }
    .ce-mcredit {
        /* tight line height so the padding is truly even top and bottom, with one clear gap between the lines */
        display: grid; grid-template-columns: auto auto; justify-content: center; align-items: center; gap: 0.6rem 0.6rem;
        width: 100%; padding: 1.1rem 1.25rem;
        line-height: 1.2;
        border-radius: 18px;
        background: var(--navy-900);
        color: var(--cream-faint);
        font-size: 0.82rem; font-weight: 500; text-decoration: none;
        transition: color 160ms var(--ease);
    }
    .ce-mcredit > span:first-child { grid-column: 1 / -1; justify-self: center; }
    .ce-mcredit img { height: 26px; width: auto; opacity: 0.9; }
    .ce-mcredit:hover { color: var(--cream); }
}

/* ---------- Form side ---------- */

.ce-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0 1.5rem;
}
@media (min-width: 992px) { .ce-main { padding: 2rem; } }

.ce-card {
    width: 100%;
    max-width: 28rem;
    padding: 1.75rem 1.25rem;
    border-radius: 20px;
    background: var(--paper);
    border: 1px solid var(--paper-line);
}
@media (min-width: 576px) { .ce-card { padding: 2.5rem; } }

/* Headings inside any auth view */
.ce-card h1,
.ce-card .ce-title {
    margin: 0 0 0.35rem;
    font-family: var(--font-display);
    font-weight: 800;
    font-stretch: 78%;
    font-variation-settings: 'wdth' 78;
    text-transform: uppercase;
    letter-spacing: -0.01em;
    line-height: 1.02;
    font-size: clamp(1.7rem, 1.5rem + 0.8vw, 2.2rem);
    color: var(--ink);
}

.ce-card .tt-text-muted,
.ce-card .text-muted { color: var(--ink-muted) !important; }

.ce-card p { color: var(--ink-muted); }

/* Fields */
.ce-card .form-label {
    margin-bottom: 0.4rem;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--ink);
}

.ce-card .form-control {
    height: 48px;
    padding: 0 1rem;
    border-radius: 12px;
    border: 1px solid transparent;
    background: var(--paper-2);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 0.98rem;
    box-shadow: none;
    transition: background-color 160ms var(--ease), border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
.ce-card .form-control::placeholder { color: var(--ink-faint); opacity: 0.8; }
.ce-card .form-control:hover { border-color: var(--paper-line); }
.ce-card .form-control:focus {
    background: var(--paper);
    border-color: var(--navy-700);
    box-shadow: 0 0 0 4px rgba(28, 50, 99, 0.12);
    outline: none;
}
.ce-card .form-control:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 40px var(--paper-2) inset;
    -webkit-text-fill-color: var(--ink);
}

.ce-card .text-danger { color: var(--red-700) !important; }

/* Field with a trailing icon button (password reveal) */
.ce-field { position: relative; }
.ce-field .form-control { padding-right: 3.25rem; }
.ce-field__toggle {
    position: absolute;
    top: 4px;
    right: 4px;
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--ink-faint);
    cursor: pointer;
    transition: background-color 160ms var(--ease), color 160ms var(--ease);
}
.ce-field__toggle:hover { background: var(--paper-3); color: var(--ink); }
.ce-field__toggle svg { width: 20px; height: 20px; }
.ce-field__toggle .is-off { display: none; }
.ce-field__toggle[aria-pressed="true"] .is-on { display: none; }
.ce-field__toggle[aria-pressed="true"] .is-off { display: block; }

/* Checkbox */
.ce-card .form-check-input {
    width: 1.15rem;
    height: 1.15rem;
    margin-top: 0.2rem;
    border-radius: 5px;
    border: 1.5px solid var(--paper-line-strong);
    background-color: var(--paper);
    box-shadow: none;
    cursor: pointer;
}
.ce-card .form-check-input:checked { background-color: var(--navy-900); border-color: var(--navy-900); }
.ce-card .form-check-input:focus { box-shadow: 0 0 0 4px rgba(28, 50, 99, 0.12); border-color: var(--navy-700); }
.ce-card .form-check-label { color: var(--ink-muted); cursor: pointer; }

/* Links */
.ce-card a:not(.btn) {
    color: var(--navy-700);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: var(--paper-line-strong);
    text-underline-offset: 3px;
    transition: text-decoration-color 160ms var(--ease);
}
.ce-card a:not(.btn):hover { text-decoration-color: currentColor; }

/* Buttons: navy pill with a gold coin, the dashboard's "Add New" CTA in Airmail colours */
.ce-card .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    min-height: 48px;
    padding: 0 1.4rem;
    border-radius: 999px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.95rem;
    transition: background-color 160ms var(--ease), transform 160ms var(--ease), box-shadow 160ms var(--ease);
}
.ce-card .btn:active { transform: translateY(1px) scale(0.985); }

.ce-card .btn-primary {
    background: var(--navy-900);
    border: 0;
    color: var(--cream);
}
.ce-card .btn-primary:hover,
.ce-card .btn-primary:focus-visible { background: var(--navy-700); color: var(--cream); }
.ce-card .btn-primary:focus-visible { box-shadow: 0 0 0 4px rgba(212, 164, 55, 0.45); }

.ce-card .btn-secondary,
.ce-card .btn-outline-secondary {
    background: var(--paper);
    border: 1px solid var(--paper-line-strong);
    color: var(--ink);
}
.ce-card .btn-secondary:hover,
.ce-card .btn-outline-secondary:hover { background: var(--paper-2); color: var(--ink); }

.ce-btn-block { width: 100%; padding-right: 0.4rem !important; justify-content: space-between !important; }
.ce-btn-block .ce-coin { width: 38px; height: 38px; transition: transform 320ms var(--ease); }
.ce-btn-block .ce-coin svg { width: 18px; height: 18px; }
.ce-btn-block:hover .ce-coin { transform: translateX(2px); }

/* Divider + switch line */
.ce-switch {
    margin: 1.75rem 0 0;
    padding-top: 1.25rem;
    border-top: 1px solid var(--paper-line);
    text-align: center;
    font-size: 0.9rem;
}

.ce-card .alert-success {
    border: 1px solid rgba(0, 146, 70, 0.28);
    border-radius: 12px;
    background: rgba(0, 146, 70, 0.1);
    color: var(--green-ink);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Sinhala drops the uppercase + condensing */
[data-locale="si"] .ce-panel__title,
[data-locale="si"] .ce-card h1 {
    text-transform: none;
    font-stretch: 100%;
    font-variation-settings: normal;
    line-height: 1.3;
}

/* Entrance: panel copy, tiles and the form card rise in, staggered */
@keyframes ce-rise {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: none; }
}
.ce-panel__top,
.ce-panel__intro,
.ce-tile,
.ce-panel__foot,
.ce-card { animation: ce-rise 800ms var(--ease) backwards; }
.ce-panel__intro { animation-delay: 120ms; }
.ce-tile:nth-child(1) { animation-delay: 260ms; }
.ce-tile:nth-child(2) { animation-delay: 340ms; }
.ce-tile:nth-child(3) { animation-delay: 420ms; }
.ce-panel__foot { animation-delay: 520ms; }
.ce-card { animation-delay: 180ms; }

@media (prefers-reduced-motion: reduce) {
    .ce-auth *, .ce-auth *::before, .ce-auth *::after {
        transition-duration: 1ms !important;
        animation-duration: 1ms !important;
    }
}

/* WhatsApp number: country code picker joined to the number (same control as the booking form) */
.ce-card [data-whatsapp-input] { flex-wrap: nowrap; }
.ce-card [data-whatsapp-input] .form-control { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.ce-card [data-whatsapp-input] .form-select { height: 48px; border: 1px solid transparent; border-radius: 12px 0 0 12px; background-color: var(--paper-3); font-family: var(--font-body); font-weight: 600; color: var(--ink); box-shadow: none; }
.ce-card .form-text { margin-top: 0.4rem; font-size: 0.82rem; color: var(--ink-faint); }
.ce-card .am-cc { position: relative; flex: 0 0 auto; }
.ce-card .am-cc__btn {
    display: flex; align-items: center; gap: 0.45rem; height: 48px; padding: 0 0.75rem 0 0.95rem;
    border: 1px solid transparent; border-right: 0; border-radius: 12px 0 0 12px;
    background: var(--paper-3); color: var(--ink); font: inherit; font-family: var(--font-body); cursor: pointer;
    transition: background-color 160ms var(--ease);
}
.ce-card .am-cc__btn:hover { background: #DDE3EE; }
.ce-card .am-cc__btn:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(28, 50, 99, 0.12); border-color: var(--navy-700); position: relative; z-index: 3; }
.ce-card .am-cc__btn .am-cc__code { font-weight: 700; font-variant-numeric: tabular-nums; }
.ce-card .am-cc__btn .am-cc__name { color: var(--ink-muted); font-size: 0.9rem; }
.ce-card .am-cc__btn svg { width: 16px; height: 16px; color: var(--ink-faint); transition: transform 160ms var(--ease); }
.ce-card .am-cc__btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.ce-card .am-cc__list {
    position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; min-width: 14rem; margin: 0; padding: 0.35rem;
    list-style: none; border-radius: 12px; background: var(--paper); outline: none;
    box-shadow: 0 0 0 1px var(--paper-line), 0 18px 40px -16px rgba(11, 22, 48, 0.35);
    animation: ce-cc-in 160ms cubic-bezier(0.16, 1, 0.3, 1);
}
.ce-card .am-cc__list li { display: grid; grid-template-columns: 3rem 1fr 18px; align-items: center; gap: 0.5rem; min-height: 44px; padding: 0 0.75rem; border-radius: 8px; color: var(--ink); cursor: pointer; }
.ce-card .am-cc__list li .am-cc__code { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--navy-700); }
.ce-card .am-cc__list li svg { width: 18px; height: 18px; color: var(--navy-900); visibility: hidden; }
.ce-card .am-cc__list li.is-active { background: var(--paper-2); }
.ce-card .am-cc__list li[aria-selected="true"] { font-weight: 600; }
.ce-card .am-cc__list li[aria-selected="true"] svg { visibility: visible; }
@keyframes ce-cc-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ce-card .am-cc__list { animation: none; } }

/* Register: two columns from md up, in a wider card (the name spans both) */
.ce-form-grid { display: grid; gap: 1rem 1.25rem; margin-bottom: 1.5rem; }
@media (min-width: 768px) {
    .ce-card:has(.ce-form-grid) { max-width: 46rem; }
    .ce-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ce-form-grid__wide { grid-column: 1 / -1; }
}
