/* ════════════════════════════════════════════════════════════════
   Nahdha Login — formal enterprise design
   Shared across: /login /admin/login /instructor/login /consultant/login /moderator/login
   ════════════════════════════════════════════════════════════════ */

:root {
    --nh-primary:         #203526;
    --nh-primary-hover:   #142319;
    --nh-secondary:       #51ba74;
    --nh-secondary-hover: #45a565;

    --bg:           #f4f6f5;
    --surface:      #ffffff;
    --stroke:       rgba(32, 53, 38, 0.10);
    --stroke-strong:rgba(32, 53, 38, 0.18);
    --fg:           #0a0d12;
    --fg-2:         #4f545d;
    --fg-3:         #8a8f99;
    --input-bg:     #ffffff;
    --shadow-card:  0 1px 2px rgba(10,13,18,0.04), 0 12px 32px rgba(32,53,38,0.08);
}
.dark {
    --bg:           #06080f;
    --surface:      #0c0f17;
    --stroke:       rgba(255, 255, 255, 0.08);
    --stroke-strong:rgba(255, 255, 255, 0.14);
    --fg:           #f1f5f9;
    --fg-2:         #94a3b8;
    --fg-3:         #64748b;
    --input-bg:     #11151f;
    --shadow-card:  0 1px 2px rgba(0,0,0,0.5), 0 16px 40px rgba(0,0,0,0.55);
}

* { box-sizing: border-box; }

html, body {
    font-family: 'IBM Plex Sans Arabic', 'Degular', sans-serif;
    background: var(--bg);
    color: var(--fg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
[dir="rtl"] body { line-height: 1.75; }
::selection { background: color-mix(in srgb, var(--nh-secondary) 25%, transparent); color: var(--fg); }

/* ─── Top utility bar ─── */
.nh-topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 50;
    display: flex; justify-content: flex-end; align-items: center;
    gap: 0.5rem;
    padding: 1.25rem 1.5rem;
    pointer-events: none;
}
.nh-topbar > * { pointer-events: auto; }

.nh-util-btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    height: 38px;
    padding: 0 0.95rem;
    border-radius: 9999px;
    background: var(--surface);
    border: 1px solid var(--stroke);
    color: var(--fg-2);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.18s ease, color 0.18s ease, transform 0.15s ease;
    box-shadow: 0 1px 2px rgba(10,13,18,0.04);
}
.nh-util-btn:hover { border-color: var(--stroke-strong); color: var(--fg); transform: translateY(-1px); }
.nh-util-btn.is-icon { width: 38px; padding: 0; justify-content: center; }
.nh-util-btn i { font-size: 0.9rem; }

/* ─── Page shell ─── */
.nh-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr;
}
@media (min-width: 1024px) {
    .nh-shell { grid-template-columns: 1fr 1.05fr; }
}

/* ─── Brand column ─── */
.nh-brand {
    display: none;
    position: relative;
    background: var(--nh-primary);
    color: #ffffff;
    padding: 4rem 3.5rem;
    overflow: hidden;
}
@media (min-width: 1024px) { .nh-brand { display: flex; flex-direction: column; } }

.nh-brand::before {
    content: "";
    position: absolute; inset: 0;
    background-image: linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 100% 60px;
    pointer-events: none;
    opacity: 0.6;
}

.nh-brand-top {
    position: relative; z-index: 1;
    display: flex; align-items: center; gap: 0.85rem;
    margin-bottom: auto;
}
.nh-brand-logo { height: 40px; width: auto; object-fit: contain; }
.nh-brand-logo-text { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.02em; }

.nh-brand-mid { position: relative; z-index: 1; max-width: 540px; margin: auto 0; }

.nh-brand-eyebrow {
    display: inline-flex; align-items: center; gap: 0.55rem;
    font-size: 0.7rem; font-weight: 700;
    letter-spacing: 0.22em; text-transform: uppercase;
    color: rgba(255, 255, 255, 0.65);
    margin-bottom: 1.5rem;
}
.nh-brand-eyebrow-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--nh-secondary); }

.nh-brand-title {
    font-size: clamp(2rem, 4vw, 3.25rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.03em;
    color: #ffffff;
    margin: 0 0 1.25rem;
}

.nh-brand-lead {
    font-size: 1rem;
    line-height: 1.85;
    color: rgba(255, 255, 255, 0.72);
    margin: 0;
    max-width: 44ch;
}

.nh-brand-divider { width: 64px; height: 3px; background: var(--nh-secondary); border-radius: 3px; margin: 2rem 0 0; }

.nh-brand-bot {
    position: relative; z-index: 1;
    margin-top: auto;
    padding-top: 2.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.10);
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.55);
    gap: 1rem;
}
.nh-brand-bot a { color: rgba(255, 255, 255, 0.72); text-decoration: none; transition: color 0.18s ease; }
.nh-brand-bot a:hover { color: var(--nh-secondary); }

