/*
 * LOGI WMS - Authentication Pages
 * Split-Screen Ultra Premium Design
 * Bootstrap 5.3.3 Compatible
 */

/* =====================================================
   CSS VARIABLES
   ===================================================== */
:root {
    --auth-primary: #4f46e5;
    --auth-primary-dark: #4338ca;
    --auth-primary-light: #6366f1;
    --auth-primary-rgb: 79, 70, 229;
    --auth-accent: #818cf8;

    /* Hero panel (left) */
    --auth-hero-from: #1e1b4b;
    --auth-hero-via: #312e81;
    --auth-hero-to: #3730a3;

    /* Form panel (right) */
    --auth-form-bg: #ffffff;
    --auth-text-primary: #1e293b;
    --auth-text-secondary: #475569;
    --auth-text-muted: #94a3b8;
    --auth-border-color: #e2e8f0;
    --auth-input-bg: #f8fafc;
    --auth-input-focus-bg: #ffffff;
    --auth-input-border: #e2e8f0;
}

[data-bs-theme="dark"] {
    --auth-hero-from: #0a0a1a;
    --auth-hero-via: #1a1a3e;
    --auth-hero-to: #1e1b4b;

    --auth-form-bg: #0f172a;
    --auth-text-primary: #f1f5f9;
    --auth-text-secondary: #94a3b8;
    --auth-text-muted: #64748b;
    --auth-border-color: #1e293b;
    --auth-input-bg: #1e293b;
    --auth-input-focus-bg: #0f172a;
    --auth-input-border: #334155;
}

/* =====================================================
   BASE
   ===================================================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
}

[dir="rtl"] body {
    font-family: 'Noto Sans Arabic', 'Inter', sans-serif;
}

/* =====================================================
   SPLIT SCREEN LAYOUT
   ===================================================== */
.auth-split {
    display: flex;
    min-height: 100vh;
}

/* =====================================================
   LEFT PANEL - HERO
   ===================================================== */
.auth-hero {
    flex: 0 0 50%;
    max-width: 50%;
    background: linear-gradient(160deg, var(--auth-hero-from) 0%, var(--auth-hero-via) 50%, var(--auth-hero-to) 100%);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* --- Hero Background Effects --- */
.auth-hero-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

/* Floating orbs */
.auth-hero-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
}

.auth-hero-orb-1 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.25) 0%, transparent 70%);
    top: -5%; right: -10%;
    animation: heroOrb1 20s ease-in-out infinite;
}

.auth-hero-orb-2 {
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.2) 0%, transparent 70%);
    bottom: 10%; left: -5%;
    animation: heroOrb2 25s ease-in-out infinite;
}

.auth-hero-orb-3 {
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.12) 0%, transparent 70%);
    top: 50%; left: 40%;
    animation: heroOrb3 18s ease-in-out infinite;
}

@keyframes heroOrb1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-30px, 20px) scale(1.1); }
    66% { transform: translate(20px, -15px) scale(0.95); }
}

@keyframes heroOrb2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(40px, -25px) scale(1.08); }
}

@keyframes heroOrb3 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-30px, -20px) scale(1.1); }
}

/* Grid pattern */
.auth-hero-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridDrift 40s linear infinite;
}

@keyframes gridDrift {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

/* Particles */
.auth-hero-particles { position: absolute; inset: 0; }

.auth-h-particle {
    position: absolute;
    width: 3px; height: 3px;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    animation: heroParticle 20s ease-in-out infinite;
}

.auth-h-particle:nth-child(1) { left: 10%; top: 15%; animation-delay: 0s; animation-duration: 18s; }
.auth-h-particle:nth-child(2) { left: 25%; top: 55%; animation-delay: -3s; animation-duration: 22s; }
.auth-h-particle:nth-child(3) { left: 40%; top: 25%; animation-delay: -6s; animation-duration: 16s; }
.auth-h-particle:nth-child(4) { left: 60%; top: 70%; animation-delay: -9s; animation-duration: 24s; }
.auth-h-particle:nth-child(5) { left: 75%; top: 35%; animation-delay: -12s; animation-duration: 20s; }
.auth-h-particle:nth-child(6) { left: 85%; top: 80%; animation-delay: -2s; animation-duration: 17s; }
.auth-h-particle:nth-child(7) { left: 50%; top: 90%; animation-delay: -7s; animation-duration: 21s; }
.auth-h-particle:nth-child(8) { left: 15%; top: 85%; animation-delay: -11s; animation-duration: 19s; }

@keyframes heroParticle {
    0%, 100% { transform: translateY(0) translateX(0); opacity: 0.2; }
    25% { transform: translateY(-30px) translateX(10px); opacity: 0.6; }
    50% { transform: translateY(-15px) translateX(-15px); opacity: 0.3; }
    75% { transform: translateY(-40px) translateX(20px); opacity: 0.5; }
}

/* --- Hero Content --- */
.auth-hero-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 3rem 4rem;
    color: #fff;
}

