/*
 * Kenya Technicians — Auth layout styles
 * Covers: login, forgot-password, reset-password, change-password,
 *         verify-2fa, select-role, account-locked, suspended
 */

/* ── Shell / page ───────────────────────────────────────────────────── */
.auth-body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--kt-bg);
}

/* The brand mark is fixed/floating everywhere else in the app, but on
   auth pages it's placed in normal document flow instead — it renders
   as the first item in .auth-body, above .auth-shell, so on short or
   narrow screens it pushes the card down instead of overlapping it. */
.auth-body .kt-brand {
    position: static;
    margin: 1.5rem 0 0 1.5rem;
}

.auth-shell {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1.25rem 2.5rem;
}

/* ── Card ───────────────────────────────────────────────────────────── */
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--kt-surface);
    border: 1px solid var(--kt-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 2.25rem 2rem;
}

.auth-card--wide {
    max-width: 520px;
}

/* ── Header ─────────────────────────────────────────────────────────── */
.auth-header {
    text-align: center;
    margin-bottom: 1.875rem;
}

.auth-header .icon-badge {
    margin: 0 auto 1.25rem;
}

.auth-header h1 {
    font-size: 1.5rem;
    color: var(--kt-text);
    margin-bottom: .375rem;
}

.auth-header p {
    font-size: .875rem;
    color: var(--kt-text-muted);
    line-height: 1.6;
}

/* ── Divider with label ─────────────────────────────────────────────── */
.auth-divider {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: 1.5rem 0;
    color: var(--kt-text-faint);
    font-size: .775rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--kt-border);
}

/* ── Footer links ───────────────────────────────────────────────────── */
.auth-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: .825rem;
    color: var(--kt-text-muted);
}

.auth-footer a {
    color: var(--kt-primary);
    font-weight: 600;
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.auth-footer .sep {
    margin: 0 .5rem;
    color: var(--kt-border);
}

/* ── Back link ──────────────────────────────────────────────────────── */
.auth-back {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    font-size: .825rem;
    font-weight: 600;
    color: var(--kt-text-muted);
    text-decoration: none;
    margin-bottom: 1.5rem;
    transition: color var(--transition);
}

.auth-back svg {
    width: 15px;
    height: 15px;
    stroke-width: 2.2;
    flex-shrink: 0;
}

.auth-back:hover {
    color: var(--kt-text);
}

/* ── Code / OTP input row ───────────────────────────────────────────── */
.otp-row {
    display: flex;
    gap: .625rem;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.otp-row input {
    width: 52px;
    height: 56px;
    text-align: center;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: .05em;
    color: var(--kt-text);
    background: var(--kt-surface);
    border: 1.5px solid var(--kt-border);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition), box-shadow var(--transition);
    padding: 0;
    font-family: var(--font);
}

.otp-row input:focus {
    outline: none;
    border-color: var(--kt-primary);
    box-shadow: 0 0 0 3px var(--kt-primary-light);
}

.otp-row input.otp-filled {
    border-color: var(--kt-primary);
    background: var(--kt-primary-light);
}

/* ── Role selector grid ─────────────────────────────────────────────── */
.role-grid {
    display: flex;
    flex-direction: column;
    gap: .625rem;
    margin-bottom: 1.5rem;
}

.role-card {
    display: flex;
    align-items: center;
    gap: .875rem;
    padding: .875rem 1rem;
    background: var(--kt-surface);
    border: 1.5px solid var(--kt-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
    position: relative;
}

.role-card:hover {
    border-color: var(--kt-primary);
    box-shadow: 0 0 0 3px var(--kt-primary-light);
    background: #fafffe;
}

.role-card.role-card--active {
    border-color: var(--kt-primary);
    background: var(--kt-primary-light);
}

.role-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.role-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--kt-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--kt-text-muted);
    transition: background var(--transition), color var(--transition);
}

.role-icon svg {
    width: 18px;
    height: 18px;
    stroke-width: 1.8;
}

.role-card:hover .role-icon,
.role-card.role-card--active .role-icon {
    background: var(--kt-primary);
    color: #fff;
}

.role-info {
    flex: 1;
    min-width: 0;
}

.role-name {
    font-size: .9rem;
    font-weight: 700;
    color: var(--kt-text);
    display: block;
    margin-bottom: 1px;
}

