/*
 * EvtoanERP — Auth CSS
 * File: public/css/auth.css
 * Design system for all authentication pages.
 * Bootstrap 5 loaded via CDN in layout — custom overrides only.
 * Font: Jost (Google Fonts) — same as E Travels design system.
 */

/* ── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Jost:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

/* ── Design tokens ────────────────────────────────────────── */
:root {
    --ff:             'Jost', system-ui, sans-serif;

    /* Brand — resolves from dynamic vars injected by the layout <style> block */
    --accent:         var(--ev-primary,       #6C5CE7);
    --accent-h:       var(--ev-primary-h,     #5a4bd6);
    --accent-light:   var(--ev-primary-light, rgba(108, 92, 231, .10));
    --accent-ring:    var(--ev-primary-ring,  rgba(108, 92, 231, .18));

    /* Surfaces */
    --page-bg:        #F0F2F5;
    --card-bg:        #ffffff;
    --card-border:    rgba(0, 0, 0, .07);
    --card-radius:    16px;
    --input-bg:       #F9FAFB;
    --input-border:   rgba(0, 0, 0, .10);

    /* Text */
    --text-1:         #111827;
    --text-2:         #6B7280;
    --text-3:         #9CA3AF;

    /* Status */
    --danger-bg:      #FCEBEB;
    --danger-t:       #791F1F;
    --danger-border:  #F7C1C1;
    --success-bg:     #EAF3DE;
    --success-t:      #27500A;
    --success-border: #C0DD97;
    --info-bg:        #EEF2FF;
    --info-t:         #3730A3;
    --info-border:    #C7D2FE;
    --warn-bg:        #FAEEDA;
    --warn-t:         #633806;
    --warn-border:    #FAC775;
}

/* ── Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    min-height: 100%;
    font-family: var(--ff);
    background: var(--page-bg);
    color: var(--text-1);
    -webkit-font-smoothing: antialiased;
    font-size: 14px;
}

/* ── Auth shell ───────────────────────────────────────────── */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    position: relative;
    overflow: hidden;
}

/* Subtle ambient glow — matches E Travels page feel */
.auth-shell::before {
    content: '';
    position: fixed;
    top: -180px;
    right: -180px;
    width: 520px;
    height: 520px;
    background: radial-gradient(circle, rgba(108, 92, 231, .09) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}
.auth-shell::after {
    content: '';
    position: fixed;
    bottom: -160px;
    left: -160px;
    width: 440px;
    height: 440px;
    background: radial-gradient(circle, rgba(108, 92, 231, .06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ── Auth card ────────────────────────────────────────────── */
.auth-card {
    background: var(--card-bg);
    border-radius: var(--card-radius);
    border: 1px solid var(--card-border);
    padding: 36px 38px;
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
}
.auth-card-sm { max-width: 400px; }
.auth-card-lg { max-width: 520px; }

/* ── Logo block ───────────────────────────────────────────── */
.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 28px;
}
.auth-logo img {
    height: 48px;
    width: auto;
}
/* Dark background version of logo (SVG uses white/purple) */
.auth-logo-dark {
    background: #0E0E18;
    border-radius: 12px;
    padding: 10px 18px;
    display: inline-flex;
    align-items: center;
}
.auth-logo-dark img { height: 36px; }

/* ── Auth heading ─────────────────────────────────────────── */
.auth-heading {
    text-align: center;
    margin-bottom: 24px;
}
.auth-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-1);
    letter-spacing: -.3px;
    margin: 0 0 6px;
}
.auth-sub {
    font-size: 13px;
    color: var(--text-2);
    line-height: 1.55;
    margin: 0;
}
.auth-sub strong {
    color: var(--text-1);
    font-weight: 500;
}

/* ── Divider ──────────────────────────────────────────────── */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--card-border);
}
.auth-divider span {
    font-size: 11px;
    color: var(--text-3);
    font-weight: 500;
    white-space: nowrap;
}

/* ── Form elements ────────────────────────────────────────── */
.ev-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 5px;
    letter-spacing: .02em;
}

.ev-input {
    width: 100%;
    height: 42px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 10px;
    color: var(--text-1);
    font-size: 13px;
    font-family: var(--ff);
    padding: 0 13px;
    outline: none;
    transition: border-color .15s, box-shadow .15s, background .15s;
    -webkit-appearance: none;
}
.ev-input:focus {
    background: #fff;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}
.ev-input::placeholder { color: var(--text-3); }
.ev-input.is-invalid { border-color: #E24B4A !important; }
.ev-input.is-invalid:focus { box-shadow: 0 0 0 3px rgba(226,75,74,.12); }

/* Input with icon prefix */
.ev-input-wrap { position: relative; }
.ev-input-wrap .ev-input { padding-left: 38px; }
.ev-input-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-3);
    font-size: 15px;
    pointer-events: none;
    transition: color .15s;
}
.ev-input-wrap:focus-within .ev-input-icon { color: var(--accent); }

/* Password toggle */
.ev-pw-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-3);
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color .12s;
}
.ev-pw-toggle:hover { color: var(--text-1); }

/* Field error */
.ev-field-error {
    font-size: 11px;
    color: #E24B4A;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.ev-field-error i { font-size: 12px; }

/* ── Button system ────────────────────────────────────────── */
.ev-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    height: 42px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--ff);
    cursor: pointer;
    border: none;
    transition: background .12s, transform .1s, box-shadow .12s;
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: .01em;
}
.ev-btn:active { transform: scale(.985); }
.ev-btn i { font-size: 16px; }