.auth-hero-top { margin-bottom: auto; }

.auth-hero-logo {
    width: 56px; height: 56px;
    filter: brightness(0) invert(1) drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
    animation: heroLogoFloat 4s ease-in-out infinite;
}

@keyframes heroLogoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.auth-hero-main {
    margin-bottom: auto;
    animation: heroContentIn 1s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

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

.auth-hero-title {
    font-size: 3.5rem;
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -0.04em;
    margin-bottom: 1.5rem;
}

.auth-hero-brand {
    background: linear-gradient(135deg, #fff 0%, var(--auth-accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-hero-desc {
    font-size: 1.125rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.65);
    max-width: 420px;
    margin-bottom: 2.5rem;
    font-weight: 400;
}

/* Feature chips */
.auth-hero-features {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.auth-hero-feature {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
    transition: all 0.3s;
}

.auth-hero-feature:hover {
    background: rgba(255, 255, 255, 0.14);
    transform: translateY(-2px);
}

.auth-hero-feature-icon {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem;
}

.auth-hero-footer {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.3);
    font-weight: 400;
}

/* =====================================================
   RIGHT PANEL - FORM
   ===================================================== */
.auth-form-panel {
    flex: 0 0 50%;
    max-width: 50%;
    background: var(--auth-form-bg);
    display: flex;
    flex-direction: column;
    position: relative;
    transition: background 0.3s;
}

/* Top controls */
.auth-form-controls {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1.5rem 2.5rem;
}

.auth-ctrl-btn {
    width: 40px; height: 40px;
    border-radius: 10px;
    border: 2px solid var(--auth-border-color);
    background: transparent;
    color: var(--auth-text-muted);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
}

.auth-ctrl-btn:hover {
    border-color: var(--auth-primary);
    color: var(--auth-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--auth-primary-rgb), 0.15);
}

.auth-lang-btn {
    width: auto;
    padding: 0 12px;
    gap: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
}

.auth-lang-dropdown {
    background: var(--auth-form-bg);
    border: 1px solid var(--auth-border-color);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1);
    padding: 6px;
    min-width: 140px;
}

.auth-lang-dropdown .dropdown-item {
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--auth-text-primary);
    transition: all 0.2s;
}

.auth-lang-dropdown .dropdown-item:hover {
    background: rgba(var(--auth-primary-rgb), 0.08);
    color: var(--auth-primary);
}

.auth-lang-dropdown .dropdown-item.active {
    background: rgba(var(--auth-primary-rgb), 0.1);
    color: var(--auth-primary);
}

[data-bs-theme="dark"] .theme-icon-dark { display: none !important; }
[data-bs-theme="dark"] .theme-icon-light { display: inline-block !important; }

/* Form wrapper */
.auth-form-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 2.5rem 3rem;
}

.auth-form-inner {
    width: 100%;
    max-width: 400px;
    animation: formIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both;
}

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

/* Brand text */
.auth-form-brand {
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--auth-primary);
    letter-spacing: -0.02em;
    margin-bottom: 2rem;
}

/* Title */
.auth-form-title {
    font-size: 1.875rem;
    font-weight: 800;
    color: var(--auth-text-primary);
    letter-spacing: -0.03em;
    margin: 0 0 0.5rem;
    line-height: 1.2;
}

.auth-form-subtitle {
    font-size: 0.9375rem;
    color: var(--auth-text-muted);
    margin: 0 0 2rem;
    font-weight: 400;
    line-height: 1.5;
}

/* =====================================================
   FORM INPUTS
   ===================================================== */
