/* ====================================================================
   FRONTEND LOGIN — LIGHT SPLIT LAYOUT
   Mirrors the /admin/login design language (see auth-admin.css) and the
   /register + /register/form pages: a tinted light stage with drifting
   colour orbs, a lifted white card, purple brand panel (#6152aa) on the
   left and a white form panel on the right. Teal (#7cdbe3) is the accent.
   Everything is scoped under .flogin-* so it never collides with the
   older dark .auth-* rules in frontend.css.
   ==================================================================== */

.flogin-stage,
.flogin-stage * {
    box-sizing: border-box;
}

/* ── Stage: tinted light backdrop with soft colour glows ── */
.flogin-stage {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background:
        radial-gradient(closest-side at 10% 12%, rgba(124, 219, 227, 0.20), transparent 60%),
        radial-gradient(closest-side at 90% 10%, rgba(97, 82, 170, 0.12), transparent 60%),
        radial-gradient(closest-side at 82% 92%, rgba(124, 219, 227, 0.14), transparent 60%),
        linear-gradient(135deg, #eef2fe 0%, #f4eefe 55%, #eafbff 100%);
}

/* Floating, blurred colour orbs drifting behind the card */
.flogin-stage::before,
.flogin-stage::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(48px);
    z-index: 0;
    pointer-events: none;
}

.flogin-stage::before {
    width: 360px;
    height: 360px;
    top: -70px;
    left: -70px;
    background: radial-gradient(circle, rgba(124, 219, 227, 0.55), transparent 70%);
    animation: floginOrbA 16s ease-in-out infinite;
}

.flogin-stage::after {
    width: 420px;
    height: 420px;
    bottom: -90px;
    right: -90px;
    background: radial-gradient(circle, rgba(97, 82, 170, 0.40), transparent 70%);
    animation: floginOrbB 20s ease-in-out infinite;
}

@keyframes floginOrbA {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(50px, 36px) scale(1.12); }
}

@keyframes floginOrbB {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(-46px, -32px) scale(1.10); }
}

/* ── Main Card ── */
.flogin-card {
    position: relative;
    z-index: 2;
    display: flex;
    width: 940px;
    max-width: 100%;
    border-radius: 24px;
    overflow: hidden;
    background: linear-gradient(180deg, #ffffff 0%, #f9f9ff 100%);
    border: 1px solid rgba(97, 82, 170, 0.12);
    box-shadow:
        0 30px 70px rgba(46, 40, 90, 0.18),
        0 12px 30px rgba(30, 41, 59, 0.07);
    animation: floginFadeIn 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Brand Panel (left) — purple gradient ── */
.flogin-brand {
    width: 42%;
    flex-shrink: 0;
    background: linear-gradient(165deg, #55488f 0%, #6152aa 50%, #7c6bc8 100%);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2.5rem 4rem;
    overflow: hidden;
}

/* Decorative rings */
.flogin-brand::before {
    content: '';
    position: absolute;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.10);
    top: -120px;
    right: -140px;
    pointer-events: none;
}

.flogin-brand::after {
    content: '';
    position: absolute;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.08);
    bottom: -90px;
    left: -80px;
    pointer-events: none;
}

.flogin-ring-inner {
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.10);
    top: -50px;
    right: -60px;
    pointer-events: none;
}

.flogin-glow {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(240px 240px at 88% 4%, rgba(255, 255, 255, 0.18), transparent 70%),
        radial-gradient(260px 260px at 4% 100%, rgba(255, 255, 255, 0.12), transparent 70%);
    pointer-events: none;
}

.flogin-dots {
    position: absolute;
    top: 40px;
    left: 30px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    opacity: 0.22;
}

.flogin-dots span {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #fff;
    display: block;
}

.flogin-brand-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.flogin-logo {
    max-width: 220px;
    width: 100%;
    height: auto;
    margin: 0 auto 2rem;
    display: block;
    filter: drop-shadow(0 12px 26px rgba(20, 16, 60, 0.35));
}

.flogin-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 8px 24px rgba(20, 16, 60, 0.18);
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 0.35rem 1rem;
    border-radius: 50px;
    margin-bottom: 1.4rem;
    backdrop-filter: blur(8px);
}

.flogin-brand-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.25;
    margin: 0 0 0.85rem;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 12px rgba(20, 16, 60, 0.25);
}

