/* ============================================================
   Soybean Login — Modern SaaS Design System
   ============================================================ */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
    --soy-primary:       #5865f2;
    --soy-primary-dark:  #4752c4;
    --soy-primary-light: #eef0fd;
    --soy-accent:        #8b5cf6;
    --soy-success:       #10b981;
    --soy-danger:        #ef4444;

    --soy-bg:            #f1f3f9;
    --soy-card-bg:       #ffffff;
    --soy-panel-bg:      #ffffff;

    --soy-text-main:     #1e293b;
    --soy-text-sub:      #475569;
    --soy-text-muted:    #94a3b8;

    --soy-border:        #e2e8f0;
    --soy-input-border:  #e2e8f0;
    --soy-input-focus:   #5865f2;

    --soy-radius-sm:     8px;
    --soy-radius:        12px;
    --soy-radius-lg:     20px;
    --soy-shadow:        0 8px 40px rgba(0,0,0,.10);
    --soy-shadow-lg:     0 20px 60px rgba(0,0,0,.14);
}

/* ── Dark Mode ──────────────────────────────────────────────── */
body.dark-mode {
    --soy-bg:           #0f172a;
    --soy-card-bg:      #1e293b;
    --soy-panel-bg:     #1e293b;
    --soy-text-main:    #f1f5f9;
    --soy-text-sub:     #94a3b8;
    --soy-text-muted:   #64748b;
    --soy-border:       #334155;
    --soy-input-border: #334155;
}

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

body {
    margin: 0;
    padding: 0;
    font-family: 'Cairo', 'Tajawal', 'Inter', sans-serif;
    background-color: var(--soy-bg);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
}

/* ── Animated Background ────────────────────────────────────── */
.soy-background {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    background: var(--soy-bg);
}

.soy-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.55;
    will-change: transform;
}

