:root {
    --primary: #6366f1;
    --primary-dark: #4338ca;
    --primary-light: #a5b4fc;
    --accent: #0ea5e9;
    --bg-base: #0b0e14;
    --bg-panel: #0f1420;
    --bg-surface: #131a28;
    --bg-card: #121826;
    --border: #1f2838;
    --border-light: #293349;
    --text-primary: #eef1f7;
    --text-secondary: #99a3b8;
    --text-muted: #5f6b84;
    --gold: #c9a876;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    justify-content: center;
    background: var(--bg-base);
    font-family: 'Inter', sans-serif;
    position: relative;
    overflow: hidden;
}

html[lang="ar"] body {
    font-family: 'Cairo', sans-serif;
}

.shell {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* ---------- Brand / corporate panel ---------- */
.brand-panel {
    flex: 1 1 46%;
    max-width: 560px;
    position: relative;
    background:
        linear-gradient(165deg, #0c1120 0%, #0b1a2e 48%, #0a1422 100%);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 3.2rem 3.2rem 2.4rem;
    overflow: hidden;
}
html[dir="rtl"] .brand-panel {
    border-right: none;
    border-left: 1px solid var(--border);
}
.brand-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(201,168,118,0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(201,168,118,0.045) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: linear-gradient(180deg, rgba(0,0,0,0.9), rgba(0,0,0,0.15));
    pointer-events: none;
}
.brand-panel::after {
    content: '';
    position: absolute;
    width: 520px; height: 520px;
    background: radial-gradient(circle, rgba(99,102,241,0.14) 0%, transparent 70%);
    border-radius: 50%;
    bottom: -220px;
    left: -180px;
    pointer-events: none;
}
html[dir="rtl"] .brand-panel::after {
    left: auto;
    right: -180px;
}

.brand-top { position: relative; z-index: 2; }
.brand-top img { height: 40px; width: auto; object-fit: contain; }

.brand-mid { position: relative; z-index: 2; margin-top: auto; margin-bottom: auto; padding: 2.5rem 0; }
.brand-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 1.1rem;
}
.brand-eyebrow::before { content: ''; width: 22px; height: 1px; background: var(--gold); }
.brand-mid h2 {
    font-size: 2rem;
    line-height: 1.3;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    max-width: 420px;
}
.brand-mid p {
    margin-top: 1rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
    max-width: 400px;
    line-height: 1.7;
}

.brand-features {
    position: relative;
    z-index: 2;
    margin-top: 2.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}
.brand-feature {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.86rem;
    color: var(--text-secondary);
}
.brand-feature i {
    width: 30px; height: 30px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(99,102,241,0.12);
    border: 1px solid rgba(99,102,241,0.25);
    border-radius: 8px;
    color: var(--primary-light);
    font-size: 0.85rem;
}

.brand-bottom { position: relative; z-index: 2; }
.status-strip {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    padding: 1rem 1.2rem;
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    flex-wrap: wrap;
}
.status-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}
.status-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 7px rgba(34,197,94,0.75);
    flex-shrink: 0;
    animation: pulse-dot 2.2s infinite;
}
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.status-divider { width: 1px; height: 14px; background: var(--border-light); }
.status-value { color: var(--text-primary); font-weight: 700; }

.brand-copy {
    margin-top: 1.1rem;
    font-size: 0.74rem;
    color: var(--text-muted);
    letter-spacing: 0.2px;
}

/* ---------- Form panel ---------- */
.form-panel {
    flex: 1 1 54%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem;
    background: var(--bg-base);
    position: relative;
}

/* Language switcher */
.lang-switcher {
    position: absolute;
    top: 1.75rem;
    right: 1.75rem;
    z-index: 100;
}
html[dir="rtl"] .lang-switcher {
    right: auto;
    left: 1.75rem;
}
.lang-switcher .dropdown-toggle {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    padding: 0.45rem 0.95rem;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    transition: all 0.3s;
}
.lang-switcher .dropdown-toggle:hover,
.lang-switcher .dropdown-toggle:focus {
    border-color: var(--primary);
    color: var(--primary-light);
    box-shadow: none;
}
.lang-switcher .dropdown-menu {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 0.4rem;
    min-width: 130px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}