.flogin-brand-subtitle {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
    font-weight: 400;
    max-width: 260px;
    margin: 0 auto;
}

.flogin-divider-line {
    width: 40px;
    height: 3px;
    background: linear-gradient(90deg, #c5f2f9, rgba(197, 242, 249, 0.3));
    border-radius: 2px;
    margin: 1.4rem auto;
}

.flogin-features {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
}

.flogin-features li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.35rem 0;
}

.flogin-features li .flogin-feat-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.flogin-features li .flogin-feat-icon svg {
    color: #c5f2f9;
}

.flogin-brand-footer {
    position: absolute;
    bottom: 1.5rem;
    left: 0;
    right: 0;
    text-align: center;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.72rem;
    z-index: 2;
}

/* ── Form Panel (right) — white ── */
.flogin-panel {
    flex: 1;
    min-width: 0;
    background: linear-gradient(180deg, #ffffff 0%, #f9f9ff 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3.25rem 3rem;
    position: relative;
    overflow: hidden;
}

.flogin-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #6152aa, #7cdbe3 60%, transparent);
}

.flogin-panel-header {
    margin-bottom: 2rem;
}

.flogin-eyebrow {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6152aa;
    margin: 0 0 0.6rem;
}

.flogin-title {
    font-size: 1.65rem;
    font-weight: 800;
    color: #1e1b3a;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin: 0 0 0.4rem;
}

.flogin-subtitle {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 400;
    line-height: 1.55;
    margin: 0;
}

/* ── Alerts ── */
.flogin-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.5;
}

.flogin-alert svg { flex-shrink: 0; margin-top: 1px; }

.flogin-alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-left: 4px solid #ef4444;
    color: #b91c1c;
}

.flogin-alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-left: 4px solid #22c55e;
    color: #15803d;
}

/* ── Form ── */
.flogin-form-group {
    margin-bottom: 1.25rem;
    position: relative;
}

.flogin-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: #475569;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.flogin-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.flogin-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
    display: flex;
    align-items: center;
    transition: color 0.2s ease;
    font-size: 1rem;
    z-index: 1;
}

.flogin-control {
    display: block;
    width: 100%;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    color: #111827;
    font-size: 0.925rem;
    font-weight: 500;
    padding: 0.8rem 1rem 0.8rem 2.75rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    outline: none;
    height: auto;
}

.flogin-control::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

.flogin-control:hover:not(:focus) {
    border-color: #cbd5e1;
}

.flogin-control:focus {
    border-color: #6152aa;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(97, 82, 170, 0.16), 0 4px 12px rgba(30, 41, 59, 0.08);
    color: #111827;
}

.flogin-form-group:focus-within .flogin-input-icon {
    color: #6152aa;
}

/* Password field leaves room for the eye toggle */
.flogin-control.has-toggle {
    padding-right: 2.75rem;
}

/* Chrome paints autofilled fields with its own blue wash, which fights the
   white card. Repaint them via an inset shadow (background is not settable). */
.flogin-control:-webkit-autofill,
.flogin-control:-webkit-autofill:hover,
.flogin-control:-webkit-autofill:focus {
    -webkit-text-fill-color: #111827;
    -webkit-box-shadow: 0 0 0 1000px #ffffff inset;
    box-shadow: 0 0 0 1000px #ffffff inset;
    caret-color: #111827;
    transition: background-color 5000s ease-in-out 0s;
}

.flogin-control:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #ffffff inset, 0 0 0 3px rgba(97, 82, 170, 0.16);
    box-shadow: 0 0 0 1000px #ffffff inset, 0 0 0 3px rgba(97, 82, 170, 0.16);
}

/* Password toggle */
.flogin-password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    font-size: 1rem;
    transition: color 0.2s ease;
    line-height: 1;
    z-index: 2;
}

.flogin-password-toggle:hover { color: #6152aa; }

/* ── Remember me / forgot password row ── */
.flogin-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.flogin-remember {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    margin: 0;
    font-size: 0.825rem;
    font-weight: 500;
    color: #475569;
    user-select: none;
}

.flogin-remember input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    flex-shrink: 0;
    accent-color: #6152aa;
    cursor: pointer;
}