.auth-field { margin-bottom: 1.25rem; }

.auth-field-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--auth-text-primary);
    margin-bottom: 0.5rem;
}

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

.auth-input-wrapper .auth-input-icon {
    position: absolute;
    left: 16px; top: 50%; transform: translateY(-50%);
    color: var(--auth-text-muted);
    font-size: 1.0625rem;
    z-index: 2;
    transition: color 0.3s;
    pointer-events: none;
}

[dir="rtl"] .auth-input-wrapper .auth-input-icon {
    left: auto; right: 16px;
}

.auth-input {
    width: 100%;
    height: 52px;
    padding: 0 16px 0 48px;
    font-size: 0.9375rem;
    font-weight: 500;
    border: 2px solid var(--auth-input-border);
    border-radius: 12px;
    background: var(--auth-input-bg);
    color: var(--auth-text-primary);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
}

[dir="rtl"] .auth-input {
    padding: 0 48px 0 16px;
}

.auth-input::placeholder { color: var(--auth-text-muted); font-weight: 400; }

.auth-input:focus {
    border-color: var(--auth-primary);
    background: var(--auth-input-focus-bg);
    box-shadow: 0 0 0 4px rgba(var(--auth-primary-rgb), 0.1);
}

.auth-input:focus ~ .auth-input-icon {
    color: var(--auth-primary);
}

.auth-input.is-invalid { border-color: #ef4444; }
.auth-input.is-invalid:focus { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1); }

/* Password toggle */
.auth-password-toggle {
    position: absolute;
    right: 4px; top: 50%; transform: translateY(-50%);
    width: 44px; height: 44px;
    background: transparent;
    border: none;
    color: var(--auth-text-muted);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    border-radius: 10px;
    z-index: 3;
    transition: all 0.2s;
    font-size: 1.0625rem;
}

[dir="rtl"] .auth-password-toggle { right: auto; left: 4px; }

.auth-password-toggle:hover {
    color: var(--auth-primary);
    background: rgba(var(--auth-primary-rgb), 0.06);
}

/* Error feedback */
.auth-field-error {
    font-size: 0.8125rem;
    color: #ef4444;
    margin-top: 0.375rem;
    font-weight: 500;
    animation: authShake 0.4s ease;
}

@keyframes authShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

/* =====================================================
   REMEMBER ME & FORGOT
   ===================================================== */
.auth-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.75rem;
}

.auth-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.auth-check input[type="checkbox"] {
    width: 18px; height: 18px;
    border: 2px solid var(--auth-border-color);
    border-radius: 5px;
    cursor: pointer;
    accent-color: var(--auth-primary);
}

.auth-check label {
    font-size: 0.875rem;
    color: var(--auth-text-secondary);
    cursor: pointer;
    font-weight: 500;
    user-select: none;
}

.auth-forgot-link {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--auth-primary);
    text-decoration: none;
    transition: color 0.2s;
}

.auth-forgot-link:hover { color: var(--auth-primary-dark); }

/* =====================================================
   SUBMIT BUTTON
   ===================================================== */
.auth-submit-btn {
    width: 100%;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 0 1.5rem;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    background: var(--auth-primary);
    border: none;
    border-radius: 12px;
    color: #ffffff;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 15px rgba(var(--auth-primary-rgb), 0.3);
}

.auth-submit-btn::before {
    content: '';
    position: absolute; top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.5s;
}

