@font-face {
    font-family: 'Tajawal';
    src: url('../../admin/fonts/subset-Tajawal-Regular.woff2') format('woff2'),
    url('../../admin/fonts/subset-Tajawal-Regular.woff') format('woff');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

:root {
    --primary-color: #14b8a6;              /* Teal – الابتكار */
    --secondary-color: #5b6ee1;            /* Indigo – الثقة */
    --bg-base: #eef2f6;                    /* خلفية نهارية هادئة */
    --grid-line: rgba(15, 23, 42, 0.035);  /* خطوط الشبكة الهندسية الثابتة */
    --text-main: #0f172a;
    --text-secondary: #64748b;
    --glass-bg: rgba(255, 255, 255, 0.78);
    --glass-border: rgba(255, 255, 255, 0.95);
    --card-shadow: 0 25px 55px -12px rgba(15, 23, 42, 0.12);
    --input-bg: #ffffff;
    --input-border: #cbd5e1;
    --brand-panel-bg: linear-gradient(135deg, rgba(20, 184, 166, 0.08), rgba(91, 110, 225, 0.1));
}

/* متغيرات الوضع الليلي (SpaceMoon Deep Space) */
html.dark-mode {
    --primary-color: #2dd4bf;
    --secondary-color: #818cf8;
    --bg-base: #090d16;
    --grid-line: rgba(255, 255, 255, 0.03);
    --text-main: #f8fafc;
    --text-secondary: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.75);
    --glass-border: rgba(255, 255, 255, 0.1);
    --card-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.7);
    --input-bg: rgba(15, 23, 42, 0.9);
    --input-border: #334155;
    --brand-panel-bg: linear-gradient(135deg, rgba(20, 184, 166, 0.1), rgba(91, 110, 225, 0.14));
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Tajawal', sans-serif;
}

body {
    background-color: var(--bg-base);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    transition: background-color 0.35s ease;
}

/* =========================================================
   1. الخلفية الثابتة المريحة للعين (Static Grid + Ambient Glow)
   ========================================================= */
.bg-canvas {
    position: fixed;
    inset: 0;
    z-index: 1;
    overflow: hidden;
    pointer-events: none;
}

/* شبكة هندسية ثابتة تماماً لتوفير ارتكاز بصري مريح للعين */
.bg-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
        linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(circle at center, black 50%, transparent 92%);
    -webkit-mask-image: radial-gradient(circle at center, black 50%, transparent 92%);
}

/* إضاءة الهوية المحيطية: ثابتة في مكانها حول البطاقة (بدون إزاحة تسبب الدوار) */
.aurora-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(85px);
}

/* الهالة التركوازية خلف الزاوية العلوية اليمنى للبطاقة */
.orb-teal {
    width: 440px;
    height: 440px;
    background: radial-gradient(circle, rgba(20, 184, 166, 0.45) 0%, rgba(20, 184, 166, 0) 70%);
    top: calc(50% - 340px);
    right: calc(50% - 520px);
}

/* الهالة النيلية خلف الزاوية السفلية اليسرى للبطاقة */
.orb-indigo {
    width: 480px;
    height: 480px;
    background: radial-gradient(circle, rgba(91, 110, 225, 0.42) 0%, rgba(91, 110, 225, 0) 70%);
    bottom: calc(50% - 360px);
    left: calc(50% - 540px);
}

/* إضاءة خافتة جداً في المنتصف لدمج اللونين خلف الزجاج */
.orb-accent {
    width: 500px;
    height: 320px;
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.16), rgba(91, 110, 225, 0.16));
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    filter: blur(95px);
}

html.dark-mode .orb-teal {
    background: radial-gradient(circle, rgba(20, 184, 166, 0.28) 0%, rgba(20, 184, 166, 0) 70%);
}

html.dark-mode .orb-indigo {
    background: radial-gradient(circle, rgba(91, 110, 225, 0.28) 0%, rgba(91, 110, 225, 0) 70%);
}

html.dark-mode .orb-accent {
    opacity: 0.6;
}

/* =========================================================
   2. زر تبديل الوضع الليلي/النهاري العائم
   ========================================================= */
.theme-toggle-btn {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 20;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text-main);
    font-size: 1.15rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.25s ease;
}

.theme-toggle-btn:hover {
    transform: translateY(-2px);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

html.dark-mode .theme-toggle-btn i {
    color: #fbbf24;
}

/* =========================================================
   3. الكارد الزجاجي الرئيسي
   ========================================================= */
.login-wrapper {
    position: relative;
    z-index: 10;
    width: 90%;
    max-width: 920px;
    min-height: 520px;
    display: flex;
    border-radius: 24px;
    background: var(--glass-bg);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--card-shadow);
    overflow: hidden;
    animation: cardEntrance 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

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

/* شريط الهوية العلوي ثابت وأنيق */
.login-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    z-index: 12;
}