.lang-switcher .dropdown-item {
    color: var(--text-secondary);
    border-radius: 6px;
    padding: 0.5rem 0.9rem;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.lang-switcher .dropdown-item:hover {
    background: rgba(99,102,241,0.12);
    color: var(--primary-light);
}

.login-wrapper {
    width: 100%;
    max-width: 400px;
    animation: fadeInUp 0.6s ease-out both;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-brand-mobile { display: none; text-align: center; margin-bottom: 2rem; }
.login-brand-mobile img { height: 44px; }

.login-head { margin-bottom: 2.2rem; }
.login-head .kicker {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--primary-light);
    margin-bottom: 0.6rem;
}
.login-head h1 {
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    margin-bottom: 0.4rem;
}
.login-head p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Form elements */
.form-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 0.5rem;
    display: block;
}

.input-wrap {
    position: relative;
    margin-bottom: 1.3rem;
}
.input-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 1rem;
    color: var(--text-muted);
    font-size: 1rem;
    pointer-events: none;
    transition: color 0.3s;
    z-index: 2;
}
html[dir="rtl"] .input-icon {
    left: auto;
    right: 1rem;
}
.form-control {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    border-radius: 10px;
    padding: 0.85rem 1rem 0.85rem 2.8rem;
    font-size: 0.95rem;
    width: 100%;
    transition: all 0.3s;
}
html[dir="rtl"] .form-control {
    padding: 0.85rem 2.8rem 0.85rem 1rem;
}
.form-control:focus {
    background: var(--bg-surface);
    border-color: var(--primary);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
    outline: none;
}
.form-control:focus + .input-icon,
.input-wrap:focus-within .input-icon {
    color: var(--primary-light);
}
.form-control::placeholder { color: var(--text-muted); }

/* Password toggle */
.pw-toggle {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 1rem;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    transition: color 0.3s;
    z-index: 2;
    background: none;
    border: none;
    padding: 0;
}
html[dir="rtl"] .pw-toggle {
    right: auto;
    left: 1rem;
}
.pw-toggle:hover { color: var(--primary-light); }

/* Submit button */
.btn-login {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 0.9rem;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.92rem;
    letter-spacing: 0.2px;
    width: 100%;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    margin-top: 0.3rem;
}
.btn-login:hover {
    box-shadow: 0 10px 28px rgba(79,70,229,0.35);
    transform: translateY(-1px);
}
.btn-login:active { transform: translateY(0); }

/* Alerts */
.alert {
    border-radius: 10px;
    padding: 0.9rem 1.1rem;
    margin-bottom: 1.25rem;
    font-size: 0.88rem;
    border: none;
}
.alert-success {
    background: rgba(16,185,129,0.12);
    border: 1px solid rgba(16,185,129,0.25);
    color: #34d399;
}
.alert-danger {
    background: rgba(239,68,68,0.12);
    border: 1px solid rgba(239,68,68,0.25);
    color: #f87171;
}
.alert ul { margin: 0.4rem 0 0; padding-left: 1.25rem; }
html[dir="rtl"] .alert ul { padding-left: 0; padding-right: 1.25rem; }

.form-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.75rem 0 1.5rem;
}
.form-divider::before, .form-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}
.form-divider span {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.security-note {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
}
.security-note i { margin-top: 0.1rem; color: var(--text-muted); }

/* Footer */
.login-footer {
    text-align: left;
    margin-top: 2.5rem;
    color: var(--text-muted);
    font-size: 0.78rem;
}
html[dir="rtl"] .login-footer {
    text-align: right;
}
.login-footer a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.3s;
}
.login-footer a:hover {
    color: var(--primary-light);
}
.login-footer .footer-links {
    margin-top: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.login-footer .footer-links .dot-sep {
    color: var(--border-light);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

@media (max-width: 991px) {
    .brand-panel { display: none; }
    .login-brand-mobile { display: block; }
    .form-panel { padding: 2rem 1.25rem; }
}
