/* ============================================================
   Market Hisab — Auth (login) styles
   ============================================================ */

:root {
    --auth-brand-1: #1e1b4b;
    --auth-brand-2: #312e81;
    --auth-brand-3: #4c1d95;
    --auth-accent: #a78bfa;
    --auth-success: #34d399;
    --auth-danger: #ef4444;
    --auth-ink: #0f172a;
    --auth-muted: #64748b;
    --auth-line: #e2e8f0;
    --auth-bg: #f8fafc;
    --auth-radius: 16px;

    /* Force Bootstrap light mode */
    --bs-body-bg: #ffffff;
    --bs-body-color: #0f172a;
    --bs-body-color-rgb: 15, 23, 42;
}

/* ---------- Reset / body ---------- */
html, body { color-scheme: light; }

.auth-body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--auth-bg);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--auth-ink);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

html[dir="rtl"] .auth-body,
html[dir="rtl"] .auth-body * {
    font-family: 'Noto Nastaliq Urdu', serif;
}

/* ---------- Shell ---------- */
.auth-shell {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    min-height: 100vh;
    min-height: 100dvh;
}

/* ============================================================
   Brand panel
   ============================================================ */
.auth-brand {
    position: relative;
    overflow: hidden;
    padding: 48px 56px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #fff;
    background: linear-gradient(145deg, var(--auth-brand-1) 0%, var(--auth-brand-2) 45%, var(--auth-brand-3) 100%);
}

.auth-brand__pattern {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 15%, rgba(167, 139, 250, 0.25) 0, transparent 45%),
        radial-gradient(circle at 80% 85%, rgba(139, 92, 246, 0.35) 0, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.03) 0, transparent 60%);
    pointer-events: none;
}

.auth-brand__pattern::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
    background-size: 22px 22px;
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}

.auth-brand__top,
.auth-brand__features,
.auth-brand__foot {
    position: relative;
    z-index: 1;
}

.auth-brand__mark {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    display: grid;
    place-items: center;
    font-size: 1.9rem;
    color: var(--auth-accent);
    margin-bottom: 28px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.auth-brand__title {
    font-size: clamp(1.85rem, 3.2vw, 2.6rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0 0 12px;
    line-height: 1.1;
}

.auth-brand__tagline {
    font-size: 1rem;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.72);
    max-width: 380px;
    margin: 0;
}

.auth-brand__features {
    list-style: none;
    padding: 0;
    margin: 40px 0;
    display: grid;
    gap: 16px;
}

.auth-brand__features li {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.94rem;
    color: rgba(255, 255, 255, 0.88);
    line-height: 1.45;
}

.auth-brand__features i {
    color: var(--auth-success);
    font-size: 1.15rem;
    flex-shrink: 0;
}

.auth-brand__foot {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.45);
}

/* ============================================================
   Form panel
   ============================================================ */
.auth-form-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 32px;
    background: #ffffff;
}

.auth-lang {
    position: absolute;
    top: 28px;
    inset-inline-end: 28px;
    display: inline-flex;
    gap: 2px;
    background: var(--auth-bg);
    border: 1px solid var(--auth-line);
    border-radius: 10px;
    padding: 4px;
    z-index: 2;
}

.auth-lang a {
    padding: 6px 14px;
    border-radius: 7px;
    text-decoration: none;
    color: var(--auth-muted);
    font-weight: 600;
    font-size: 0.82rem;
    transition: all 0.15s ease;
}

.auth-lang a:hover { color: var(--auth-ink); }

.auth-lang a.is-active {
    background: #fff;
    color: var(--auth-brand-2);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 12px 8px;
}

.auth-card__head {
    margin-bottom: 28px;
}

.auth-card__mark {
    display: none;
}

.auth-card__head h2 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0 0 8px;
    color: var(--auth-ink);
}

.auth-card__head p {
    font-size: 0.94rem;
    color: var(--auth-muted);
    margin: 0;
}

/* ---------- Alerts ---------- */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 0.88rem;
    line-height: 1.5;
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.auth-alert i { font-size: 1rem; margin-top: 2px; flex-shrink: 0; }

.auth-alert--success {
    background: #ecfdf5;
    color: #065f46;
    border-color: #a7f3d0;
}
.auth-alert--success i { color: var(--auth-success); }

.auth-alert--danger {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}
.auth-alert--danger i { color: var(--auth-danger); }

/* ---------- Fields ---------- */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-field > label {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--auth-ink);
    letter-spacing: 0.01em;
}

.auth-input {
    position: relative;
    display: flex;
    align-items: center;
    background: #fff;
    border: 1.5px solid var(--auth-line);
    border-radius: 12px;
    transition: all 0.18s ease;
}

.auth-input:focus-within {
    background: #fff !important;
    border-color: var(--auth-brand-2);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}

.auth-input > i {
    position: absolute;
    inset-inline-start: 16px;
    color: var(--auth-muted);
    font-size: 1.05rem;
    pointer-events: none;
    transition: color 0.18s ease;
}

.auth-input:focus-within > i { color: var(--auth-brand-2); }

.auth-input input {
    flex: 1;
    border: 0;
    background: transparent;
    padding: 14px 16px 14px 46px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--auth-ink);
    border-radius: 12px;
    outline: none;
    min-height: 52px;
}