/* ─── Form column ─── */
.nh-form-col {
    display: flex; align-items: center; justify-content: center;
    padding: 5rem 1.5rem 3rem;
    min-height: 100vh;
    background: var(--bg);
}
@media (min-width: 640px) { .nh-form-col { padding: 5rem 2.5rem 3rem; } }

.nh-card {
    width: 100%;
    max-width: 440px;
    background: var(--surface);
    border: 1px solid var(--stroke);
    border-radius: 20px;
    padding: 2.25rem 2rem;
    box-shadow: var(--shadow-card);
    animation: nhFadeUp 0.55s ease-out both;
}
@media (min-width: 640px) { .nh-card { padding: 2.75rem 2.5rem; } }

@keyframes nhFadeUp {
    0%   { opacity: 0; transform: translateY(12px); }
    100% { opacity: 1; transform: translateY(0); }
}

.nh-mobile-mark { display: flex; justify-content: center; margin-bottom: 1.75rem; }
.nh-mobile-mark img { height: 44px; width: auto; object-fit: contain; }
@media (min-width: 1024px) { .nh-mobile-mark { display: none; } }

.nh-card-head { margin-bottom: 1.75rem; }
.nh-card-eyebrow {
    display: inline-flex; align-items: center; gap: 0.5rem;
    font-size: 0.68rem; font-weight: 700;
    letter-spacing: 0.2em; text-transform: uppercase;
    color: var(--fg-3);
    margin-bottom: 0.75rem;
}
.nh-card-eyebrow-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--nh-secondary); }
.nh-card-title {
    font-size: 1.65rem; font-weight: 800;
    color: var(--fg);
    letter-spacing: -0.025em; line-height: 1.2;
    margin: 0 0 0.5rem;
}
.nh-card-sub { font-size: 0.92rem; color: var(--fg-2); margin: 0; }

.nh-stack { display: flex; flex-direction: column; gap: 1.1rem; }

.nh-field-label { display: block; font-size: 0.83rem; font-weight: 600; color: var(--fg); margin-bottom: 0.5rem; }

.nh-input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--stroke-strong);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--fg);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
    outline: none;
}
.nh-input::placeholder { color: var(--fg-3); }
.nh-input:focus {
    border-color: var(--nh-secondary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--nh-secondary) 20%, transparent);
}
.nh-input.is-error { border-color: #ef4444; }
.nh-input.is-error:focus { box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18); }

.nh-field-error {
    font-size: 0.8rem;
    color: #dc2626;
    margin-top: 0.4rem;
    display: flex; align-items: center; gap: 0.4rem;
}
.dark .nh-field-error { color: #f87171; }

.nh-pw-wrap { position: relative; }
.nh-pw-toggle {
    position: absolute;
    inset-inline-end: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: 0;
    color: var(--fg-3);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 0.9rem;
    transition: color 0.15s ease;
}
.nh-pw-toggle:hover { color: var(--nh-secondary); }

.nh-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.nh-check-row { display: inline-flex; align-items: center; gap: 0.55rem; cursor: pointer; user-select: none; }
.nh-check {
    appearance: none;
    width: 17px; height: 17px;
    border: 1.5px solid var(--stroke-strong);
    border-radius: 4px;
    background: var(--input-bg);
    cursor: pointer;
    position: relative;
    transition: all 0.15s ease;
    flex-shrink: 0;
}
.nh-check:hover { border-color: var(--nh-secondary); }
.nh-check:checked { background: var(--nh-primary); border-color: var(--nh-primary); }
.dark .nh-check:checked { background: var(--nh-secondary); border-color: var(--nh-secondary); }
.nh-check:checked::after {
    content: "";
    position: absolute;
    inset-inline-start: 5px;
    top: 2px;
    width: 5px; height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.dark .nh-check:checked::after { border-color: #06080f; }
.nh-check-label { font-size: 0.86rem; color: var(--fg-2); }

.nh-link { font-size: 0.86rem; font-weight: 600; color: var(--nh-primary); text-decoration: none; transition: color 0.18s ease; }
.dark .nh-link { color: var(--nh-secondary); }
.nh-link:hover { color: var(--nh-secondary); }
.dark .nh-link:hover { color: var(--fg); }

.nh-submit {
    width: 100%;
    background: var(--nh-primary);
    color: #ffffff;
    border: 0;
    border-radius: 10px;
    padding: 0.95rem 1.5rem;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.12s ease;
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    margin-top: 0.25rem;
}
.nh-submit:hover { background: var(--nh-primary-hover); }
.nh-submit:active { transform: translateY(1px); }
.nh-submit:disabled { opacity: 0.7; cursor: not-allowed; }
.dark .nh-submit { background: var(--nh-secondary); color: #06080f; }
.dark .nh-submit:hover { background: var(--nh-secondary-hover); }

.nh-divider {
    display: flex; align-items: center; gap: 0.85rem;
    color: var(--fg-3);
    font-size: 0.72rem; font-weight: 700;
    letter-spacing: 0.16em; text-transform: uppercase;
    margin: 1.5rem 0;
}
.nh-divider::before, .nh-divider::after { content: ""; flex: 1; height: 1px; background: var(--stroke); }

.nh-card-foot {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: var(--fg-3);
}
.nh-card-foot a { color: var(--fg-2); text-decoration: none; font-weight: 600; transition: color 0.18s ease; }
.nh-card-foot a:hover { color: var(--nh-secondary); }

/* Alternative-portals strip — small links to other login portals */
.nh-portals {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--stroke);
    display: flex; flex-wrap: wrap; gap: 0.4rem 0.85rem;
    align-items: center; justify-content: center;
    font-size: 0.78rem;
}
.nh-portals-label { color: var(--fg-3); font-weight: 600; }
.nh-portal-link {
    display: inline-flex; align-items: center; gap: 0.35rem;
    color: var(--fg-2);
    text-decoration: none;
    font-weight: 600;
    padding: 0.3rem 0.7rem;
    border-radius: 9999px;
    border: 1px solid var(--stroke);
    transition: all 0.18s ease;
}
.nh-portal-link:hover {
    color: var(--nh-secondary);
    border-color: color-mix(in srgb, var(--nh-secondary) 40%, var(--stroke));
}
.nh-portal-link i { font-size: 0.78rem; opacity: 0.7; }

/* Panes */
.nh-pane { display: none; }
.nh-pane.is-active { display: block; }

.nh-success-icon {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--nh-secondary) 14%, transparent);
    color: var(--nh-secondary);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    margin: 0 auto 1.25rem;
    border: 1.5px solid color-mix(in srgb, var(--nh-secondary) 30%, transparent);
}

/* ── Register / extended-form helpers ────────────────────────── */
.nh-grid-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.1rem;
}
@media (min-width: 640px) {
    .nh-grid-2 { grid-template-columns: 1fr 1fr; }
}

