/* ============================================================
   خُطئ النور — ورقة الأنماط الرئيسية
   تصميم حديث ونظيف — RTL
   ============================================================ */

:root {
    --primary: #8b5cf6;       /* بنفسجي */
    --primary-dark: #6d28d9;  /* بنفسجي داكن */
    --primary-light: #f3e8ff; /* بنفسجي فاتح */
    --primary-rgb: 139, 92, 246;
    --accent: #ec4899;        /* وردي */
    --accent-light: #fce7f3;  /* وردي فاتح */
    --gold: #f59e0b;          /* ذهبي */
    --bg: #faf5ff;            /* خلفية بنفسجي فاتح */
    --card-bg: #ffffff;
    --text: #2e1065;
    --text-light: #7c3aed;
    --border: #e9d5ff;
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #10b981;
    --radius: 16px;
    --radius-lg: 22px;
    --shadow: 0 6px 20px rgba(139, 92, 246, 0.12);
    --shadow-lg: 0 14px 40px rgba(139, 92, 246, 0.18);
    --shadow-gold: 0 8px 28px rgba(236, 72, 153, 0.22);
    --font: 'Segoe UI', 'Tahoma', 'Cairo', 'Tajawal', sans-serif;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 15px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   صفحات المصادقة (تسجيل الدخول / الإعداد)
   ============================================================ */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 25%, #f472b6 70%, #db2777 100%);
}

.auth-page::before,
.auth-page::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.45;
    animation: float 8s ease-in-out infinite;
    pointer-events: none;
}

.auth-page::before {
    width: 400px; height: 400px;
    top: -10%; right: -10%;
    background: #c084fc;
    animation-delay: 0s;
}

.auth-page::after {
    width: 300px; height: 300px;
    bottom: -10%; left: -10%;
    background: #f9a8d4;
    animation-delay: -4s;
}

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

@keyframes sparkle {
    0%, 100% { opacity: 0; transform: scale(0) rotate(0deg); }
    50% { opacity: 1; transform: scale(1) rotate(180deg); }
}

.auth-page .sparkle {
    position: absolute;
    width: 20px; height: 20px;
    background: #fbbf24;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    animation: sparkle 3s ease-in-out infinite;
    opacity: 0;
}

.auth-card {
    position: relative;
    z-index: 10;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg), 0 0 0 2px rgba(236, 72, 153, 0.15) inset;
    padding: 44px;
    width: 100%;
    max-width: 460px;
    animation: slideUp 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-style: preserve-3d;
}

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

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f3e8ff 0%, #f9a8d4 100%);
    color: var(--primary-dark);
    font-size: 26px;
    font-weight: bold;
    margin-bottom: 18px;
    border: 3px solid var(--accent);
    box-shadow: 0 8px 24px rgba(236, 72, 153, 0.35);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 8px 24px rgba(236, 72, 153, 0.35); }
    50% { transform: scale(1.05); box-shadow: 0 12px 32px rgba(236, 72, 153, 0.5); }
}

.auth-header h1 {
    font-size: 26px;
    color: var(--text);
    margin-bottom: 6px;
}

.auth-header p {
    color: var(--text-light);
    font-size: 14px;
}

.auth-form .form-group {
    margin-bottom: 20px;
}

.auth-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
}

.auth-form input {
    width: 100%;
    padding: 13px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    font-family: var(--font);
    transition: all var(--transition);
    background: #fafbfc;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px var(--primary-light);
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    color: var(--text-light);
    font-size: 13px;
}