.role-account {
    font-size: .78rem;
    color: var(--kt-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.role-badge {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: .2rem .6rem;
    border-radius: var(--radius-pill);
    flex-shrink: 0;
}

.role-badge--staff {
    background: var(--kt-secondary-light);
    color: var(--kt-secondary-dark);
}

.role-badge--client {
    background: var(--kt-primary-light);
    color: var(--kt-primary-dark);
}

.role-check {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid var(--kt-border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background var(--transition), border-color var(--transition);
}

.role-card.role-card--active .role-check {
    background: var(--kt-primary);
    border-color: var(--kt-primary);
}

.role-check svg {
    width: 11px;
    height: 11px;
    stroke: #fff;
    stroke-width: 2.5;
    opacity: 0;
    transition: opacity var(--transition);
}

.role-card.role-card--active .role-check svg {
    opacity: 1;
}

/* ── Password strength bar ──────────────────────────────────────────── */
.strength-bar {
    display: flex;
    gap: 3px;
    margin-top: .5rem;
}

.strength-bar span {
    flex: 1;
    height: 3px;
    border-radius: var(--radius-pill);
    background: var(--kt-border);
    transition: background .25s ease;
}

.strength-bar[data-level="1"] span:nth-child(1) { background: var(--kt-accent); }
.strength-bar[data-level="2"] span:nth-child(-n+2) { background: #f59e0b; }
.strength-bar[data-level="3"] span:nth-child(-n+3) { background: #3b82f6; }
.strength-bar[data-level="4"] span { background: var(--kt-primary); }

.strength-label {
    font-size: .73rem;
    color: var(--kt-text-faint);
    margin-top: .35rem;
    display: block;
}

/* ── Locked / suspended state card ─────────────────────────────────── */
.auth-state-card {
    text-align: center;
}

.auth-state-card .countdown {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--kt-text);
    letter-spacing: -.03em;
    margin: .25rem 0;
    font-variant-numeric: tabular-nums;
}

.auth-state-card .countdown-label {
    font-size: .8rem;
    color: var(--kt-text-faint);
}

/* ── Toast notifications ───────────────────────────────────────────── */
.auth-toast-stack {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 60;
    display: flex;
    flex-direction: column;
    gap: .625rem;
    width: 340px;
    max-width: calc(100% - 2.5rem);
}

.auth-toast {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: .625rem;
    padding: .875rem 2.25rem .875rem 1rem;
    background: var(--kt-surface);
    border: 1px solid var(--kt-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    animation: kt-toast-in .25s cubic-bezier(.2,.9,.3,1.2) forwards;
}

.auth-toast.is-leaving {
    animation: kt-toast-out .2s ease forwards;
}

@keyframes kt-toast-in {
    from { opacity: 0; transform: translateX(24px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes kt-toast-out {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(24px); }
}

.auth-toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 1px;
}

.auth-toast-icon svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.auth-toast--success .auth-toast-icon { color: var(--kt-primary); }
.auth-toast--error   .auth-toast-icon { color: #b42318; }
.auth-toast--info    .auth-toast-icon { color: #3b82f6; }

.auth-toast-message {
    flex: 1;
    font-size: .84rem;
    line-height: 1.5;
    color: var(--kt-text);
}

.auth-toast-close {
    position: absolute;
    top: .625rem;
    right: .625rem;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 50%;
    color: var(--kt-text-faint);
    cursor: pointer;
    padding: 0;
    transition: background var(--transition), color var(--transition);
}

.auth-toast-close:hover {
    background: var(--kt-bg);
    color: var(--kt-text);
}

.auth-toast-close svg {
    width: 12px;
    height: 12px;
    stroke-width: 2.4;
}

.auth-toast-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 2.5px;
    width: 100%;
    background: var(--kt-border);
}

.auth-toast-progress::after {
    content: '';
    display: block;
    height: 100%;
    width: 100%;
    background: currentColor;
    transform-origin: left;
    animation: kt-toast-progress linear forwards;
    animation-duration: inherit;
}

.auth-toast--success .auth-toast-progress { color: var(--kt-primary); }
.auth-toast--error   .auth-toast-progress { color: #b42318; }
.auth-toast--info    .auth-toast-progress { color: #3b82f6; }

.auth-toast.is-paused .auth-toast-progress::after {
    animation-play-state: paused;
}

@keyframes kt-toast-progress {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

@media (max-width: 480px) {
    .auth-toast-stack {
        top: .875rem;
        right: .875rem;
        left: .875rem;
        width: auto;
        max-width: none;
    }
}

/* ── Input icon fix ────────────────────────────────────────────────── */
/* .field-toggle sits inside .input-wrap; forcibly override any base.css
   rule that positions all descendant svgs of .input-wrap absolutely,
   so the toggle's own icons stay inside the button at every viewport
   width instead of escaping the field on narrow screens. */
.auth-body .input-wrap {
    position: relative !important;
}

.auth-body .input-wrap > svg:first-child {
    position: absolute !important;
    top: 50% !important;
    left: 14px !important;
    right: auto !important;
    transform: translateY(-50%) !important;
    width: 18px !important;
    height: 18px !important;
    pointer-events: none !important;
}

.auth-body .field-toggle {
    position: absolute !important;
    top: 50% !important;
    right: 10px !important;
    left: auto !important;
    bottom: auto !important;
    transform: translateY(-50%) !important;
    width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--kt-text-faint);
    cursor: pointer;
    padding: 0;
    margin: 0;
    z-index: 2;
    transition: color var(--transition), background var(--transition);
}

.auth-body .field-toggle:hover {
    color: var(--kt-text);
    background: var(--kt-bg);
}

.auth-body .field-toggle svg {
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
    width: 17px !important;
    height: 17px !important;
    stroke-width: 1.8;
    pointer-events: none;
    margin: 0;
}

.auth-body .input-wrap:has(.field-toggle) input {
    padding-right: 44px !important;
}

@media (max-width: 480px) {
    .auth-body .field-toggle {
        position: absolute !important;
        top: 50% !important;
        right: 8px !important;
        transform: translateY(-50%) !important;
    }
    .auth-body .field-toggle svg {
        position: static !important;
        transform: none !important;
    }
}

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .auth-body .kt-brand {
        margin: 1.125rem 0 0 1.125rem;
    }

    .auth-shell {
        padding: 1.25rem .875rem 2rem;
        align-items: flex-start;
    }

    .auth-card {
        padding: 1.75rem 1.25rem;
        border-radius: var(--radius-md);
        box-shadow: none;
        border-color: transparent;
        background: transparent;
    }

    .otp-row input {
        width: 44px;
        height: 50px;
        font-size: 1.2rem;
    }
}