.nh-req {
    color: #dc2626;
    font-weight: 700;
}
.dark .nh-req { color: #f87171; }

.nh-field-hint {
    margin-top: 0.4rem;
    font-size: 0.78rem;
    color: var(--fg-3);
    display: inline-flex; align-items: center; gap: 0.4rem;
}
.nh-field-hint i { font-size: 0.75rem; color: var(--nh-secondary); }

.nh-hint-box {
    background: color-mix(in srgb, var(--nh-secondary) 5%, transparent);
    border: 1px dashed color-mix(in srgb, var(--nh-secondary) 30%, transparent);
    border-radius: 12px;
    padding: 0.9rem 1rem;
    font-size: 0.82rem;
    color: var(--fg-2);
}
.nh-hint-box strong {
    color: var(--fg);
    display: block;
    font-size: 0.83rem;
    margin-bottom: 0.4rem;
    font-weight: 700;
}
.nh-hint-box ul {
    list-style: none;
    padding: 0; margin: 0;
}
.nh-hint-box li {
    position: relative;
    padding-inline-start: 1.1rem;
    line-height: 1.6;
}
.nh-hint-box li::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 0.6em;
    width: 5px; height: 5px;
    border-radius: 50%;
    background: var(--nh-secondary);
}

.nh-notice {
    background: color-mix(in srgb, #f59e0b 8%, transparent);
    border: 1px solid color-mix(in srgb, #f59e0b 30%, transparent);
    border-radius: 12px;
    padding: 1rem;
    color: #b45309;
    display: inline-flex; align-items: center; gap: 0.6rem;
    font-weight: 600;
    margin-bottom: 1rem;
    width: 100%;
}
.dark .nh-notice {
    color: #fbbf24;
    background: color-mix(in srgb, #f59e0b 12%, transparent);
}

/* Step indicator (for multi-step register) */
.nh-steps {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0.5rem 0;
}
.nh-step {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--fg-3);
    font-weight: 600;
}
.nh-step-num {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--input-bg);
    border: 1.5px solid var(--stroke-strong);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}
.nh-step.is-active .nh-step-num {
    background: var(--nh-primary);
    border-color: var(--nh-primary);
    color: #fff;
}
.dark .nh-step.is-active .nh-step-num {
    background: var(--nh-secondary);
    border-color: var(--nh-secondary);
    color: #06080f;
}
.nh-step.is-active { color: var(--fg); }
.nh-step.is-done .nh-step-num {
    background: color-mix(in srgb, var(--nh-secondary) 18%, transparent);
    border-color: var(--nh-secondary);
    color: var(--nh-secondary);
}
.nh-step-bar {
    flex: 1; height: 2px;
    background: var(--stroke);
    border-radius: 2px;
}

/* Success card content */
.nh-success-wrap { text-align: center; padding: 0.5rem 0; }
.nh-success-wrap .nh-card-title { margin-bottom: 0.5rem; }
.nh-success-wrap .nh-card-sub { margin-bottom: 1.75rem; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
