/* ============================================================
   auth.css - sign in / register / reset / verify
   ============================================================
   These pages never loaded the design system, so while the rest of the
   app was rebuilt they kept the old look: flat panels, mismatched
   inputs, buttons that belonged to a different product.

   This layer sits on top of login.css / register.css / reset_password.css
   and brings them onto the same tokens as everything else. The page
   structure (split brand panel + form card + the Tibeb strip) is kept,
   because that structure is good - only its finish changes.

   Loaded AFTER melhik-ui.css, so the tokens are available.
   ============================================================ */

/* ---------------- Shell ---------------- */

body {
    background: var(--mk-canvas) !important;
    color: var(--mk-ink) !important;
    font-family: var(--mk-font-ui) !important;
}

.auth-shell {
    min-height: 100vh;
    min-height: 100dvh;
}

/* ---------------- Brand panel ---------------- */

.brand-panel {
    background: var(--mk-brand-panel, #0B2E33) !important;
    color: #F8F4EE !important;
    width: 44%;
    min-width: 24rem;
    position: relative;
    overflow: hidden;
}
/* A very quiet radial lift so the panel is not a flat block of navy. */
.brand-panel::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(90% 60% at 18% 0%, rgba(20, 145, 127, 0.16), transparent 60%),
        radial-gradient(70% 50% at 100% 100%, rgba(44, 110, 118, 0.22), transparent 65%);
    pointer-events: none;
}
.brand-panel > * { position: relative; z-index: 1; }

.brand-panel-inner { padding: 2.25rem 2.75rem 2.5rem; }

.brand-row .word {
    font-family: var(--mk-font-display);
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.01em;
    color: #F8F4EE;
}
.brand-eyebrow {
    font-family: var(--mk-font-ui);
    font-size: var(--mk-text-xs);
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #E8A05E;
    margin-top: 1.25rem;
}
.brand-amh {
    font-family: var(--mk-font-ethiopic), var(--mk-font-ui);
    font-size: var(--mk-text-md);
    color: rgba(248, 244, 238, 0.82);
    margin-top: 0.375rem;
    line-height: var(--mk-leading-snug);
}

.feature-list { padding-top: 1.75rem; }
.feature-item { gap: 0.75rem; margin-bottom: 1.125rem; align-items: flex-start; }
.feature-item .dot {
    width: 0.375rem; height: 0.375rem;
    background: #E8A05E;
    margin-top: 0.5rem;
}
.feature-item b {
    font-family: var(--mk-font-display);
    font-size: var(--mk-text-base);
    font-weight: 700;
    color: #F8F4EE;
    letter-spacing: -0.005em;
}
.feature-item span {
    font-size: var(--mk-text-sm);
    color: rgba(248, 244, 238, 0.66);
    line-height: var(--mk-leading-snug);
}

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

.form-panel { padding: var(--mk-space-6) var(--mk-space-5); }

.form-card {
    width: min(26rem, 100%);
    background: var(--mk-surface) !important;
    border: 1px solid var(--mk-line) !important;
    border-radius: var(--mk-radius-xl) !important;
    box-shadow: var(--mk-shadow-lg) !important;
    padding: var(--mk-space-8) var(--mk-space-6) !important;
    backdrop-filter: none !important;
}

.form-title {
    font-family: var(--mk-font-display) !important;
    font-size: var(--mk-text-2xl) !important;
    font-weight: 700 !important;
    letter-spacing: -0.022em;
    color: var(--mk-ink) !important;
    margin-bottom: 0.25rem !important;
}
.form-subtitle {
    font-size: var(--mk-text-md) !important;
    color: var(--mk-ink-2) !important;
    margin-bottom: var(--mk-space-6) !important;
    line-height: var(--mk-leading-snug);
}

/* display/width are pinned rather than left to Bootstrap: if the CDN is
   slow or blocked, the label and field would otherwise sit side by side
   and the form would look broken on exactly the page where a first-time
   visitor forms their impression. */
