/* Kayan auth — branded split-screen shell + form skin.
   Depends on marketing.css tokens (--k-*). */

.k-auth {
    position: relative;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: clamp(24px, 5vw, 56px) 20px;
    background: var(--k-bg);
    color: var(--k-text);
}

/* ---- top-corner toggles ---- */
.k-auth__chrome {
    position: fixed;
    top: 18px;
    inset-inline-end: 20px;
    z-index: 1060;
    display: flex;
    gap: 10px;
}

/* =========================================================
   Soft branded backdrop (blurred blobs behind the card)
   ========================================================= */
.k-auth__bg { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.k-auth__blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.28;
}
.k-auth__blob--1 { width: 460px; height: 460px; background: #4f46e5; inset-inline-start: -120px; top: -120px; }
.k-auth__blob--2 { width: 400px; height: 400px; background: #22d3ee; inset-inline-end: -120px; bottom: -120px; }
.k-auth__blob--3 { width: 320px; height: 320px; background: #7c3aed; inset-inline-start: 40%; top: 55%; opacity: 0.20; }
[data-bs-theme="dark"] .k-auth__blob { opacity: 0.36; }
[data-bs-theme="dark"] .k-auth__blob--3 { opacity: 0.26; }

/* =========================================================
   Centered card
   ========================================================= */
.k-auth__center {
    position: relative;
    z-index: 1;
    width: 100%;
    display: flex;
    justify-content: center;
}

.k-auth__card {
    width: 100%;
    max-width: 440px;
    background: var(--k-surface);
    border: 1px solid var(--k-border);
    border-radius: var(--k-radius);
    box-shadow: var(--k-shadow-lg);
    padding: clamp(28px, 4vw, 44px);
}

/* logo at the top of the card */
.k-auth__logo { display: flex; justify-content: center; margin-bottom: 26px; }

/* wizard (register) uses a wider card so fields sit two-up instead of scrolling */
.k-auth__card:has(.k-steps) { max-width: 600px; }

/* two inputs side by side; collapses to one column on small screens */
.k-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; align-items: start; }
@media (max-width: 575.98px) {
    .k-field-row { grid-template-columns: 1fr; gap: 0; }
}

.k-auth__heading { font-size: clamp(1.5rem, 3vw, 1.9rem); font-weight: 800; letter-spacing: -0.02em; margin: 0 0 8px; color: var(--k-text); text-align: center; }
.k-auth__subtext { color: var(--k-text-muted); font-size: 1rem; margin: 0 0 26px; line-height: 1.6; text-align: center; }

/* ---- fields ---- */
/* flex-column keeps the label pinned above the input even when a grid row
   stretches the cell taller than its content */
.k-field { margin-bottom: 18px; display: flex; flex-direction: column; align-items: stretch; }
.k-field__label { display: block; font-weight: 600; font-size: 0.92rem; margin-bottom: 8px; color: var(--k-text); text-align: start; }

.k-input {
    width: 100%;
    background: var(--k-surface);
    border: 1px solid var(--k-line);
    border-radius: var(--k-radius-sm);
    color: var(--k-text);
    padding: 12px 15px;
    font-size: 1rem;
    line-height: 1.4;
    transition: border-color 0.2s var(--k-ease), box-shadow 0.2s var(--k-ease), background 0.2s var(--k-ease);
}
.k-input::placeholder { color: var(--k-text-muted); opacity: 0.75; }
/* keep every field (incl. type=email/url/tel, which browsers force LTR) aligned to the reading direction */
[dir="rtl"] .k-input { text-align: right; }
[dir="ltr"] .k-input { text-align: left; }
.k-input:focus {
    outline: none;
    border-color: var(--k-indigo);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.22);
    background: var(--k-surface);
}
.k-input.is-invalid { border-color: #ef4444; }
.k-input.is-invalid:focus { box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18); }

.k-field__error { display: block; color: #ef4444; font-size: 0.86rem; margin-top: 6px; text-align: start; }
/* persistent error slots stay in the DOM (filled by JS or Blade) but take no
   space until they hold a message */
.k-field__error:empty { display: none; margin: 0; }

/* ---- remember + forgot row ---- */
.k-auth__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin: 4px 0 24px;
    font-size: 0.92rem;
}
.k-check { display: inline-flex; align-items: center; gap: 8px; color: var(--k-text); cursor: pointer; user-select: none; }
.k-check input {
    width: 17px;
    height: 17px;
    accent-color: var(--k-indigo);
    cursor: pointer;
}
.k-auth__link { color: var(--k-indigo); font-weight: 600; text-decoration: none; }
.k-auth__link:hover { text-decoration: underline; }

/* A submit button that must read as a plain inline link (sign-out inside a POST
   form — it cannot be an <a> without losing CSRF). */
.k-auth__linkbtn { border: 0; background: transparent; padding: 0; cursor: pointer; font: inherit; }

/* ---- verification result: success mark ---- */
.k-verify__icon { display: flex; justify-content: center; margin-bottom: 18px; }
.k-verify__icon .ki-duotone { font-size: 4rem; color: #10b981; line-height: 1; }

/* ---- verification notice: the account's own address ---- */
.k-verify__address {
    margin: -12px 0 22px;
    padding: 12px 16px;
    border-radius: 12px;
    background: rgba(79, 70, 229, 0.08);
    border: 1px solid rgba(79, 70, 229, 0.22);
    color: var(--k-text);
    font-weight: 600;
    text-align: center;
    word-break: break-all;
}

/* ---- submit ---- */
.k-auth__submit { width: 100%; justify-content: center; margin-top: 4px; }

/* ---- footer link ---- */
.k-auth__foot { text-align: center; margin-top: 22px; color: var(--k-text-muted); font-size: 0.95rem; }

/* ---- register: section headers ---- */
.k-auth__section {
    font-weight: 700;
    font-size: 0.82rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--k-text-muted);
    margin: 26px 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--k-border);
}
.k-auth__section:first-of-type { margin-top: 4px; }