.flogin-link {
    color: #6152aa;
    font-size: 0.825rem;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

.flogin-link:hover {
    color: #55488f;
    text-decoration: underline;
}

/* ── Submit Button ── */
.flogin-btn {
    display: block;
    width: 100%;
    margin-top: 1.5rem;
    padding: 0.88rem 2rem;
    background: linear-gradient(135deg, #55488f 0%, #6152aa 50%, #7c6bc8 100%);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 0.925rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 12px 30px rgba(97, 82, 170, 0.35);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.flogin-btn::before {
    content: '';
    position: absolute;
    top: 0; left: -100%; right: 0; bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
    transition: left 0.5s ease;
}

.flogin-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 40px rgba(97, 82, 170, 0.42);
    color: #fff;
}

.flogin-btn:hover::before { left: 100%; }

.flogin-btn:active { transform: translateY(0); }

.flogin-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

/* ── "New here?" divider + register link ── */
.flogin-divider {
    position: relative;
    text-align: center;
    margin: 1.75rem 0 1rem;
}

.flogin-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(97, 82, 170, 0.14);
}

.flogin-divider span {
    position: relative;
    display: inline-block;
    padding: 0 0.9rem;
    background: #fbfbff;
    color: #94a3b8;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.flogin-register {
    text-align: center;
}

.flogin-register a {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #6152aa;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    transition: color 0.2s ease;
}

