/* صفحة تسجيل الدخول — تصميم مقسّم (عربي RTL) بألوان النظام */
*, *::before, *::after { box-sizing: border-box; }

:root {
    --login-primary: #3b82f6;
    --login-primary-dark: #2563eb;
    --login-primary-deep: #1d4ed8;
    --login-primary-light: #60a5fa;
    --login-glass-bg: rgba(255, 255, 255, 0.94);
    --login-glass-line: rgba(148, 163, 184, 0.55);
    --login-text: #0f172a;
    --login-text-muted: #64748b;
    --login-glow: rgba(59, 130, 246, 0.45);
    --login-font-weight: 700;
    --login-font-weight-strong: 800;
}

body.login-body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
    font-weight: var(--login-font-weight);
    color: var(--login-text);
    background:
        radial-gradient(ellipse 70% 50% at 50% 0%, rgba(239, 246, 255, 0.9), transparent 60%),
        linear-gradient(180deg, #f8fafc 0%, #ffffff 45%, #f1f5f9 100%);
}

.login-shell {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem 2rem;
    overflow: hidden;
}

.login-shell::before,
.login-shell::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(64px);
    opacity: 0.35;
    pointer-events: none;
}

.login-shell::before {
    width: 18rem;
    height: 18rem;
    top: -4rem;
    right: 10%;
    background: rgba(59, 130, 246, 0.25);
}

.login-shell::after {
    width: 16rem;
    height: 16rem;
    bottom: -3rem;
    left: 8%;
    background: rgba(37, 99, 235, 0.18);
}

/* ── البطاقة المقسّمة ── */
.login-stage {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    max-width: 52rem;
    min-height: 26rem;
    border-radius: 1rem;
    overflow: hidden;
    background: var(--login-glass-bg);
    border: 1px solid rgba(59, 130, 246, 0.35);
    box-shadow:
        0 0 0 1px rgba(59, 130, 246, 0.2),
        0 0 28px var(--login-glow),
        0 24px 48px -12px rgba(15, 23, 42, 0.18);
    animation: login-fade-up 0.45s ease both;
}

/* قسم النموذج (يمين في RTL) */
.login-stage__form {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 2.25rem;
    background: linear-gradient(165deg, #ffffff 0%, #f8fafc 55%, #f1f5f9 100%);
}

.login-stage__form-inner {
    width: 100%;
    max-width: 18rem;
}

.login-stage__title {
    margin: 0 0 1.75rem;
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--login-text);
    text-align: right;
}

.login-alert {
    margin: 0 0 1rem;
    padding: 0.65rem 0.85rem;
    border-radius: 0.5rem;
    font-weight: var(--login-font-weight);
    font-size: 0.85rem;
    background: rgba(254, 242, 242, 0.9);
    border: 1px solid rgba(254, 202, 202, 0.9);
    color: #b91c1c;
    text-align: right;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* حقول بخط سفلي */
.login-line-field {
    text-align: right;
}

.login-line-field__label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--login-text);
}

.login-line-field__label--accent {
    color: var(--login-primary);
}

.login-line-field__row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    border-bottom: 1px solid var(--login-glass-line);
    padding-bottom: 0.35rem;
    transition: border-color 0.15s;
}

.login-line-field__row:focus-within {
    border-bottom-color: var(--login-primary);
}

.login-line-field__row input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    padding: 0.45rem 0;
    font-size: 0.95rem;
    font-weight: var(--login-font-weight);
    font-family: inherit;
    color: var(--login-text);
    text-align: right;
}

.login-line-field__row input::placeholder {
    color: #94a3b8;
    font-weight: var(--login-font-weight);
}

.login-line-field__row input:focus {
    outline: none;
}

.login-line-field__icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    color: var(--login-primary);
}

.login-line-field__icon svg {
    width: 1.2rem;
    height: 1.2rem;
}

.login-line-field__icon--btn {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    color: var(--login-text-muted);
    transition: color 0.12s;
}

.login-line-field__icon--btn:hover {
    color: var(--login-primary);
}