/* ============================================================
   الأزرار
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 22px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.btn:hover { text-decoration: none; transform: translateY(-3px) scale(1.02); box-shadow: 0 6px 16px rgba(139, 92, 246, 0.25); }

.btn-primary {
    background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
    color: #fff;
    width: 100%;
    border: none;
    position: relative;
    overflow: hidden;
}

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

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

.btn-primary:hover { background: linear-gradient(135deg, #db2777 0%, #7c3aed 100%); box-shadow: 0 8px 22px rgba(236, 72, 153, 0.4); }

.btn-outline {
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); box-shadow: 0 4px 16px rgba(236, 72, 153, 0.15); }

.btn-sm { padding: 7px 16px; font-size: 13px; }

.btn-danger { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); color: #fff; }
.btn-danger:hover { background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%); }

/* ============================================================
   التنبيهات
   ============================================================ */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error   { background: #fdeaea; color: var(--danger); border: 1px solid #f5c6c6; }
.alert-success { background: #e8f8f0; color: var(--success); border: 1px solid #b8e6d0; }
.alert-warning { background: #fdf8e8; color: #8a6d1a; border: 1px solid #f5e6b8; }

/* ============================================================
   لوحة التحكم
   ============================================================ */
.dashboard-page {
    display: flex;
    min-height: 100vh;
}

.topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    height: 66px;
    background: linear-gradient(90deg, #ffffff 0%, #faf5ff 100%);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    z-index: 100;
    border-bottom: 2px solid rgba(236, 72, 153, 0.15);
}

.topbar .logo {
    font-size: 24px;
    font-weight: 800;
    background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
    animation: shimmer 3s linear infinite;
    background-size: 200% auto;
}

@keyframes shimmer {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

.sidebar {
    position: fixed;
    top: 66px;
    right: 0;
    bottom: 0;
    width: 240px;
    background: linear-gradient(180deg, #ffffff 0%, #fae8ff 100%);
    box-shadow: var(--shadow);
    padding: 26px 0;
    overflow-y: auto;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 24px;
    margin: 5px 14px;
    color: var(--text);
    font-size: 15px;
    border-radius: 12px;
    border-right: 3px solid transparent;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.sidebar nav a::before {
    content: '';
    position: absolute;
    right: 0; top: 0; bottom: 0; width: 0%;
    background: linear-gradient(90deg, var(--primary-light), var(--accent-light));
    transition: width var(--transition);
    z-index: -1;
}

.sidebar nav a:hover::before { width: 100%; }

.sidebar nav a:hover {
    text-decoration: none;
    color: var(--primary-dark);
    transform: translateX(-4px) scale(1.02);
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.12);
}

.sidebar nav a.active {
    background: linear-gradient(90deg, #f3e8ff 0%, #fce7f3 100%);
    border-right-color: var(--accent);
    color: var(--primary-dark);
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.12);
}

.content {
    margin-top: 64px;
    margin-right: 230px;
    padding: 34px;
    flex: 1;
    background: var(--bg);
}

.content h1 {
    font-size: 26px;
    margin-bottom: 26px;
    color: var(--text);
    position: relative;
    padding-bottom: 12px;
}

.content h1::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: 2px;
}

/* بطاقات الإحصائيات */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 22px;
    margin-bottom: 34px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 26px;
    text-align: center;
    border: 1px solid rgba(236, 72, 153, 0.1);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 5px;
    background: linear-gradient(90deg, #ec4899 0%, #8b5cf6 50%, #f59e0b 100%);
}

.stat-card::after {
    content: '✨';
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 18px;
    opacity: 0.3;
    animation: sparkle 3s ease-in-out infinite;
}

.stat-card:hover {
    transform: translateY(-6px) rotateX(5deg);
    box-shadow: var(--shadow-lg), 0 20px 40px rgba(236, 72, 153, 0.15);
}

.stat-number {
    display: block;
    font-size: 38px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    display: block;
    color: var(--text-light);
    font-size: 14px;
    margin-top: 6px;
    font-weight: 500;
}

.welcome-box {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 30px;
    border: 1px solid rgba(236, 72, 153, 0.08);
    margin-bottom: 24px;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.welcome-box:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.welcome-box h2 {
    font-size: 20px;
    margin-bottom: 16px;
    color: var(--text);
}

.welcome-box p {
    color: var(--text-light);
}

/* ============================================================
   الجداول
   ============================================================ */
.table-container {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 26px;
    border: 1px solid rgba(236, 72, 153, 0.08);
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th, table td {
    padding: 15px 18px;
    text-align: right;
    border-bottom: 1px solid var(--border);
}

table th {
    background: linear-gradient(180deg, #faf5ff 0%, #f3e8ff 100%);
    font-weight: 700;
    font-size: 14px;
    color: var(--primary-dark);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

table tr { transition: background var(--transition); }
table tr:hover { background: var(--primary-light); }

/* ============================================================
   النماذج العامة
   ============================================================ */
.form-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 32px;
    max-width: 600px;
    margin-bottom: 26px;
    border: 1px solid rgba(236, 72, 153, 0.08);
}

.form-card h2 {
    font-size: 22px;
    margin-bottom: 22px;
    color: var(--text);
    position: relative;
    padding-bottom: 10px;
}

.form-card h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 40px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: 2px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 7px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    font-family: var(--font);
    transition: all var(--transition);
    background: #fafbfc;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px var(--primary-light);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.alert {
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 22px;
    font-size: 14px;
    border: 1px solid transparent;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.alert-error   { background: #fff2f2; color: var(--danger); border-color: #f5c2c2; }
.alert-success { background: #e8f8f0; color: var(--success); border-color: #b8e6d0; }
.alert-warning { background: #fff8e6; color: #8a6d1a; border-color: #f5e6b8; }

/* ============================================================
   التجاوب (Responsive)
   ============================================================ */
@media (max-width: 768px) {
    .sidebar {
        position: static;
        width: 100%;
        height: auto;
    }

    .sidebar nav {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        padding: 0 12px;
    }

    .sidebar nav a {
        padding: 8px 14px;
        border-right: none;
        border-bottom: 3px solid transparent;
        font-size: 14px;
    }

    .sidebar nav a.active {
        border-right: none;
        border-bottom-color: var(--primary);
    }

    .content {
        margin-right: 0;
        padding: 20px;
    }

    .topbar { padding: 0 16px; }
    .auth-card { padding: 30px 20px; }
}
