/* ================================================================
   AUTH-MODERN.CSS — Enterprise Login Page
   Crystal Glassmorphism • Animated • RTL • Arabic
   ================================================================ */

/* ══════════════ TOKENS ══════════════ */
:root {
    --auth-blue-50: #eff6ff;
    --auth-blue-100: #dbeafe;
    --auth-blue-200: #bfdbfe;
    --auth-blue-300: #93c5fd;
    --auth-blue-400: #60a5fa;
    --auth-blue-500: #3b82f6;
    --auth-blue-600: #2563eb;
    --auth-blue-700: #1d4ed8;
    --auth-blue-800: #1e40af;
    --auth-blue-900: #1e3a8a;

    --auth-surface: rgba(255, 255, 255, 0.88);
    --auth-glass: rgba(255, 255, 255, 0.45);
    --auth-text: #0f172a;
    --auth-muted: #64748b;
    --auth-border: rgba(15, 23, 42, 0.08);
    --auth-radius: 24px;
    --auth-radius-sm: 14px;
    --auth-radius-xs: 10px;
    --auth-shadow: 0 25px 60px rgba(15, 23, 42, 0.12);
    --auth-shadow-sm: 0 4px 16px rgba(15, 23, 42, 0.06);
    --auth-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --auth-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --auth-font: 'Tajawal', 'Cairo', system-ui, -apple-system, sans-serif;
}

/* ══════════════ RESET ══════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

::selection {
    background: rgba(59, 130, 246, 0.18);
    color: var(--auth-blue-900);
}

/* ══════════════ BODY / SHELL ══════════════ */
body.ur-auth-body {
    margin: 0;
    font-family: var(--auth-font);
    font-size: 14px;
    color: var(--auth-text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;

    /* Animated mesh gradient background */
    background-color: #f0f4ff;
    background-image:
        radial-gradient(ellipse 900px 600px at 15% 20%, rgba(59, 130, 246, 0.14), transparent),
        radial-gradient(ellipse 700px 500px at 85% 75%, rgba(34, 197, 94, 0.08), transparent),
        radial-gradient(ellipse 500px 400px at 50% 50%, rgba(59, 130, 246, 0.06), transparent),
        linear-gradient(160deg, #f0f4ff 0%, #faf8f5 50%, #f0f4ff 100%);
    background-attachment: fixed;
}

/* Animated floating orbs */
body.ur-auth-body::before,
body.ur-auth-body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

body.ur-auth-body::before {
    width: 500px;
    height: 500px;
    top: -120px;
    right: -100px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.1), transparent 70%);
    animation: authFloat 18s ease-in-out infinite;
}

body.ur-auth-body::after {
    width: 400px;
    height: 400px;
    bottom: -80px;
    left: -60px;
    background: radial-gradient(circle, rgba(34, 197, 94, 0.08), transparent 70%);
    animation: authFloat 22s ease-in-out infinite reverse;
}

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

.ur-auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    z-index: 1;
}

/* ══════════════ MAIN CARD ══════════════ */
.auth-card {
    width: min(1140px, 100%);
    background: var(--auth-glass);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: calc(var(--auth-radius) + 8px);
    box-shadow: var(--auth-shadow);
    padding: 14px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    animation: authCardIn 0.7s var(--auth-ease) both;
}

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

.auth-card-inner {
    background: #fff;
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 620px;
}

/* ══════════════ LEFT PANEL (FORM) ══════════════ */
.auth-left {
    padding: 48px 44px 32px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    animation: authSlideRight 0.6s 0.15s var(--auth-ease) both;
}

@keyframes authSlideRight {
    from {
        opacity: 0;
        transform: translateX(24px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Brand */
.brand-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 36px;
    animation: authFadeDown 0.5s 0.3s var(--auth-ease) both;
}

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

.brand-logo {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--auth-blue-500), var(--auth-blue-700));
    display: grid;
    place-items: center;
    color: #fff;
    box-shadow: 0 8px 22px rgba(59, 130, 246, 0.3);
    transition: transform 0.3s var(--auth-ease-spring);
}

.brand-logo:hover {
    transform: scale(1.1) rotate(-5deg);
}

.brand-logo svg {
    width: 20px;
    height: 20px;
}

.brand-name {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--auth-text);
    letter-spacing: 0.2px;
}

/* Welcome text */
.welcome {
    margin-bottom: 32px;
    animation: authFadeUp 0.5s 0.4s var(--auth-ease) both;
}

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

.welcome h1 {
    font-size: 1.75rem;
    font-weight: 900;
    color: var(--auth-text);
    margin-bottom: 8px;
    letter-spacing: -0.3px;
    line-height: 1.3;
}

.welcome p {
    color: var(--auth-muted);
    font-size: 0.92rem;
    font-weight: 500;
    line-height: 1.6;
    margin: 0;
}

/* Form */
.form-block {
    animation: authFadeUp 0.5s 0.5s var(--auth-ease) both;
}

.field-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--auth-text);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.field-label::before {
    content: '';
    width: 3px;
    height: 14px;
    border-radius: 3px;
    background: linear-gradient(180deg, var(--auth-blue-400), var(--auth-blue-600));
    flex-shrink: 0;
}