/* ---- native select styled like .k-input ---- */
select.k-input { cursor: pointer; appearance: none; -webkit-appearance: none; padding-inline-end: 40px; }
select.k-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235a627e' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}
[dir="rtl"] select.k-input { background-position: left 14px center; padding-inline-end: 40px; }

/* ---- register: plan selector cards (two-up on the wider wizard card) ---- */
.k-plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 575.98px) {
    .k-plan-grid { grid-template-columns: 1fr; }
}
.k-plan-opt { display: block; cursor: pointer; position: relative; }
.k-plan-opt input { position: absolute; opacity: 0; pointer-events: none; }
.k-plan-opt__body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 16px;
    border: 1.5px solid var(--k-line);
    border-radius: var(--k-radius-sm);
    transition: border-color 0.2s var(--k-ease), box-shadow 0.2s var(--k-ease), background 0.2s var(--k-ease);
}
.k-plan-opt:hover .k-plan-opt__body { border-color: var(--k-indigo); }
.k-plan-opt input:checked + .k-plan-opt__body {
    border-color: var(--k-indigo);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
    background: rgba(99, 102, 241, 0.06);
}
.k-plan-opt input:focus-visible + .k-plan-opt__body { box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.30); }
.k-plan-opt__name { font-weight: 700; color: var(--k-text); }
.k-plan-opt__price { font-weight: 800; color: var(--k-indigo); white-space: nowrap; }
.k-plan-opt__price small { font-weight: 500; color: var(--k-text-muted); }
.k-plan-hint { color: var(--k-text-muted); font-size: 0.85rem; margin: 10px 0 0; text-align: center; }

/* =========================================================
   Register wizard
   ========================================================= */
/* stepper header */
.k-steps {
    list-style: none;
    display: flex;
    gap: 6px;
    margin: 0 0 24px;
    padding: 0;
    counter-reset: kstep;
}
.k-steps__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--k-text-muted);
    text-align: center;
    position: relative;
}
.k-steps__item::before {
    counter-increment: kstep;
    content: counter(kstep);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 800;
    background: var(--k-surface);
    color: var(--k-text-muted);
    border: 1.5px solid var(--k-line);
    transition: all 0.25s var(--k-ease);
}
/* connector line between dots */
.k-steps__item::after {
    content: "";
    position: absolute;
    top: 15px;
    height: 2px;
    width: calc(100% - 30px);
    inset-inline-start: calc(50% + 15px);
    background: var(--k-line);
    z-index: 0;
}
.k-steps__item:last-child::after { display: none; }
.k-steps__item span { position: relative; z-index: 1; }
.k-steps__item.is-active { color: var(--k-indigo); }
.k-steps__item.is-active::before { border-color: var(--k-indigo); color: var(--k-indigo); box-shadow: 0 0 0 4px rgba(99,102,241,0.14); }
.k-steps__item.is-done { color: var(--k-text); }
.k-steps__item.is-done::before { background: var(--k-indigo); border-color: var(--k-indigo); color: #fff; content: "\2713"; }
.k-steps__item.is-done::after { background: var(--k-indigo); }

/* step panels: only hide via [hidden] once JS is active (no-JS = all visible) */
.k-wizard--js .k-step[hidden] { display: none; }

/* nav row */
.k-wizard-nav { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.k-wizard-grow { flex: 1; justify-content: center; }
.k-wizard-nav .k-btn--ghost { flex-shrink: 0; }

/* review list (confirm step) */
.k-review { margin: 0; display: flex; flex-direction: column; gap: 2px; }
.k-review > div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 11px 2px;
    border-bottom: 1px solid var(--k-border);
}
.k-review > div:last-child { border-bottom: 0; }
.k-review dt { margin: 0; color: var(--k-text-muted); font-size: 0.9rem; }
.k-review dd { margin: 0; font-weight: 600; color: var(--k-text); text-align: end; word-break: break-word; }

/* ---- alerts ---- */
.k-alert {
    border-radius: var(--k-radius-sm);
    padding: 12px 15px;
    font-size: 0.92rem;
    margin-bottom: 20px;
    line-height: 1.5;
    border: 1px solid transparent;
}
.k-alert--danger { background: rgba(239, 68, 68, 0.10); border-color: rgba(239, 68, 68, 0.30); color: #b91c1c; }
.k-alert--success { background: rgba(16, 185, 129, 0.10); border-color: rgba(16, 185, 129, 0.30); color: #047857; }
.k-alert ul { margin: 0; padding-inline-start: 18px; }
[data-bs-theme="dark"] .k-alert--danger { color: #fca5a5; }
[data-bs-theme="dark"] .k-alert--success { color: #6ee7b7; }

/* =========================================================
   Responsive — card goes edge-to-edge on small screens
   ========================================================= */
@media (max-width: 575.98px) {
    .k-auth { padding: 20px 14px; }
    .k-auth__card { box-shadow: var(--k-shadow); }
}

/* =========================================================
   Reduced motion
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
    .k-input, .k-auth__card { transition: none; }
}

/* =========================================================
   Legal links under the auth card
   ========================================================= */
.k-auth__center { flex-direction: column; align-items: center; }

.k-auth__legal {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 22px;
    font-size: 0.88rem;
    color: var(--k-text-muted);
}
.k-auth__legal a { color: var(--k-text-muted); text-decoration: none; transition: color 0.2s var(--k-ease); }
.k-auth__legal a:hover { color: var(--k-indigo); text-decoration: underline; }
[data-bs-theme="dark"] .k-auth__legal a:hover { color: #a5b4fc; }