.form-label {
    display: block !important;
    font-size: var(--mk-text-sm) !important;
    font-weight: 600 !important;
    color: var(--mk-ink-2) !important;
    margin-bottom: 0.375rem !important;
}
.form-card .form-control,
.form-card .btn-auth,
.form-card .btn-google {
    display: block;
    width: 100%;
}
.form-card .btn-auth, .form-card .btn-google { display: inline-flex; }

.form-control {
    background: var(--mk-surface-2) !important;
    border: 1px solid var(--mk-line-strong) !important;
    border-radius: var(--mk-radius-sm) !important;
    color: var(--mk-ink) !important;
    font-size: var(--mk-text-md) !important;
    padding: 0.625rem 0.875rem !important;
    transition: border-color var(--mk-fast), box-shadow var(--mk-fast), background var(--mk-fast) !important;
}
.form-control:focus {
    background: var(--mk-surface) !important;
    border-color: var(--mk-accent) !important;
    box-shadow: 0 0 0 3px var(--mk-accent-wash) !important;
}
.form-control::placeholder { color: var(--mk-ink-3) !important; }

/* ---------------- Buttons ---------------- */

.btn-auth {
    width: 100%;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--mk-accent) !important;
    color: #FFFFFF !important;
    border: 1px solid var(--mk-accent) !important;
    border-radius: var(--mk-radius-sm) !important;
    font-family: var(--mk-font-ui) !important;
    font-size: var(--mk-text-md) !important;
    font-weight: 600 !important;
    padding: 0.6875rem 1rem !important;
    box-shadow: var(--mk-shadow-xs) !important;
    transition: background var(--mk-fast), transform var(--mk-fast) !important;
}
.btn-auth:hover {
    background: var(--mk-accent-ink) !important;
    border-color: var(--mk-accent-ink) !important;
    color: #FFFFFF !important;
}
.btn-auth:active { transform: translateY(0.5px); }
.dark-theme .btn-auth { color: #07191C !important; }
.dark-theme .btn-auth:hover { background: #6FD6C6 !important; color: #07191C !important; }

.btn-google {
    width: 100%;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--mk-surface) !important;
    color: var(--mk-ink) !important;
    border: 1px solid var(--mk-line-strong) !important;
    border-radius: var(--mk-radius-sm) !important;
    font-size: var(--mk-text-md) !important;
    font-weight: 600 !important;
    padding: 0.625rem 1rem !important;
    transition: background var(--mk-fast), border-color var(--mk-fast) !important;
}
.btn-google:hover {
    background: var(--mk-surface-2) !important;
    border-color: var(--mk-ink-3) !important;
    color: var(--mk-ink) !important;
}

/* ---------------- Bits ---------------- */

.divider {
    display: flex;
    align-items: center;
    gap: var(--mk-space-3);
    margin: var(--mk-space-5) 0;
    font-size: var(--mk-text-xs);
    color: var(--mk-ink-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--mk-line);
}

.otp-input {
    background: var(--mk-surface-2) !important;
    border: 1px solid var(--mk-line-strong) !important;
    border-radius: var(--mk-radius-sm) !important;
    color: var(--mk-ink) !important;
    font-family: var(--mk-font-display) !important;
    font-size: 1.375rem !important;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: center;
    letter-spacing: 0.25em;
    padding: 0.75rem !important;
}
.otp-input:focus {
    border-color: var(--mk-accent) !important;
    box-shadow: 0 0 0 3px var(--mk-accent-wash) !important;
    background: var(--mk-surface) !important;
}

.error, .success, .maint-banner {
    border-radius: var(--mk-radius) !important;
    font-size: var(--mk-text-base) !important;
    padding: 0.75rem 0.875rem !important;
    border: 1px solid transparent !important;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    line-height: var(--mk-leading-snug);
}
.error { background: var(--mk-danger-wash) !important; color: var(--mk-danger) !important; }
.success { background: var(--mk-success-wash) !important; color: var(--mk-success) !important; }
.maint-banner { background: var(--mk-warning-wash) !important; color: var(--mk-warning) !important; }

.twofa-hint { font-size: var(--mk-text-sm); color: var(--mk-ink-3); }

.form-check-label { font-size: var(--mk-text-sm); color: var(--mk-ink-2); }
.form-check-input {
    background-color: var(--mk-surface) !important;
    border-color: var(--mk-line-strong) !important;
}
.form-check-input:checked {
    background-color: var(--mk-accent) !important;
    border-color: var(--mk-accent) !important;
}

/* Links under the form */
.form-card a {
    color: var(--mk-accent-ink) !important;
    font-weight: 600;
}
.form-card a:hover { color: var(--mk-accent) !important; text-decoration: underline; }

/* ---------------- Floating controls ---------------- */

.back-home {
    position: fixed;
    top: var(--mk-space-4);
    left: var(--mk-space-4);
    z-index: 20;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.4375rem 0.75rem;
    border-radius: var(--mk-radius-pill);
    background: rgba(248, 244, 238, 0.12);
    color: #F8F4EE !important;
    font-size: var(--mk-text-sm);
    font-weight: 600;
    backdrop-filter: blur(6px);
    transition: background var(--mk-fast);
}
.back-home:hover { background: rgba(248, 244, 238, 0.22); color: #fff !important; }

.theme-toggle-wrapper {
    position: fixed;
    top: var(--mk-space-4);
    right: var(--mk-space-4);
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.theme-toggle-wrapper .theme-label {
    font-size: var(--mk-text-xs);
    color: var(--mk-ink-3);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.theme-toggle-wrapper .theme-toggle {
    width: 34px; height: 34px;
    border-radius: var(--mk-radius-sm);
    background: var(--mk-surface) !important;
    border: 1px solid var(--mk-line) !important;
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: var(--mk-shadow-xs);
}

/* ---------------- Mobile ---------------- */

@media (max-width: 900px) {
    .auth-shell { flex-direction: column; }
    .brand-panel {
        width: 100%;
        min-width: 0;
        min-height: auto;
    }
    .brand-panel-inner { padding: 1.5rem 1.5rem 1.75rem; }
    /* The feature list and illustration are nice-to-have on a phone and
       push the actual form below the fold, so they step aside. */
    .ship-wrap, .feature-list { display: none; }
    .form-panel { padding: var(--mk-space-5) var(--mk-space-4) var(--mk-space-10); }
    .form-card {
        border: none !important;
        box-shadow: none !important;
        padding: var(--mk-space-5) 0 !important;
        background: transparent !important;
    }
    .back-home, .theme-toggle-wrapper { position: static; }
    .theme-toggle-wrapper { justify-content: flex-end; padding: 0.5rem 1rem 0; }
}


/* ============================================================
   Brand panel v2 - used by login / register / reset_password
   (markup: app/auth_brand.php). Always dark: it is a brand surface,
   not a themed one, so it does not follow light/dark.
   ============================================================ */
.brand-panel--v2 {
    background:
        radial-gradient(120% 80% at 0% 0%, #14484F 0%, rgba(20, 72, 79, 0) 55%),
        radial-gradient(90% 70% at 100% 100%, #10393F 0%, rgba(16, 57, 63, 0) 60%),
        linear-gradient(160deg, #0B2E33 0%, #082428 100%) !important;
    color: #F8F4EE !important;
    isolation: isolate;
}
.brand-panel--v2::after { display: none; }
.brand-panel--v2 .brand-panel-inner {
    display: flex; flex-direction: column; gap: 1.5rem;
    min-height: 100%;
    padding: 2rem clamp(1.5rem, 3.4vw, 3rem) 1.75rem;
}
.brand-panel--v2 .brand-row { gap: .625rem; }
.brand-panel--v2 .brand-row .word { letter-spacing: .08em; font-size: 1.25rem; }

/* soft light + a faint grid give depth without a heavy image */
.bp-glow { position: absolute; z-index: -1; border-radius: 50%; filter: blur(60px); pointer-events: none; }
.bp-glow--a { width: 22rem; height: 22rem; top: -7rem; left: -6rem; background: rgba(20, 145, 127, .30); }
.bp-glow--b { width: 20rem; height: 20rem; bottom: -6rem; right: -5rem; background: rgba(44, 140, 150, .30); }
.bp-grid {
    position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
    background-image:
        linear-gradient(rgba(248, 244, 238, .045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(248, 244, 238, .045) 1px, transparent 1px);
    background-size: 44px 44px;
    -webkit-mask-image: radial-gradient(75% 65% at 50% 40%, #000 30%, transparent 100%);
            mask-image: radial-gradient(75% 65% at 50% 40%, #000 30%, transparent 100%);
}

.bp-copy { margin-top: .5rem; }
.bp-pill {
    display: inline-flex; align-items: center; gap: .375rem;
    padding: .25rem .75rem; border-radius: 999px;
    background: rgba(20, 145, 127, .16); border: 1px solid rgba(232, 160, 94, .35);
    color: #F2B676; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
.bp-title {
    margin: .875rem 0 .625rem;
    font-family: var(--mk-font-display, 'Space Grotesk', sans-serif);
    font-size: clamp(1.625rem, 2.5vw, 2.25rem);
    line-height: 1.12; letter-spacing: -.025em; font-weight: 700;
    color: #FFFFFF; text-wrap: balance;
}
.bp-sub { margin: 0; max-width: 30rem; color: rgba(248, 244, 238, .74); font-size: 1rem; line-height: 1.55; }

/* ---- product preview ---- */
.bp-stage { position: relative; margin: .25rem 0 .5rem; padding: 0 1.5rem 1.75rem 0; max-width: 31rem; }
.bp-card {
    background: rgba(255, 255, 255, .075);
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 16px;
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, .28);
}
.bp-card--main { padding: 1rem 1.125rem 1.125rem; }
.bp-card__head { display: flex; align-items: center; gap: .625rem; margin-bottom: .875rem; }
.bp-dotrow { display: inline-flex; gap: 5px; }
.bp-dotrow i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, .28); display: block; }
.bp-card__title { font-weight: 700; font-size: .875rem; color: #FFF; flex: 1; }
.bp-chip { font-size: .6875rem; font-weight: 700; padding: .125rem .5rem; border-radius: 999px; }
.bp-chip--ok { background: rgba(88, 196, 130, .2); color: #7FDDA3; }
.bp-bars { display: flex; align-items: flex-end; gap: .5rem; height: 4.5rem; margin-bottom: .875rem; }
.bp-bars span {
    flex: 1; height: var(--h); border-radius: 6px 6px 3px 3px;
    background: linear-gradient(180deg, #F2B676, #14917F);
    opacity: .9;
}
.bp-bars span:nth-child(-n+4) { background: linear-gradient(180deg, rgba(248, 244, 238, .55), rgba(248, 244, 238, .25)); }
.bp-rows { display: grid; gap: .375rem; }
.bp-row {
    display: flex; align-items: center; gap: .625rem;
    padding: .5rem .625rem; border-radius: 10px; background: rgba(255, 255, 255, .06);
    font-size: .8125rem; min-width: 0;
}
.bp-row i { color: #F2B676; font-size: 1rem; flex: none; }
.bp-row b { flex: 1; min-width: 0; font-weight: 600; color: #FFF; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp-row em { font-style: normal; color: rgba(248, 244, 238, .65); font-size: .75rem; flex: none; }

.bp-card--float {
    position: absolute; display: flex; align-items: center; gap: .625rem;
    padding: .625rem .875rem .625rem .75rem;
    background: rgba(8, 36, 40, .82);
}
.bp-card--float strong { display: block; font-size: .8125rem; color: #FFF; line-height: 1.2; }
.bp-card--float small { display: block; font-size: .6875rem; color: rgba(248, 244, 238, .66); margin-top: 2px; }
.bp-card--a { right: 0; top: 1.25rem; }
.bp-card--b { left: 1rem; bottom: 0; }
.bp-card--b > i { color: #F2B676; font-size: 1.125rem; }
.bp-ring {
    --p: 70; width: 2.375rem; height: 2.375rem; border-radius: 50%; flex: none;
    display: grid; place-items: center;
    background: conic-gradient(#7FDDA3 calc(var(--p) * 1%), rgba(255, 255, 255, .15) 0);
    position: relative;
}
.bp-ring::before { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: #0A2C31; }
.bp-ring b { position: relative; font-size: .6875rem; color: #FFF; }

.bp-points { list-style: none; margin: auto 0 0; padding: 0; display: grid; gap: .5rem; }
.bp-points li { display: flex; align-items: flex-start; gap: .625rem; font-size: .9375rem; color: rgba(248, 244, 238, .86); line-height: 1.4; }
.bp-points i {
    flex: none; width: 1.25rem; height: 1.25rem; margin-top: .0625rem; border-radius: 50%;
    display: grid; place-items: center; font-size: .8125rem;
    background: rgba(20, 145, 127, .2); color: #F2B676;
}
.bp-foot { display: flex; align-items: center; gap: .5rem; font-size: .8125rem; color: rgba(248, 244, 238, .55); padding-top: .75rem; border-top: 1px solid rgba(255, 255, 255, .1); }

/* Short laptop screens: drop the mock-up, keep the message and points */
@media (max-height: 720px) and (min-width: 901px) {
    .bp-stage { display: none; }
    .brand-panel--v2 .brand-panel-inner { gap: 1.125rem; }
}
@media (max-width: 1100px) and (min-width: 901px) {
    .bp-card--a { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
    .bp-card--a { animation: none; }
    .bp-card--b { animation: none; }
    @keyframes bp-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
}

/* Phones / small tablets: the panel collapses to a compact banner (the
   existing 900px rule hides .ship-wrap and .feature-list, which this
   version replaces, so hide the heavier parts here). */
@media (max-width: 900px) {
    .brand-panel--v2 .brand-panel-inner { padding: 1.25rem 1.25rem 1.5rem; gap: .75rem; min-height: 0; }
    .bp-stage, .bp-points, .bp-foot, .bp-sub { display: none; }
    .bp-title { font-size: 1.375rem; margin: .5rem 0 0; }
    .bp-copy { margin-top: 0; }
}

/* ---------- Theme toggle on auth pages: a single 34px icon button.
   login.css / theme.css describe an oversized pill with a sliding dot;
   it is reset here (same treatment as the app's top bar). ---------- */
.theme-toggle-wrapper {
    background: transparent !important; border: 0 !important; padding: 0 !important;
    min-height: 0 !important; backdrop-filter: none !important; box-shadow: none !important;
}
.theme-toggle-wrapper .theme-label { display: none !important; }
.theme-toggle-wrapper .theme-toggle {
    position: relative;
    width: 34px !important; height: 34px !important; min-width: 34px;
    border-radius: var(--mk-radius-sm) !important;
    background: var(--mk-surface) !important;
    border: 1px solid var(--mk-line-strong) !important;
    color: var(--mk-ink-2) !important;
    display: inline-grid !important; place-items: center;
    cursor: pointer; box-shadow: var(--mk-shadow-xs);
}
.theme-toggle-wrapper .theme-toggle:hover { background: var(--mk-surface-3) !important; color: var(--mk-ink) !important; }
.theme-toggle-wrapper .theme-toggle:focus-visible { outline: 2px solid var(--mk-accent); outline-offset: 2px; }
.theme-toggle-wrapper .theme-toggle .dot { display: none !important; }
.theme-toggle-wrapper .theme-toggle .icon-sun,
.theme-toggle-wrapper .theme-toggle .icon-moon {
    position: static; transform: none; grid-area: 1 / 1; font-size: 1rem; line-height: 1; opacity: 1; color: inherit;
}
.light-theme .theme-toggle-wrapper .icon-sun,
.dark-theme  .theme-toggle-wrapper .icon-moon { display: none; }

/* "Back to Melhik" is fixed top-left; give the logo row room so they never overlap */
@media (min-width: 901px) {
    .brand-panel--v2 .brand-panel-inner { padding-top: 4.25rem; }
}
/* floating preview cards: sit around the main card, never on its text */
.bp-stage { margin-top: 1.5rem; padding-bottom: 2.75rem; }
.bp-card--a { top: -1.5rem; right: -.25rem; }
.bp-card--b { bottom: .25rem; left: 1.5rem; }