.auth-submit-btn:hover {
    background: var(--auth-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(var(--auth-primary-rgb), 0.4);
}

.auth-submit-btn:hover::before { left: 100%; }
.auth-submit-btn:active { transform: translateY(0); }

.auth-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.auth-submit-btn .spinner-border {
    width: 20px; height: 20px;
    border-width: 2px;
}

/* =====================================================
   ALERTS
   ===================================================== */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1.125rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    animation: alertIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes alertIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-alert i { font-size: 1.125rem; flex-shrink: 0; margin-top: 1px; }

.auth-alert-success { background: rgba(16, 185, 129, 0.1); color: #047857; }
.auth-alert-danger { background: rgba(239, 68, 68, 0.1); color: #dc2626; }
.auth-alert-warning { background: rgba(245, 158, 11, 0.1); color: #d97706; }
.auth-alert-info { background: rgba(6, 182, 212, 0.1); color: #0891b2; }

[data-bs-theme="dark"] .auth-alert-success { background: rgba(16, 185, 129, 0.15); color: #34d399; }
[data-bs-theme="dark"] .auth-alert-danger { background: rgba(239, 68, 68, 0.15); color: #f87171; }

.auth-alert ul { margin: 0.375rem 0 0; padding-left: 1.125rem; }
.auth-alert ul li { margin-bottom: 2px; }

/* =====================================================
   AUTH ICON (forgot/reset pages)
   ===================================================== */
.auth-icon-block {
    width: 64px; height: 64px;
    border-radius: 18px;
    background: rgba(var(--auth-primary-rgb), 0.08);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1.25rem;
    font-size: 1.75rem;
    color: var(--auth-primary);
    position: relative;
}

.auth-icon-block::before {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 22px;
    border: 2px dashed rgba(var(--auth-primary-rgb), 0.15);
    animation: iconSpin 25s linear infinite;
}

@keyframes iconSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* =====================================================
   BACK LINK
   ===================================================== */
.auth-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--auth-primary);
    text-decoration: none;
    transition: all 0.2s;
}

.auth-back-link:hover { color: var(--auth-primary-dark); gap: 0.625rem; }
.auth-back-link i { transition: transform 0.2s; }
.auth-back-link:hover i { transform: translateX(-3px); }

/* =====================================================
   PASSWORD STRENGTH
   ===================================================== */
.auth-strength { margin-top: 0.5rem; }

.auth-strength-bar {
    height: 5px;
    background: var(--auth-border-color);
    border-radius: 3px;
    overflow: hidden;
}

.strength-fill {
    height: 100%; width: 0; border-radius: 3px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.strength-fill.weak { background: #ef4444; }
.strength-fill.fair { background: #f59e0b; }
.strength-fill.good { background: #06b6d4; }
.strength-fill.strong { background: #10b981; }
.strength-fill.excellent { background: linear-gradient(90deg, #10b981, #34d399); }

.strength-text {
    font-size: 0.75rem; font-weight: 600;
    color: var(--auth-text-muted);
    margin-top: 0.375rem; display: block;
}

/* =====================================================
   THEME TRANSITION
   ===================================================== */
.theme-transition-overlay {
    position: fixed; inset: 0;
    background: var(--auth-primary);
    z-index: 99999;
    pointer-events: none;
    opacity: 0;
}

.theme-transition-overlay.active {
    animation: themeFlash 0.5s ease-out forwards;
}

@keyframes themeFlash {
    0% { opacity: 0; }
    25% { opacity: 0.3; }
    100% { opacity: 0; }
}

/* =====================================================
   STAGGERED FORM ANIMATIONS
   ===================================================== */
.auth-form > *:nth-child(1) { animation: fieldIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.4s both; }
.auth-form > *:nth-child(2) { animation: fieldIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.5s both; }
.auth-form > *:nth-child(3) { animation: fieldIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.6s both; }
.auth-form > *:nth-child(4) { animation: fieldIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.7s both; }
.auth-form > *:nth-child(5) { animation: fieldIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.8s both; }

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

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 991.98px) {
    .auth-split { flex-direction: column; }

    .auth-hero {
        flex: none;
        max-width: 100%;
        min-height: 300px;
        padding: 0;
    }

    .auth-hero-content { padding: 2rem 2rem; }
    .auth-hero-title { font-size: 2.25rem; }
    .auth-hero-desc { font-size: 0.9375rem; margin-bottom: 1.5rem; }
    .auth-hero-features { display: none; }
    .auth-hero-footer { display: none; }

    .auth-form-panel {
        flex: none;
        max-width: 100%;
    }

    .auth-form-controls { padding: 1rem 1.5rem; }
    .auth-form-wrapper { padding: 0 1.5rem 2rem; }
}

@media (max-width: 575.98px) {
    .auth-hero { min-height: 220px; }
    .auth-hero-content { padding: 1.5rem; }
    .auth-hero-title { font-size: 1.75rem; }
    .auth-hero-logo { width: 40px; height: 40px; }
    .auth-form-inner { max-width: 100%; }
    .auth-input { height: 48px; font-size: 0.875rem; }
    .auth-submit-btn { height: 48px; font-size: 0.9375rem; }
}