.ev-btn-primary {
    background: var(--accent);
    color: #fff;
}
.ev-btn-primary:hover {
    background: var(--accent-h);
    color: #fff;
    box-shadow: 0 4px 14px rgba(108,92,231,.30);
}
.ev-btn-primary:disabled {
    opacity: .6;
    cursor: not-allowed;
    box-shadow: none;
}

.ev-btn-outline {
    background: transparent;
    border: 1px solid var(--input-border);
    color: var(--text-1);
}
.ev-btn-outline:hover { background: var(--input-bg); color: var(--text-1); }

.ev-btn-ghost {
    background: transparent;
    border: none;
    color: var(--accent);
    font-size: 13px;
    font-weight: 500;
    height: auto;
    width: auto;
    padding: 0;
    cursor: pointer;
    font-family: var(--ff);
}
.ev-btn-ghost:hover { color: var(--accent-h); text-decoration: underline; }

.ev-btn-magic {
    background: var(--accent-light);
    color: var(--accent);
    border: 1px solid rgba(108,92,231,.2);
}
.ev-btn-magic:hover {
    background: rgba(108,92,231,.15);
    color: var(--accent-h);
}

/* ── OTP input row ────────────────────────────────────────── */
.otp-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 8px 0 4px;
}
.otp-digit {
    width: 52px;
    height: 56px;
    text-align: center;
    font-size: 22px;
    font-weight: 600;
    font-family: var(--ff);
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    border-radius: 10px;
    color: var(--text-1);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    caret-color: var(--accent);
}
.otp-digit:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
    background: #fff;
}
.otp-digit.filled {
    border-color: var(--accent);
    background: var(--accent-light);
}
.otp-digit.is-invalid {
    border-color: #E24B4A;
    background: var(--danger-bg);
}

/* ── Alert / flash ────────────────────────────────────────── */
.ev-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 16px;
    line-height: 1.5;
}
.ev-alert i { font-size: 15px; flex-shrink: 0; margin-top: 1px; }
.ev-alert-close { margin-left: auto; cursor: pointer; opacity: .55; font-size: 15px; }
.ev-alert-close:hover { opacity: 1; }
.ev-alert-danger  { background: var(--danger-bg);  color: var(--danger-t);  border: 1px solid var(--danger-border); }
.ev-alert-success { background: var(--success-bg); color: var(--success-t); border: 1px solid var(--success-border); }
.ev-alert-info    { background: var(--info-bg);    color: var(--info-t);    border: 1px solid var(--info-border); }
.ev-alert-warn    { background: var(--warn-bg);    color: var(--warn-t);    border: 1px solid var(--warn-border); }

/* ── Security badge ───────────────────────────────────────── */
.auth-security-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-3);
    justify-content: center;
    margin-top: 22px;
}
.auth-security-badge i { font-size: 13px; }

/* ── Checkbox ─────────────────────────────────────────────── */
.ev-check-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-2);
    cursor: pointer;
    user-select: none;
}
.ev-check-wrap input[type="checkbox"] {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

/* ── Link ─────────────────────────────────────────────────── */
.ev-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
    transition: color .12s;
}
.ev-link:hover { color: var(--accent-h); text-decoration: underline; }

/* ── Helper text ──────────────────────────────────────────── */
.auth-footer-text {
    text-align: center;
    font-size: 13px;
    color: var(--text-3);
    margin-top: 20px;
}

/* ── QR code block ────────────────────────────────────────── */
.auth-qr-wrap {
    display: flex;
    justify-content: center;
    margin: 16px 0;
}
.auth-qr-wrap img {
    width: 160px;
    height: 160px;
    border-radius: 10px;
    border: 1px solid var(--card-border);
    padding: 8px;
    background: #fff;
}

/* ── Secret key block ─────────────────────────────────────── */
.auth-secret-wrap {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 10px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    cursor: pointer;
}
.auth-secret-key {
    flex: 1;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
    letter-spacing: .12em;
    color: var(--text-1);
    word-break: break-all;
}
.auth-secret-copy { color: var(--text-3); font-size: 15px; flex-shrink: 0; transition: color .12s; }
.auth-secret-wrap:hover .auth-secret-copy { color: var(--accent); }

/* ── Step indicator ───────────────────────────────────────── */
.auth-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 26px;
}
.auth-step {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-3);
}
.auth-step-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1.5px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-3);
    background: var(--card-bg);
    transition: all .2s;
}
.auth-step.active .auth-step-dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.auth-step.done   .auth-step-dot { background: #EAF3DE; border-color: #C0DD97; color: #27500A; }
.auth-step.active { color: var(--text-1); }
.auth-step.done   { color: var(--success-t); }
.auth-step-line   { width: 32px; height: 1px; background: var(--card-border); margin: 0 2px; }

/* ── Spinner ──────────────────────────────────────────────── */
.ev-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ev-spin .7s linear infinite;
    display: inline-block;
    flex-shrink: 0;
}
@keyframes ev-spin { to { transform: rotate(360deg); } }

/* ── Trusted device pill ──────────────────────────────────── */
.auth-device-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--success-bg);
    color: var(--success-t);
    border: 1px solid var(--success-border);
    font-weight: 500;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 480px) {
    .auth-card { padding: 28px 22px; }
    .otp-digit { width: 44px; height: 50px; font-size: 18px; }
}