html[dir="rtl"] .auth-input input {
    padding: 14px 46px 14px 16px;
}

.auth-input input::placeholder { color: #cbd5e1; }

.auth-toggle {
    background: transparent;
    border: 0;
    padding: 0 16px;
    color: var(--auth-muted);
    cursor: pointer;
    font-size: 1.05rem;
    height: 100%;
    display: grid;
    place-items: center;
    border-start-end-radius: 12px;
    border-end-end-radius: 12px;
    transition: color 0.15s;
}

.auth-toggle:hover { color: var(--auth-brand-2); }

.auth-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.auth-check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    color: var(--auth-muted);
    cursor: pointer;
    user-select: none;
}

.auth-check input {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--auth-line);
    border-radius: 5px;
    background: #fff;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all 0.15s;
    flex-shrink: 0;
}

.auth-check input:checked {
    background: var(--auth-brand-2);
    border-color: var(--auth-brand-2);
}

.auth-check input:checked::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translateY(-1px);
}

/* ---------- Submit ---------- */
.auth-submit {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 54px;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    color: #fff;
    background: linear-gradient(135deg, var(--auth-brand-2), var(--auth-brand-3));
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.32);
    margin-top: 4px;
}

.auth-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 26px rgba(79, 70, 229, 0.42);
}

.auth-submit:active { transform: translateY(0); }

.auth-submit:disabled {
    opacity: 0.75;
    cursor: not-allowed;
    transform: none;
}

.auth-submit__arrow {
    font-size: 1.1rem;
    transition: transform 0.2s;
}

html[dir="ltr"] .auth-submit:hover .auth-submit__arrow {
    transform: translateX(3px);
}
html[dir="rtl"] .auth-submit:hover .auth-submit__arrow {
    transform: translateX(-3px);
}

html[dir="rtl"] .auth-submit__arrow {
    transform: scaleX(-1);
}

.auth-help {
    margin-top: 28px;
    font-size: 0.82rem;
    color: var(--auth-muted);
    text-align: center;
    line-height: 1.6;
}

/* ============================================================
   Responsive — tablet & mobile
   ============================================================ */
@media (max-width: 991px) {
    .auth-shell {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .auth-brand {
        padding: 32px 28px;
        min-height: auto;
    }

    .auth-brand__mark { width: 52px; height: 52px; font-size: 1.5rem; margin-bottom: 16px; }
    .auth-brand__title { font-size: 1.5rem; margin-bottom: 6px; }
    .auth-brand__tagline { font-size: 0.9rem; max-width: none; }
    .auth-brand__features { display: none; }
    .auth-brand__foot { display: none; }

    .auth-form-wrap { padding: 32px 20px 40px; }
}

@media (max-width: 640px) {
    .auth-brand { padding: 24px 20px; }
    .auth-brand__mark { width: 44px; height: 44px; font-size: 1.25rem; margin-bottom: 12px; }
    .auth-brand__title { font-size: 1.25rem; }
    .auth-brand__tagline { display: none; }

    .auth-form-wrap { padding: 24px 16px 32px; }
    .auth-lang { top: 16px; inset-inline-end: 16px; }
    .auth-lang a { padding: 5px 12px; font-size: 0.78rem; }

    .auth-card { padding: 8px 0; }
    .auth-card__head { margin-bottom: 22px; }
    .auth-card__head h2 { font-size: 1.4rem; }

    .auth-form { gap: 16px; }
    .auth-input input { padding-block: 12px; min-height: 50px; font-size: 16px; }
}

/* Landscape phones & small tablets */
@media (max-width: 991px) and (orientation: landscape) and (max-height: 500px) {
    .auth-brand { display: none; }
    .auth-form-wrap { padding-top: 60px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .auth-submit,
    .auth-submit__arrow,
    .auth-input { transition: none !important; }
}

/* ============================================================
   Force light theme on auth inputs — prevent dark flash
   ============================================================ */

.auth-input input,
.auth-input input:focus,
.auth-input input:focus-visible,
.auth-input input:-webkit-autofill,
.auth-input input:-webkit-autofill:hover,
.auth-input input:-webkit-autofill:focus {
    background-color: transparent !important;
    color: var(--auth-ink) !important;
    -webkit-text-fill-color: var(--auth-ink) !important;
    caret-color: var(--auth-ink) !important;
    box-shadow: none !important;
    outline: 0 !important;
}

/* Chrome autofill — kill the blue/yellow overlay */
.auth-input input:-webkit-autofill,
.auth-input input:-webkit-autofill:hover,
.auth-input input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
    transition: background-color 5000s ease-in-out 0s !important;
}

/* Whole input wrapper keeps white on focus */
.auth-input:focus-within {
    background: #fff !important;
}

/* Password reveal button — no dark background ever */
.auth-toggle,
.auth-toggle:focus,
.auth-toggle:focus-visible {
    background: transparent !important;
    box-shadow: none !important;
    outline: 0 !important;
}

/* Remember-me checkbox — keep white background on focus */
.auth-check input,
.auth-check input:focus,
.auth-check input:focus-visible {
    background-color: #fff !important;
    box-shadow: none !important;
    outline: 0 !important;
}

.auth-check input:checked,
.auth-check input:checked:focus {
    background-color: var(--auth-brand-2) !important;
}