/* Input Fields */
.ur-input {
    width: 100%;
    padding: 13px 16px;
    border: 1.5px solid var(--auth-border) !important;
    border-radius: var(--auth-radius-xs) !important;
    background: rgba(248, 250, 252, 0.6) !important;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--auth-text);
    transition: all 0.25s var(--auth-ease);
    font-family: var(--auth-font);
}

.ur-input:focus {
    outline: none;
    border-color: var(--auth-blue-400) !important;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1),
                0 4px 12px rgba(59, 130, 246, 0.08) !important;
    background: #fff !important;
    transform: translateY(-1px);
}

.ur-input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

/* Password wrapper */
.pass-wrap {
    position: relative;
}

.pass-wrap .ur-input {
    padding-left: 48px;
}

.pass-toggle {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--auth-muted);
    padding: 4px;
    border-radius: 8px;
    transition: all 0.2s var(--auth-ease);
    display: grid;
    place-items: center;
}

.pass-toggle:hover {
    color: var(--auth-blue-500);
    background: var(--auth-blue-50);
}

/* Checkbox row */
.row-mini {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 16px 0 4px;
    font-size: 0.82rem;
    color: var(--auth-muted);
    font-weight: 600;
}

.form-check-input {
    border-radius: 6px !important;
    border: 1.5px solid var(--auth-border) !important;
    width: 18px;
    height: 18px;
    cursor: pointer;
    transition: all 0.2s var(--auth-ease);
}

.form-check-input:checked {
    background-color: var(--auth-blue-500) !important;
    border-color: var(--auth-blue-500) !important;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12) !important;
}

/* Links */
.link {
    color: var(--auth-blue-600);
    font-weight: 700;
    font-size: 0.82rem;
    text-decoration: none;
    transition: color 0.2s;
    position: relative;
}

.link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: 0;
    width: 0;
    height: 2px;
    background: var(--auth-blue-400);
    border-radius: 2px;
    transition: width 0.3s var(--auth-ease);
}

.link:hover {
    color: var(--auth-blue-700);
}

.link:hover::after {
    width: 100%;
}

/* Submit Button */
.btn-main {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: var(--auth-radius-xs);
    background: linear-gradient(135deg, var(--auth-blue-500), var(--auth-blue-700));
    color: #fff;
    font-size: 0.95rem;
    font-weight: 800;
    font-family: var(--auth-font);
    cursor: pointer;
    transition: all 0.3s var(--auth-ease);
    position: relative;
    overflow: hidden;
    margin-top: 20px;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.3);
    letter-spacing: 0.3px;
}

.btn-main:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(59, 130, 246, 0.4);
    filter: brightness(1.06);
}

.btn-main:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

/* Ripple effect */
.btn-main::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 10%, transparent 60%);
    opacity: 0;
    transform: scale(0);
    transition: transform 0.5s, opacity 0.4s;
    pointer-events: none;
}

.btn-main:active::after {
    opacity: 1;
    transform: scale(3);
    transition: 0s;
}

/* Loading state for button */
.btn-main.is-loading {
    pointer-events: none;
    opacity: 0.85;
}

.btn-main.is-loading::before {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: authSpin 0.6s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

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

/* Validation errors */
.text-danger {
    font-size: 0.82rem;
    font-weight: 600;
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: var(--auth-radius-xs);
    padding: 10px 14px;
    color: #dc2626;
}

.text-danger:empty {
    display: none;
}

/* Footer */
.auth-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 24px;
    margin-top: 20px;
    border-top: 1px solid var(--auth-border);
    font-size: 0.78rem;
    color: var(--auth-muted);
    font-weight: 500;
    animation: authFadeUp 0.5s 0.7s var(--auth-ease) both;
}

/* ══════════════ RIGHT PANEL (SHOWCASE) ══════════════ */
.auth-right {
    background:
        radial-gradient(ellipse at 20% 80%, rgba(34, 197, 94, 0.12), transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(59, 130, 246, 0.08), transparent 50%),
        linear-gradient(145deg, var(--auth-blue-600), var(--auth-blue-800));
    padding: 48px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    animation: authPanelIn 0.8s 0.2s var(--auth-ease) both;
}

@keyframes authPanelIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Crystal geometric decorations */
.auth-right::before {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    top: -80px;
    left: -80px;
    animation: authOrbit 25s linear infinite;
}

.auth-right::after {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    bottom: -40px;
    right: -40px;
    animation: authOrbit 20s linear infinite reverse;
}

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

/* Floating particles */
.auth-right .auth-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    animation: authParticleFloat 8s ease-in-out infinite;
}

.auth-right .auth-particle:nth-child(1) { top: 15%; right: 20%; animation-delay: 0s; }
.auth-right .auth-particle:nth-child(2) { top: 40%; right: 70%; animation-delay: 2s; width: 4px; height: 4px; }
.auth-right .auth-particle:nth-child(3) { top: 70%; right: 30%; animation-delay: 4s; width: 8px; height: 8px; }
.auth-right .auth-particle:nth-child(4) { top: 85%; right: 60%; animation-delay: 1s; width: 5px; height: 5px; }
.auth-right .auth-particle:nth-child(5) { top: 25%; right: 50%; animation-delay: 3s; }
.auth-right .auth-particle:nth-child(6) { top: 55%; right: 85%; animation-delay: 5s; width: 3px; height: 3px; }