/* === القسم الأيمن: النموذج === */
.form-section {
    flex: 1.05;
    padding: 45px 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: var(--text-main);
}

.login-header {
    margin-bottom: 30px;
    text-align: right;
}

.login-header h2 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 6px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* تنبيه الخطأ */
.login-alert-error {
    background: rgba(254, 226, 226, 0.92);
    border: 1px solid #fecaca;
    border-right: 5px solid #dc2626;
    color: #991b1b;
    padding: 13px 18px;
    border-radius: 12px;
    margin-bottom: 22px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 0.92rem;
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.08);
}

html.dark-mode .login-alert-error {
    background: rgba(127, 29, 29, 0.35);
    border-color: rgba(248, 113, 113, 0.3);
    border-right-color: #ef4444;
    color: #fca5a5;
}

.login-alert-error i {
    font-size: 1.15rem;
    color: #dc2626;
}

html.dark-mode .login-alert-error i {
    color: #f87171;
}

/* الحقول */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-main);
    font-weight: 700;
    font-size: 0.92rem;
}

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

.input-wrapper input {
    width: 100%;
    padding: 14px 42px 14px 45px;
    border: 1.5px solid var(--input-border);
    border-radius: 12px;
    background: var(--input-bg);
    font-size: 0.98rem;
    color: var(--text-main);
    transition: all 0.25s ease;
}

.input-wrapper input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.input-wrapper .input-icon {
    position: absolute;
    right: 15px;
    color: #94a3b8;
    font-size: 1.05rem;
    transition: color 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}

.toggle-password {
    position: absolute;
    left: 12px;
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 6px;
    font-size: 1rem;
    transition: color 0.2s ease;
}

.toggle-password:hover {
    color: var(--primary-color);
}

.input-wrapper input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.15);
    outline: none;
}

.input-wrapper input:focus ~ .input-icon {
    color: var(--primary-color);
    transform: scale(1.08);
}

/* زر الدخول: ثابت ومريح، ويتحرك لونه بانسيابية عند تمرير الماوس فقط */
.btn-login {
    width: 100%;
    padding: 14px;
    margin-top: 12px;
    background: linear-gradient(135deg, #14b8a6 0%, #5b6ee1 50%, #14b8a6 100%);
    background-size: 200% auto;
    background-position: left center;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1.08rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-position 0.45s ease, transform 0.25s ease, box-shadow 0.25s ease;
    box-shadow: 0 10px 20px -5px rgba(20, 184, 166, 0.35);
}

.btn-login:hover {
    background-position: right center;
    transform: translateY(-2px);
    box-shadow: 0 15px 25px -5px rgba(91, 110, 225, 0.45);
}

.btn-login i {
    transition: transform 0.25s ease;
}

.btn-login:hover i {
    transform: translateX(-5px);
}

.login-footer {
    margin-top: auto;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.82rem;
    padding-top: 24px;
}

/* =========================================================
   4. القسم الأيسر: البراند وحركة الشعار الهادئة
   ========================================================= */
.brand-section {
    flex: 0.95;
    background: var(--brand-panel-bg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 40px;
    position: relative;
    border-right: 1px solid var(--glass-border);
    overflow: hidden;
}

/* إضاءة خلفية ثابتة وناعمة خلف الشعار لإبرازه دون دوران */
.brand-section::before {
    content: '';
    position: absolute;
    width: 260px;
    height: 260px;
    background: radial-gradient(circle, rgba(20, 184, 166, 0.22) 0%, rgba(91, 110, 225, 0.18) 50%, transparent 75%);
    filter: blur(35px);
    border-radius: 50%;
    z-index: 1;
}

.brand-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    z-index: 2;
}

/* حركة الطفو الهادئة للشعار التي أعجبتك */
.full-logo {
    width: 100%;
    max-width: 320px;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 14px 22px rgba(0, 0, 0, 0.1));
    animation: floatLogo 4.5s ease-in-out infinite;
}

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

html.dark-mode .full-logo {
    filter: brightness(1.15) drop-shadow(0 14px 26px rgba(0, 0, 0, 0.45));
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 8px 18px;
    border-radius: 999px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

/* النقطة النابضة في الشارة */
.badge-dot {
    position: relative;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--primary-color);
}

.badge-dot::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background-color: var(--primary-color);
    animation: badgePulse 2.2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes badgePulse {
    0%   { transform: scale(1); opacity: 0.75; }
    100% { transform: scale(2.6); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .full-logo, .badge-dot::after {
        animation: none !important;
    }
}

/* للتجاوب مع الجوال */
@media (max-width: 900px) {
    body {
        overflow-y: auto;
        padding: 20px 0;
    }
    .login-wrapper {
        flex-direction: column-reverse;
        width: 92%;
        min-height: auto;
    }
    .brand-section {
        padding: 28px 20px;
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
    }
    .full-logo {
        max-width: 220px;
    }
    .form-section {
        padding: 30px 24px;
    }
}