.flogin-register a:hover { color: #55488f; }

.flogin-register a svg { transition: transform 0.2s ease; }

.flogin-register a:hover svg { transform: translateX(3px); }

/* ── Shared with the forgot-password / reset-password pages ── */

/* Required-field asterisk */
.flogin-req { color: #dc2626; margin-left: 0.15rem; }

[dir="rtl"] .flogin-req { margin-left: 0; margin-right: 0.15rem; }

/* Validation error under a field */
.flogin-control.is-invalid {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.flogin-feedback {
    display: block;
    color: #dc2626;
    font-size: 0.75rem;
    margin-top: 0.35rem;
}

/* The error alert carries a <ul> when the request failed validation */
.flogin-alert ul {
    margin: 0;
    padding-left: 1.1rem;
}

[dir="rtl"] .flogin-alert ul { padding-left: 0; padding-right: 1.1rem; }

.flogin-alert ul li + li { margin-top: 0.2rem; }

/* Laravel flash messages (flash::message) rendered inside the panel */
.flogin-flash .alert {
    padding: 0.85rem 1rem;
    border-radius: 10px;
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid transparent;
}

.flogin-flash .alert-success { background: #f0fdf4; border-color: #bbf7d0; border-left: 4px solid #22c55e; color: #15803d; }
.flogin-flash .alert-danger,
.flogin-flash .alert-error   { background: #fef2f2; border-color: #fecaca; border-left: 4px solid #ef4444; color: #b91c1c; }
.flogin-flash .alert-info    { background: #eff6ff; border-color: #bfdbfe; border-left: 4px solid #3b82f6; color: #1d4ed8; }
.flogin-flash .alert-warning { background: #fffbeb; border-color: #fde68a; border-left: 4px solid #f59e0b; color: #b45309; }

/* reCAPTCHA sits between the last field and the submit button */
.flogin-captcha { margin-bottom: 0.25rem; }

.flogin-captcha .form-group { margin-bottom: 0; }

.flogin-captcha .g-recaptcha { display: inline-block; }

.flogin-captcha .help-block,
.flogin-captcha .invalid-feedback {
    display: block;
    color: #dc2626;
    font-size: 0.75rem;
    margin-top: 0.35rem;
}

/* "Back to login" link — same shape as .flogin-register but arrow-first */
.flogin-back { text-align: center; }

.flogin-back a {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #6152aa;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    transition: color 0.2s ease;
}

.flogin-back a:hover { color: #55488f; }

.flogin-back a svg { transition: transform 0.2s ease; }

.flogin-back a:hover svg { transform: translateX(-3px); }

[dir="rtl"] .flogin-back a svg { transform: scaleX(-1); }

[dir="rtl"] .flogin-back a:hover svg { transform: scaleX(-1) translateX(-3px); }

/* ── Animation ── */
@keyframes floginFadeIn {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)  scale(1);    }
}

@media (prefers-reduced-motion: reduce) {
    .flogin-stage::before,
    .flogin-stage::after,
    .flogin-card {
        animation: none !important;
    }
}

/* ── RTL ── */
[dir="rtl"] .flogin-input-icon { left: auto; right: 14px; }
[dir="rtl"] .flogin-control { padding: 0.8rem 2.75rem 0.8rem 1rem; }
[dir="rtl"] .flogin-control.has-toggle { padding-left: 2.75rem; padding-right: 2.75rem; }
[dir="rtl"] .flogin-password-toggle { right: auto; left: 12px; }
[dir="rtl"] .flogin-features { text-align: right; }
[dir="rtl"] .flogin-alert-error { border-left: 1px solid #fecaca; border-right: 4px solid #ef4444; }
[dir="rtl"] .flogin-alert-success { border-left: 1px solid #bbf7d0; border-right: 4px solid #22c55e; }
[dir="rtl"] .flogin-panel::before { background: linear-gradient(270deg, #6152aa, #7cdbe3 60%, transparent); }
[dir="rtl"] .flogin-register a svg { transform: scaleX(-1); }
[dir="rtl"] .flogin-register a:hover svg { transform: scaleX(-1) translateX(3px); }

/* ── Tablet ── */
@media (max-width: 991px) {
    .flogin-card { width: 100%; }
    .flogin-brand { width: 40%; padding: 2.25rem 1.5rem 3.25rem; }
    .flogin-logo { max-width: 160px; margin-bottom: 1.5rem; }
    .flogin-badge { font-size: 0.62rem; padding: 0.3rem 0.8rem; margin-bottom: 1.1rem; }
    .flogin-brand-title { font-size: 1.3rem; }
    .flogin-divider-line { margin: 1.1rem auto; }
    .flogin-features li { font-size: 0.72rem; padding: 0.28rem 0; }
    .flogin-brand-footer { font-size: 0.62rem; bottom: 1.1rem; padding: 0 0.75rem; }
    .flogin-panel { padding: 2.5rem 1.75rem; }
}

/* ── Mobile: stack the panels ── */
@media (max-width: 767px) {

    .flogin-stage {
        display: block;
        padding: 0;
        min-height: 100vh;
    }

    .flogin-stage::before,
    .flogin-stage::after { display: none; }

    .flogin-card {
        display: block;
        width: 100%;
        max-width: 100%;
        min-height: 100vh;
        border: none;
        border-radius: 0;
        background: none;
        box-shadow: none;
        overflow: visible;
        animation: none;
    }

    .flogin-brand {
        width: 100%;
        padding: 2.75rem 1.5rem 3.25rem;
        border-radius: 0 0 32px 32px;
    }

    .flogin-brand::before,
    .flogin-brand::after,
    .flogin-ring-inner,
    .flogin-glow,
    .flogin-dots,
    .flogin-features,
    .flogin-brand-footer,
    .flogin-divider-line {
        display: none;
    }

    .flogin-logo { max-width: 130px; margin-bottom: 1.1rem; }

    .flogin-badge { margin-bottom: 0.85rem; font-size: 0.65rem; }

    .flogin-brand-title { font-size: 1.45rem; margin-bottom: 0.5rem; }

    .flogin-brand-title br { display: none; }

    .flogin-panel {
        width: auto;
        margin: -1.5rem 1rem 1.5rem;
        background: #ffffff;
        border: 1px solid rgba(97, 82, 170, 0.12);
        border-radius: 26px;
        box-shadow: 0 20px 50px rgba(46, 40, 90, 0.14);
        padding: 2rem 1.5rem 2.5rem;
        overflow: visible;
    }

    /* Drag-handle pill instead of the top gradient strip */
    .flogin-panel::before {
        content: '';
        top: 10px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        background: rgba(97, 82, 170, 0.18);
        border-radius: 2px;
    }

    .flogin-eyebrow { display: none; }

    .flogin-panel-header { margin-top: 0.75rem; margin-bottom: 1.5rem; }

    .flogin-title    { font-size: 1.35rem; }
    .flogin-subtitle { font-size: 0.825rem; }

    .flogin-form-group { margin-bottom: 1rem; }

    /* 16px keeps iOS from zooming the viewport on focus */
    .flogin-control { font-size: 1rem; }

    .flogin-btn { margin-top: 1.4rem; font-size: 1rem; }

    .flogin-divider span { background: #ffffff; }
}