/* زر دخول بيضوي */
.login-submit-pill {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.85rem 1.5rem;
    border: none;
    border-radius: 999px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(180deg, var(--login-primary-light) 0%, var(--login-primary) 42%, var(--login-primary-dark) 100%);
    box-shadow:
        0 8px 22px rgba(37, 99, 235, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
    transition: transform 0.1s, box-shadow 0.15s, filter 0.15s;
}

.login-submit-pill:hover {
    filter: brightness(1.05);
    box-shadow:
        0 10px 26px rgba(37, 99, 235, 0.42),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.login-submit-pill:active {
    transform: scale(0.98);
}

/* قسم الترحيب (يسار في RTL) — تدرج أزرق + قطع قطري */
.login-stage__welcome {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 2rem;
    background: linear-gradient(145deg, var(--login-primary-deep) 0%, var(--login-primary-dark) 35%, var(--login-primary) 70%, var(--login-primary-light) 100%);
    clip-path: polygon(12% 0, 100% 0, 100% 100%, 0 100%);
}

.login-stage__welcome::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(160deg, transparent 40%, rgba(255, 255, 255, 0.08) 100%);
    pointer-events: none;
}

.login-stage__welcome-inner {
    position: relative;
    z-index: 1;
    text-align: right;
    max-width: 16rem;
}

.login-stage__logo {
    width: 3.25rem;
    height: 3.25rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.85rem;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    backdrop-filter: blur(8px);
}

.login-stage__welcome-title {
    margin: 0 0 0.75rem;
    font-size: 1.65rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.02em;
    line-height: 1.25;
}

.login-stage__welcome-text {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
    font-weight: var(--login-font-weight);
    color: rgba(255, 255, 255, 0.92);
    line-height: 1.6;
}

.login-stage__welcome-sub {
    margin: 1rem 0 0;
    font-size: 0.8rem;
    font-weight: var(--login-font-weight);
    color: rgba(255, 255, 255, 0.72);
    line-height: 1.5;
}

.login-footer {
    position: relative;
    z-index: 1;
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.8rem;
    font-weight: var(--login-font-weight);
    color: var(--login-text-muted);
}

/* رسائل Django */
.pub-messages {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 90vw;
}

.pub-msg {
    padding: 0.75rem 1rem;
    border-radius: 0.65rem;
    font-size: 0.875rem;
    font-weight: 700;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.pub-msg.error {
    background: rgba(254, 242, 242, 0.95);
    color: #b91c1c;
    border: 1px solid rgba(220, 38, 38, 0.35);
}

.pub-msg.success {
    background: rgba(236, 253, 245, 0.95);
    color: #047857;
    border: 1px solid rgba(5, 150, 105, 0.35);
}

.pub-msg.info {
    background: rgba(239, 246, 255, 0.95);
    color: #1d4ed8;
    border: 1px solid rgba(37, 99, 235, 0.35);
}

@keyframes login-fade-up {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes login-msg-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.pub-msg {
    animation: login-msg-in 0.35s ease both;
}

@media (prefers-reduced-motion: reduce) {
    .login-stage,
    .pub-msg {
        animation: none;
    }
}

/* جوال: عمودي */
@media (max-width: 767px) {
    .login-stage {
        grid-template-columns: 1fr;
        max-width: 22rem;
        min-height: auto;
    }

    .login-stage__welcome {
        order: -1;
        clip-path: none;
        padding: 2rem 1.5rem 1.75rem;
    }

    .login-stage__welcome-inner {
        max-width: none;
        text-align: center;
    }

    .login-stage__logo {
        margin-left: auto;
        margin-right: auto;
    }

    .login-stage__welcome-title {
        font-size: 1.35rem;
    }

    .login-stage__form {
        padding: 1.75rem 1.5rem 2rem;
    }

    .login-stage__form-inner {
        max-width: none;
    }
}

@media (max-width: 380px) {
    .login-stage__form {
        padding: 1.5rem 1.15rem 1.75rem;
    }
}