@keyframes authParticleFloat {
    0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.3; }
    50% { transform: translate(15px, -20px) scale(1.5); opacity: 0.7; }
}

.right-title {
    position: relative;
    z-index: 2;
    text-align: center;
    margin-bottom: 32px;
    animation: authFadeUp 0.6s 0.4s var(--auth-ease) both;
}

.right-title h2 {
    font-size: 1.6rem;
    font-weight: 900;
    color: #fff;
    margin-bottom: 14px;
    line-height: 1.5;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.right-title p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.7;
    max-width: 380px;
    margin: 0 auto;
}

/* Feature chips */
.auth-features {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 28px;
    position: relative;
    z-index: 2;
    animation: authFadeUp 0.6s 0.5s var(--auth-ease) both;
}

.auth-feature-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.78rem;
    font-weight: 700;
    transition: all 0.25s var(--auth-ease);
    white-space: nowrap;
}

.auth-feature-chip:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.auth-feature-chip i {
    font-size: 0.72rem;
    opacity: 0.8;
}

/* Mock dashboard preview */
.mock-wrap {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 420px;
    animation: authMockIn 0.8s 0.6s var(--auth-ease-spring) both;
}

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

.mock-img {
    width: 100%;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: block;
    transition: transform 0.4s var(--auth-ease);
}

.mock-img:hover {
    transform: translateY(-6px) scale(1.02);
}

/* Fallback if no image */
.mock-fallback {
    width: 100%;
    aspect-ratio: 16/10;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: rgba(255, 255, 255, 0.6);
}

.mock-fallback i {
    font-size: 2.5rem;
    opacity: 0.5;
}

.mock-fallback span {
    font-size: 0.85rem;
    font-weight: 600;
}

/* Stats row at bottom of right panel */
.auth-stats {
    display: flex;
    gap: 20px;
    margin-top: 28px;
    position: relative;
    z-index: 2;
    animation: authFadeUp 0.6s 0.7s var(--auth-ease) both;
}

.auth-stat {
    text-align: center;
    padding: 12px 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    min-width: 90px;
    transition: all 0.25s var(--auth-ease);
}

.auth-stat:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-3px);
}

.auth-stat-val {
    font-size: 1.3rem;
    font-weight: 900;
    color: #fff;
    line-height: 1.2;
}

.auth-stat-label {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.65);
    font-weight: 600;
    margin-top: 2px;
}

/* ══════════════ INPUT FOCUS GLOW LINE ══════════════ */
.input-glow-wrap {
    position: relative;
}

.input-glow-wrap::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--auth-blue-400), var(--auth-blue-600));
    border-radius: 0 0 var(--auth-radius-xs) var(--auth-radius-xs);
    transform: scaleX(0);
    transition: transform 0.3s var(--auth-ease);
    pointer-events: none;
}

.input-glow-wrap:focus-within::after {
    transform: scaleX(1);
}

/* ══════════════ SOCIAL / SSO BUTTONS ══════════════ */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 20px 0;
    color: var(--auth-muted);
    font-size: 0.78rem;
    font-weight: 600;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--auth-border);
}

/* ══════════════ RESPONSIVE ══════════════ */
@media (max-width: 992px) {
    .auth-card-inner {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .auth-right {
        display: none;
    }

    .auth-left {
        padding: 36px 28px 28px;
    }

    .welcome h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 600px) {
    .ur-auth-shell {
        padding: 12px;
        align-items: flex-start;
        padding-top: 40px;
    }

    .auth-card {
        padding: 10px;
        border-radius: 20px;
    }

    .auth-card-inner {
        border-radius: 16px;
    }

    .auth-left {
        padding: 28px 20px 24px;
    }

    .brand-row {
        margin-bottom: 28px;
    }

    .welcome h1 {
        font-size: 1.35rem;
    }

    .welcome p {
        font-size: 0.85rem;
    }

    .btn-main {
        padding: 12px 20px;
        font-size: 0.88rem;
    }

    .auth-footer {
        flex-direction: column;
        gap: 6px;
        text-align: center;
    }
}

/* ══════════════ TOUCH TARGETS ══════════════ */
@media (pointer: coarse) {
    .ur-input {
        padding: 14px 16px;
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .btn-main {
        min-height: 50px;
    }

    .pass-toggle {
        width: 40px;
        height: 40px;
    }
}

/* ══════════════ ACCESSIBILITY ══════════════ */
:focus-visible {
    outline: 2px solid var(--auth-blue-400);
    outline-offset: 2px;
}

/* ══════════════ PRINT ══════════════ */
@media print {
    .auth-right { display: none; }
    .auth-card { box-shadow: none; border: 1px solid #ddd; }
    body.ur-auth-body { background: #fff; }
    body.ur-auth-body::before,
    body.ur-auth-body::after { display: none; }
}
