/* Dashboard login (/dashboard/login). Colors come from the logo: navy #191936, blue #1D70B7. */
:root {
    --brand: #1a5f9e;          /* buttons + links, 6.4:1 on white */
    --brand-hover: #154d82;
    --brand-ring: rgba(29, 112, 183, .28);
    --navy: #191936;
    --navy-2: #1d3360;
    --ink: #111827;            /* headings */
    --text: #374151;           /* body, 10.3:1 */
    --muted: #4b5563;          /* secondary text, 7.6:1 */
    --border: #d1d5db;
    --border-hover: #9ca3af;
    --surface: #ffffff;
    --page: #f5f7fa;
    --danger: #b42318;         /* 6.5:1 */
    --danger-bg: #fef3f2;
    --danger-border: #fecdca;
    --success: #067647;
    --success-bg: #ecfdf3;
    --success-border: #abefc6;
    --radius: 8px;
}

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

html, body { height: 100%; }

body {
    margin: 0;
    font-family: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--page);
    -webkit-font-smoothing: antialiased;
}

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

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

.auth-main {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px 16px;
    background: var(--surface);
}

.auth-form-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-form {
    width: 100%;
    max-width: 420px;
}

.auth-panel { display: none; }

@media (min-width: 1024px) {
    .auth { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); height: 100vh; overflow: hidden; }
    .auth-main { padding: 32px 48px; }
    .auth-panel { display: flex; }
}

@media (max-width: 1023px) {
    .auth-main { background: var(--page); }
    .auth-form {
        background: var(--surface);
        padding: 32px 24px;
        border: 1px solid #e5e7eb;
        border-radius: 16px;
        box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
    }
}

/* ---------- brand + heading ---------- */
.auth-logo {
    display: block;
    height: 64px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
    margin-bottom: 32px;
}

.auth-title {
    margin: 0 0 8px;
    font-size: 28px;
    line-height: 1.3;
    font-weight: 700;
    color: var(--ink);
}

.auth-subtitle {
    margin: 0 0 32px;
    font-size: 16px;
    color: var(--muted);
}

/* ---------- alerts ---------- */
.auth-alert {
    margin-bottom: 24px;
    padding: 12px 16px;
    border-radius: var(--radius);
    border: 1px solid;
    font-size: 15px;
    line-height: 1.5;
}
.auth-alert:empty { display: none; }
.auth-alert--error { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-border); }
.auth-alert--success { color: var(--success); background: var(--success-bg); border-color: var(--success-border); }

/* ---------- fields ---------- */
.field { margin-bottom: 24px; }

.field-label {
    display: block;
    margin-bottom: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
}

.field-control { position: relative; }

.field-icon {
    position: absolute;
    top: 50%;
    inset-inline-start: 14px;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: #6b7280;
    pointer-events: none;
}

.field-input {
    display: block;
    width: 100%;
    height: 48px;
    padding: 0 16px;
    padding-inline-start: 44px;
    font: inherit;
    font-size: 16px;            /* >=16px stops iOS zoom-on-focus */
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color .15s, box-shadow .15s;
}
.field-input::placeholder { color: #9ca3af; }
.field-input:hover { border-color: var(--border-hover); }
.field-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
.field-input:focus + .field-icon,
.field-control:focus-within .field-icon { color: var(--brand); }

/* email is typed LTR; keep the icon on the RTL start side but text left-aligned */
.field-input[dir="ltr"] { text-align: left; }
[dir="rtl"] .field-input[dir="ltr"] { padding-left: 16px; padding-right: 44px; }
[dir="rtl"] .field-input[dir="ltr"]::placeholder { text-align: left; }

/* password toggle sits on the left in RTL (inline-end) */
.field-input--password { padding-inline-end: 48px; }
.password-toggle {
    position: absolute;
    top: 50%;
    inset-inline-end: 4px;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
}
.password-toggle:hover { color: var(--brand); background: rgba(29, 112, 183, .08); }
.password-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 0; color: var(--brand); }
.password-toggle .icon-hide { display: none; }
.password-toggle[aria-pressed="true"] .icon-show { display: none; }
.password-toggle[aria-pressed="true"] .icon-hide { display: block; }

.field.has-error .field-input { border-color: var(--danger); }
.field.has-error .field-input:focus { box-shadow: 0 0 0 4px rgba(180, 35, 24, .18); }

.field-error {
    margin: 8px 0 0;
    font-size: 14px;
    color: var(--danger);
}
.field-error:empty { display: none; }

/* ---------- remember / forgot ---------- */
.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: -8px 0 24px;
}

.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    color: var(--text);
    cursor: pointer;
    user-select: none;
}
.checkbox input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--brand);
    cursor: pointer;
}
.checkbox input:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.auth-link {
    font-size: 15px;
    font-weight: 600;
    color: var(--brand);
    text-decoration: none;
}
.auth-link:hover { color: var(--brand-hover); text-decoration: underline; }
.auth-link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* ---------- submit ---------- */
.btn-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 48px;
    padding: 0 24px;
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background: var(--brand);
    border: 0;
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .08);
    cursor: pointer;
    transition: background-color .15s, box-shadow .15s;
}
.btn-submit:hover { background: var(--brand-hover); }
.btn-submit:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--brand-ring); }
.btn-submit:disabled { cursor: progress; opacity: .85; }
.btn-submit:disabled:hover { background: var(--brand); }

.spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
.btn-submit.is-loading .spinner { display: inline-block; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- footer ---------- */
.auth-footer {
    margin: 24px 0 0;
    text-align: center;
    font-size: 14px;
    color: var(--muted);
}

/* ---------- brand panel (>=1024px only) ---------- */
.auth-panel {
    position: relative;
    flex-direction: column;
    justify-content: center;
    padding: 48px 64px;
    color: #fff;
    background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 100%);
    overflow: hidden;
}

/* one quiet shape, no imagery */
.auth-panel::after {
    content: "";
    position: absolute;
    inset-block-end: -160px;
    inset-inline-end: -160px;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    border: 64px solid rgba(29, 112, 183, .18);
    pointer-events: none;
}

.panel-inner { position: relative; z-index: 1; max-width: 440px; }

.panel-title {
    margin: 0 0 16px;
    font-size: 32px;
    line-height: 1.3;
    font-weight: 700;
}

.panel-subtitle {
    margin: 0 0 40px;
    font-size: 17px;
    color: rgba(255, 255, 255, .82);
}

.panel-features { list-style: none; margin: 0; padding: 0; display: grid; gap: 24px; }

.panel-feature { display: flex; align-items: flex-start; gap: 16px; }

.panel-feature-icon {
    flex: none;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .14);
    color: #9fcbf0;
}
.panel-feature-icon svg { width: 24px; height: 24px; }

.panel-feature strong { display: block; font-size: 17px; font-weight: 600; color: #fff; }
.panel-feature span { display: flex; justify-content:center; align-items: center; margin-top: 2px; font-size: 15px; color: rgba(255, 255, 255, .78); }

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
    .spinner { animation-duration: 1.6s; }
}