.soy-blob-1 {
    width: 700px; height: 700px;
    background: radial-gradient(circle, #c7d2fe, #e0e7ff);
    top: -200px; left: -200px;
    animation: soyFloat 12s ease-in-out infinite;
}
body.dark-mode .soy-blob-1 { background: radial-gradient(circle, #1e3a5f, #1e293b); }

.soy-blob-2 {
    width: 600px; height: 600px;
    background: radial-gradient(circle, #e9d5ff, #fae8ff);
    bottom: -150px; right: -150px;
    animation: soyFloat 15s ease-in-out infinite reverse;
}
body.dark-mode .soy-blob-2 { background: radial-gradient(circle, #312e81, #1e293b); }

.soy-blob-3 {
    width: 450px; height: 450px;
    background: radial-gradient(circle, #bbf7d0, #dcfce7);
    top: 50%; left: 55%;
    animation: soyFloat 18s ease-in-out infinite;
}
body.dark-mode .soy-blob-3 { background: radial-gradient(circle, #064e3b, #0f172a); }

@keyframes soyFloat {
    0%,100% { transform: translate(0,0) scale(1); }
    33%      { transform: translate(40px,30px) scale(1.05); }
    66%      { transform: translate(-20px,40px) scale(.97); }
}

/* ── Wrapper: 2-column on desktop ──────────────────────────── */
.soy-wrapper {
    position: relative;
    z-index: 10;
    display: flex;
    width: 100%;
    max-width: 940px;
    min-height: 580px;
    margin: 24px 16px;
    border-radius: var(--soy-radius-lg);
    box-shadow: var(--soy-shadow-lg);
    overflow: hidden;
    animation: soySlideUp .5s cubic-bezier(.22,1,.36,1) both;
}

@keyframes soySlideUp {
    from { opacity: 0; transform: translateY(28px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Brand Panel (left / top on mobile) ─────────────────────── */
.soy-brand-panel {
    width: 360px;
    flex-shrink: 0;
    background: linear-gradient(145deg, #5865f2 0%, #7c3aed 60%, #a855f7 100%);
    padding: 48px 36px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    color: #fff;
}

/* Decorative circles inside brand panel */
.soy-brand-panel::before {
    content: '';
    position: absolute;
    width: 300px; height: 300px;
    background: rgba(255,255,255,.07);
    border-radius: 50%;
    top: -80px; right: -80px;
}
.soy-brand-panel::after {
    content: '';
    position: absolute;
    width: 200px; height: 200px;
    background: rgba(255,255,255,.06);
    border-radius: 50%;
    bottom: -50px; left: -50px;
}

.soy-brand-logo-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    position: relative;
    z-index: 1;
}

.soy-brand-logo {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(255,255,255,.15);
    padding: 6px;
    backdrop-filter: blur(8px);
}

.soy-brand-name {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
}
.soy-brand-tagline {
    font-size: 11px;
    color: rgba(255,255,255,.7);
    margin-top: 2px;
}

.soy-brand-body {
    flex: 1;
    position: relative;
    z-index: 1;
}
.soy-brand-headline {
    font-size: 26px;
    font-weight: 800;
    color: #fff;
    line-height: 1.35;
    margin-bottom: 14px;
}
.soy-brand-desc {
    font-size: 13px;
    color: rgba(255,255,255,.75);
    line-height: 1.7;
    margin-bottom: 28px;
}

.soy-brand-features {
    list-style: none;
    padding: 0; margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.soy-brand-features li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12.5px;
    color: rgba(255,255,255,.85);
}
.soy-brand-features li i {
    width: 24px; height: 24px;
    background: rgba(255,255,255,.18);
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; flex-shrink: 0;
}

.soy-brand-footer {
    font-size: 11px;
    color: rgba(255,255,255,.5);
    position: relative;
    z-index: 1;
    margin-top: 32px;
}

/* ── Form Panel (right / bottom on mobile) ──────────────────── */
.soy-form-panel {
    flex: 1;
    background: var(--soy-card-bg);
    padding: 36px 40px 32px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-y: auto;
}

/* ── Top Actions (language, dark mode) ──────────────────────── */
.soy-top-actions {
    display: flex;
    gap: 6px;
    position: absolute;
    top: 20px;
    inset-inline-start: 20px;
}

.soy-top-icon {
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px;
    color: var(--soy-text-muted);
    font-size: 17px;
    cursor: pointer;
    text-decoration: none;
    transition: background .18s, color .18s;
    background: transparent;
}
.soy-top-icon:hover {
    background: var(--soy-primary-light);
    color: var(--soy-primary);
}
body.dark-mode .soy-top-icon:hover {
    background: rgba(88,101,242,.15);
}

/* ── Login Header (logo + name inside form panel on mobile) ─── */
.soy-login-header {
    text-align: center;
    margin-bottom: 28px;
    margin-top: 20px;
    display: none; /* hidden on desktop (brand panel shows it) */
}

.soy-logo {
    width: 56px;
    margin-bottom: 12px;
    border-radius: 12px;
}

.soy-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--soy-primary);
    margin-bottom: 4px;
}

.soy-subtitle {
    color: var(--soy-text-muted);
    font-size: 13px;
}

/* ── Form Title ─────────────────────────────────────────────── */
.soy-form-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--soy-text-main);
    margin-bottom: 6px;
    margin-top: 40px;
}
/* ── Flash Messages ─────────────────────────────────────────── */
.soy-alert {
    padding: 11px 14px;
    border-radius: var(--soy-radius-sm);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.soy-alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.soy-alert-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ── Form Groups ────────────────────────────────────────────── */
.soy-form-group {
    margin-bottom: 18px;
}

.soy-input-wrapper {
    position: relative;
}

.soy-input {
    width: 100%;
    border: 1.5px solid var(--soy-input-border);
    border-radius: var(--soy-radius-sm);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    color: var(--soy-text-main);
    background: var(--soy-card-bg);
    transition: border-color .2s, box-shadow .2s;
}

[dir="rtl"] .soy-input { padding: 11px 14px 11px 42px; }
[dir="ltr"] .soy-input { padding: 11px 42px 11px 14px; }

.soy-input::placeholder { color: var(--soy-text-muted); }

.soy-input:focus {
    border-color: var(--soy-input-focus);
    box-shadow: 0 0 0 3px rgba(88,101,242,.13);
}

.soy-input:focus + .soy-input-icon,
.soy-input:focus ~ .soy-input-icon {
    color: var(--soy-primary);
}

.soy-input-icon {
    position: absolute;
    inset-inline-end: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--soy-text-muted);
    font-size: 17px;
    pointer-events: none;
    transition: color .2s;
}

/* Password toggle — sits on the inline-start side (right in RTL, left in LTR) */
.soy-pw-toggle {
    position: absolute;
    inset-inline-start: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--soy-text-muted);
    font-size: 17px;
    cursor: pointer;
    transition: color .2s;
    pointer-events: all;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
    z-index: 1;
}
.soy-pw-toggle:hover { color: var(--soy-primary); }

/* LTR: toggle moves to the right end */
[dir="ltr"] .soy-pw-toggle { inset-inline-start: auto; inset-inline-end: 13px; }

/* When password wrapper has a toggle, push input content away from the toggle */
[dir="rtl"] .soy-input-wrapper.has-toggle .soy-input { padding-right: 42px; padding-left: 14px; }
[dir="ltr"] .soy-input-wrapper.has-toggle .soy-input { padding-right: 42px; padding-left: 14px; }

.soy-field-error {
    color: var(--soy-danger);
    font-size: 12px;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ── Form Options ───────────────────────────────────────────── */
.soy-form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
    font-size: 13px;
    flex-wrap: wrap;
    gap: 8px;
}

.soy-checkbox-label {
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    color: var(--soy-text-sub);
    user-select: none;
}

.soy-checkbox {
    width: 16px; height: 16px;
    accent-color: var(--soy-primary);
    cursor: pointer;
}

.soy-forgot-link {
    color: var(--soy-primary);
    text-decoration: none;
    font-weight: 500;
    transition: opacity .2s;
}
.soy-forgot-link:hover { opacity: .75; }

/* ── Submit Button ──────────────────────────────────────────── */
.soy-btn-primary {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, var(--soy-primary) 0%, var(--soy-accent) 100%);
    color: #fff;
    border: none;
    border-radius: var(--soy-radius-sm);
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: transform .18s, box-shadow .18s, opacity .2s;
    box-shadow: 0 4px 14px rgba(88,101,242,.35);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.soy-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(88,101,242,.4);
}
.soy-btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 3px 10px rgba(88,101,242,.3);
}
.soy-btn-primary:disabled {
    opacity: .7;
    cursor: not-allowed;
    transform: none;
}

/* Loading spinner */
.soy-btn-spinner {
    display: none;
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: soySpin .6s linear infinite;
}
.soy-btn-primary.loading .soy-btn-spinner { display: block; }
.soy-btn-primary.loading .soy-btn-text    { opacity: .8; }

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

/* ── Divider ────────────────────────────────────────────────── */
.soy-divider {
    margin: 24px 0 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.soy-divider::before,
.soy-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--soy-border);
}
.soy-divider-text {
    color: var(--soy-text-muted);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    padding: 0 4px;
}

/* ── Role Switcher ──────────────────────────────────────────── */
.soy-role-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    justify-content: center;
}

.soy-btn-role {
    padding: 6px 13px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    background: transparent;
    color: var(--soy-text-muted);
    border: 1.5px solid var(--soy-border);
    transition: all .2s;
    font-family: inherit;
}
.soy-btn-role:hover {
    background: var(--soy-primary-light);
    color: var(--soy-primary);
    border-color: var(--soy-primary);
    text-decoration: none;
}
.soy-btn-role.active {
    background: var(--soy-primary);
    color: #fff;
    border-color: var(--soy-primary);
    box-shadow: 0 3px 10px rgba(88,101,242,.3);
}

body.dark-mode .soy-btn-role {
    color: var(--soy-text-muted);
    border-color: #334155;
}
body.dark-mode .soy-btn-role:hover {
    background: rgba(88,101,242,.15);
    color: #a5b4fc;
    border-color: #5865f2;
}

/* ── reCAPTCHA ──────────────────────────────────────────────── */
.soy-captcha-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 18px;
}
.soy-captcha-wrap .g-recaptcha {
    transform: scale(0.88);
    transform-origin: center;
}

/* ── Responsive ─────────────────────────────────────────────── */

/* Tablet (≤768px): hide brand panel, show logo in form */
@media (max-width: 768px) {
    body { padding: 16px; }

    .soy-wrapper {
        flex-direction: column;
        max-width: 460px;
        min-height: unset;
        margin: 16px auto;
    }

    .soy-brand-panel {
        width: 100%;
        padding: 28px 28px 24px;
        min-height: unset;
        flex-direction: row;
        align-items: center;
        gap: 16px;
    }

    .soy-brand-panel::before,
    .soy-brand-panel::after { display: none; }

    .soy-brand-logo-wrap { margin-bottom: 0; flex-shrink: 0; }
    .soy-brand-logo      { width: 44px; height: 44px; }
    .soy-brand-name      { font-size: 16px; }

    .soy-brand-body      { display: none; }
    .soy-brand-footer    { display: none; }

    .soy-form-panel {
        padding: 28px 28px 24px;
    }

    .soy-form-title { margin-top: 4px; }

    .soy-top-actions {
        position: static;
        margin-bottom: 16px;
        justify-content: flex-end;
    }
}

/* Mobile (≤480px) */
@media (max-width: 480px) {
    .soy-wrapper  { margin: 0; border-radius: 0; min-height: 100vh; box-shadow: none; }

    .soy-brand-panel { padding: 20px 20px 18px; border-radius: 0; }
    .soy-brand-name  { font-size: 15px; }
    .soy-brand-tagline { display: none; }

    .soy-form-panel { padding: 24px 20px 20px; }

    .soy-form-title  { font-size: 18px; }
    .soy-btn-primary { font-size: 14px; padding: 12px; }

    .soy-role-buttons { gap: 5px; }
    .soy-btn-role     { font-size: 11px; padding: 5px 10px; }

    .soy-captcha-wrap .g-recaptcha {
        transform: scale(0.80);
        transform-origin: center;
    }
}

/* Large screens (≥1200px) */
@media (min-width: 1200px) {
    .soy-wrapper { max-width: 1000px; }
    .soy-brand-panel { width: 400px; }
}

/* ── RTL Overrides ──────────────────────────────────────────── */
[dir="rtl"] { text-align: right; }
[dir="rtl"] .soy-top-actions { right: auto; left: 20px; }
[dir="rtl"] .soy-form-options { flex-direction: row-reverse; }
