﻿/* ============================================
   🌤️ ثيم "السماء المشرقة" - Bright Sky Theme
   Version: 11.0 - Fully Fixed Light/Dark Logic
   ============================================ */

/* ============================================
   1️⃣ الوضع النهاري (الافتراضي) - Light Mode
   ============================================ */
:root {
    /* 🌟 الألوان الأساسية */
    --primary: #3a7bd5;
    --primary-rgb: 58, 123, 213;
    --primary-light: #5a9be8;
    --primary-dark: #2a5fb0;
    --secondary: #4a8ad0;
    --secondary-rgb: 74, 138, 208;
    --success: #3ab8b0;
    --success-rgb: 58, 184, 176;
    --success-dark: #2eb0a7;
    --warning: #f0c84a;
    --warning-rgb: 240, 200, 74;
    --warning-dark: #e8b83a;
    --danger: #d96a70;
    --danger-rgb: 217, 106, 112;
    --danger-dark: #c9555b;
    --info: #5aadd0;
    --info-rgb: 90, 173, 208;
    --info-light: #7ac0e0;
    --purple: #a88ad0;
    --purple-rgb: 168, 138, 208;
    --purple-light: #c0a8e0;
    --pink: #e8a8b8;
    --pink-rgb: 232, 168, 184;
    --pink-light: #f0c0d0;
    --gold: #f0d080;
    --gold-rgb: 240, 208, 128;
    --teal: #6ad0c8;
    --teal-rgb: 106, 208, 200;
    --rose: #e8b0a0;
    --rose-rgb: 232, 176, 160;
    /* ☀️ خلفيات فاتحة ونقية */
    --bg-main: #f4f7fa;
    --bg-card: #ffffff;
    --bg-soft: #f8fafc;
    --bg-hover: #eef2f6;
    --bg-muted: #e2e8f0;
    --bg-glass: rgba(255, 255, 255, 0.85);
    /* 📝 نصوص داكنة وواضحة */
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    /* 🔲 حدود فاتحة */
    --border: rgba(58, 123, 213, 0.15);
    --border-light: rgba(58, 123, 213, 0.06);
    --border-active: #3a7bd5;
    /* 🌊 التدرجات */
    --gradient-primary: linear-gradient(135deg, #3a7bd5 0%, #4a8ad0 100%);
    --gradient-secondary: linear-gradient(135deg, #4a8ad0 0%, #5a9be8 100%);
    --gradient-success: linear-gradient(135deg, #3ab8b0 0%, #5ac8c0 100%);
    --gradient-warning: linear-gradient(135deg, #f0c84a 0%, #f7d860 100%);
    --gradient-danger: linear-gradient(135deg, #d96a70 0%, #e88085 100%);
    --gradient-info: linear-gradient(135deg, #5aadd0 0%, #7ac0e0 100%);
    --gradient-purple: linear-gradient(135deg, #a88ad0 0%, #c0a8e0 100%);
    --gradient-pink: linear-gradient(135deg, #e8a8b8 0%, #f0c0d0 100%);
    --gradient-ocean: linear-gradient(135deg, #3a7bd5 0%, #3ab8b0 100%);
    --gradient-sunset: linear-gradient(135deg, #3a7bd5 0%, #5a9be8 50%, #f0c84a 100%);
    --gradient-rainbow: linear-gradient(135deg, #3a7bd5 0%, #3ab8b0 25%, #f0c84a 50%, #d96a70 75%, #a88ad0 100%);
    --gradient-dark: linear-gradient(135deg, #f4f7fa 0%, #eef2f6 50%, #e2e8f0 100%);
    /* ✨ ظلال خفيفة */
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 6px 18px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.08);
    --shadow-xl: 0 16px 45px rgba(15, 23, 42, 0.10);
    --shadow-2xl: 0 25px 60px rgba(15, 23, 42, 0.12);
    --shadow-glow: 0 0 40px rgba(58, 123, 213, 0.08);
    /* 📐 الزوايا */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    /* ⚡ الانتقالات */
    --transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
    --transition-slow: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   2️⃣ الوضع الليلي - Dark Mode
   ============================================ */
[data-theme="dark"] {
    --primary: #4a90d9;
    --primary-rgb: 74, 144, 217;
    --primary-light: #6ba8e8;
    --primary-dark: #2a70b9;
    --secondary: #5b9bd5;
    --secondary-rgb: 91, 155, 213;
    --success: #4ecdc4;
    --success-rgb: 78, 205, 196;
    --warning: #f7dc6f;
    --warning-rgb: 247, 220, 111;
    --danger: #e8858a;
    --danger-rgb: 232, 133, 138;
    --info: #7bb8d9;
    --info-rgb: 123, 184, 217;
    --purple: #b8a0d9;
    --purple-rgb: 184, 160, 217;
    --pink: #e8a8b8;
    --pink-rgb: 232, 168, 184;
    --gold: #f0d080;
    --gold-rgb: 240, 208, 128;
    --teal: #6ad0c8;
    --teal-rgb: 106, 208, 200;
    --bg-main: #0d1117;
    --bg-card: #161b22;
    --bg-soft: #1c2333;
    --bg-hover: #252d3f;
    --bg-muted: #2d3548;
    --bg-glass: rgba(22, 27, 34, 0.95);
    --text-primary: #e6edf3;
    --text-secondary: #c9d1d9;
    --text-muted: #8b949e;
    --border: rgba(74, 144, 217, 0.2);
    --border-light: rgba(74, 144, 217, 0.08);
    --border-active: #4a90d9;
    --gradient-primary: linear-gradient(135deg, #4a90d9 0%, #5b9bd5 100%);
    --gradient-secondary: linear-gradient(135deg, #5b9bd5 0%, #7bb5e8 100%);
    --gradient-success: linear-gradient(135deg, #4ecdc4 0%, #6ad0c8 100%);
    --gradient-warning: linear-gradient(135deg, #f7dc6f 0%, #f0d080 100%);
    --gradient-danger: linear-gradient(135deg, #e8858a 0%, #e8a0a0 100%);
    --gradient-info: linear-gradient(135deg, #7bb8d9 0%, #9acce8 100%);
    --gradient-purple: linear-gradient(135deg, #b8a0d9 0%, #d0b8e8 100%);
    --gradient-pink: linear-gradient(135deg, #e8a8b8 0%, #f0c0d0 100%);
    --gradient-ocean: linear-gradient(135deg, #4a90d9 0%, #4ecdc4 100%);
    --gradient-dark: linear-gradient(135deg, #0d1117 0%, #161b22 50%, #1c2333 100%);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 35px rgba(0, 0, 0, 0.6);
    --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.7);
    --shadow-2xl: 0 30px 70px rgba(0, 0, 0, 0.8);
    --shadow-glow: 0 0 40px rgba(74, 144, 217, 0.15);
}

/* ============================================
   3️⃣ الأنماط الأساسية
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.35s ease, color 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    background: var(--bg-main) !important;
    color: var(--text-primary) !important;
    min-height: 100vh;
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

    /* الخلفية المتحركة */
    body::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: -3;
        pointer-events: none;
        background: radial-gradient(ellipse at 10% 20%, rgba(58, 123, 213, 0.06) 0%, transparent 60%), radial-gradient(ellipse at 90% 80%, rgba(58, 184, 176, 0.04) 0%, transparent 60%);
        animation: skyPulse 20s ease-in-out infinite alternate;
    }

[data-theme="dark"] body::before {
    background: radial-gradient(ellipse at 10% 20%, rgba(74, 144, 217, 0.08) 0%, transparent 60%), radial-gradient(ellipse at 90% 80%, rgba(78, 205, 196, 0.06) 0%, transparent 60%);
}

@keyframes skyPulse {
    0% {
        opacity: 0.7;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.03);
    }

    100% {
        opacity: 0.7;
        transform: scale(0.97);
    }
}

/* ============================================
   4️⃣ الأنيميشنات
   ============================================ */
@keyframes floatIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(58, 123, 213, 0.1);
    }

    50% {
        box-shadow: 0 0 40px rgba(58, 123, 213, 0.25);
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.8;
    }
}

.animate-float-in {
    animation: floatIn 0.5s ease-out;
}

.animate-fade-in {
    animation: fadeIn 0.4s ease-out;
}

.animate-glow-pulse {
    animation: glowPulse 2.5s ease-in-out infinite;
}

/* ============================================
   5️⃣ Glass Morphism
   ============================================ */
.glass {
    background: var(--bg-glass) !important;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
}

/* ============================================
   6️⃣ البطاقات
   ============================================ */
.card,
.content-card,
.main-card,
.header-card,
.filter-section,
.settings-card {
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-md) !important;
    transition: var(--transition) !important;
    color: var(--text-primary) !important;
    animation: floatIn 0.5s ease-out;
    position: relative;
    overflow: hidden;
}

    .card::before,
    .content-card::before,
    .main-card::before,
    .header-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 3px;
        background: var(--gradient-primary);
        opacity: 0;
        transition: opacity 0.4s ease;
    }

    .card:hover::before,
    .content-card:hover::before,
    .main-card:hover::before,
    .header-card:hover::before {
        opacity: 1;
    }

    .card:hover,
    .content-card:hover,
    .main-card:hover,
    .header-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-lg) !important;
        border-color: var(--border-active);
    }

/* ============================================
   7️⃣ الأزرار
   ============================================ */
.btn {
    transition: var(--transition);
    border: none;
    border-radius: var(--radius-md);
    padding: 10px 24px;
    font-weight: 600 !important;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    color: white;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

    .btn::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.2);
        transform: translate(-50%, -50%);
        transition: width 0.6s ease, height 0.6s ease;
    }

    .btn:active::after {
        width: 400px;
        height: 400px;
    }

    .btn:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
    }

    .btn:active {
        transform: translateY(0) scale(0.98);
    }

.btn-primary {
    background: var(--gradient-primary);
    color: white;
}

.btn-success {
    background: var(--gradient-success);
    color: white;
}

.btn-warning {
    background: var(--gradient-warning);
    color: #1e293b;
}

.btn-danger {
    background: var(--gradient-danger);
    color: white;
}

.btn-info {
    background: var(--gradient-info);
    color: white;
}

.btn-purple {
    background: var(--gradient-purple);
    color: white;
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

/* ============================================
   8️⃣ حقول الإدخال
   ============================================ */
.form-control,
.form-select,
input,
select,
textarea {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    padding: 10px 16px !important;
    font-family: inherit !important;
    font-weight: 400 !important;
    transition: var(--transition) !important;
}

    .form-control:focus,
    .form-select:focus,
    input:focus,
    select:focus,
    textarea:focus {
        outline: none;
        border-color: var(--primary) !important;
        box-shadow: 0 0 0 3px rgba(58, 123, 213, 0.15) !important;
    }

    .form-control::placeholder,
    textarea::placeholder {
        color: var(--text-muted) !important;
    }

/* ============================================
   9️⃣ الجداول
   ============================================ */
table {
    background: var(--bg-card) !important;
    border-radius: var(--radius-md);
    overflow: hidden;
    color: var(--text-primary) !important;
}

    table th {
        background: var(--gradient-primary) !important;
        color: white !important;
        font-weight: 700 !important;
        padding: 12px !important;
        border-bottom: 2px solid var(--border) !important;
    }

    table td {
        padding: 10px !important;
        border-bottom: 1px solid var(--border) !important;
        color: var(--text-primary) !important;
        font-weight: 400 !important;
    }

    table tbody tr {
        transition: var(--transition);
    }

        table tbody tr:hover {
            background: var(--bg-soft) !important;
        }

/* ============================================
   🔟 الشارات
   ============================================ */
.badge {
    padding: 4px 14px;
    border-radius: var(--radius-full);
    font-weight: 600 !important;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    letter-spacing: 0.3px;
}

.badge-primary {
    background: var(--gradient-primary);
    color: white;
}

.badge-success {
    background: var(--gradient-success);
    color: white;
}

.badge-warning {
    background: var(--gradient-warning);
    color: #1e293b;
}

.badge-danger {
    background: var(--gradient-danger);
    color: white;
}

.badge-info {
    background: var(--gradient-info);
    color: white;
}

.badge-purple {
    background: var(--gradient-purple);
    color: white;
}

/* ============================================
   1️⃣1️⃣ التنبيهات
   ============================================ */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    border-right: 3px solid;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: fadeIn 0.4s ease-out;
    background: var(--bg-soft) !important;
    color: var(--text-primary) !important;
    font-weight: 500 !important;
}

.alert-success {
    background: rgba(58, 184, 176, 0.12) !important;
    color: var(--success-dark) !important;
    border-right-color: var(--success);
}

[data-theme="dark"] .alert-success {
    color: var(--success) !important;
}

.alert-warning {
    background: rgba(240, 200, 74, 0.12) !important;
    color: var(--warning-dark) !important;
    border-right-color: var(--warning);
}

[data-theme="dark"] .alert-warning {
    color: var(--warning) !important;
}

.alert-danger {
    background: rgba(217, 106, 112, 0.12) !important;
    color: var(--danger-dark) !important;
    border-right-color: var(--danger);
}

[data-theme="dark"] .alert-danger {
    color: var(--danger) !important;
}

.alert-info {
    background: rgba(90, 173, 208, 0.12) !important;
    color: var(--info) !important;
    border-right-color: var(--info);
}

.alert-primary {
    background: rgba(58, 123, 213, 0.12) !important;
    color: var(--primary-dark) !important;
    border-right-color: var(--primary);
}

[data-theme="dark"] .alert-primary {
    color: var(--primary) !important;
}

/* ============================================
   1️⃣2️⃣ السباينر
   ============================================ */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(58, 123, 213, 0.15);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

[data-theme="dark"] .spinner {
    border-color: rgba(74, 144, 217, 0.15);
    border-top-color: var(--primary);
}

.spinner-sm {
    width: 22px;
    height: 22px;
    border-width: 2px;
}

.spinner-lg {
    width: 56px;
    height: 56px;
    border-width: 4px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   1️⃣3️⃣ المودال
   ============================================ */
.modal {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.modal-content {
    background: var(--bg-card) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-xl) !important;
    animation: floatIn 0.4s ease-out;
    color: var(--text-primary) !important;
    border: 1px solid var(--border) !important;
}

.modal-header {
    border-bottom: 1px solid var(--border) !important;
}

    .modal-header h3 {
        font-weight: 700 !important;
        color: var(--text-primary) !important;
    }

/* ============================================
   1️⃣4️⃣ شريط التمرير
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-soft);
    border-radius: 8px;
}

::-webkit-scrollbar-thumb {
    background: var(--gradient-primary);
    border-radius: 8px;
    border: 2px solid var(--bg-soft);
}

    ::-webkit-scrollbar-thumb:hover {
        background: var(--primary-dark);
    }

/* ============================================
   1️⃣5️⃣ أدوات مساعدة
   ============================================ */
.text-gradient-primary {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700 !important;
}

.shadow-glow {
    box-shadow: var(--shadow-glow);
}

/* ============================================
   1️⃣6️⃣ Toast
   ============================================ */
.live-toast {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow-lg) !important;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    animation: slideInRight 0.3s ease;
    border-right: 4px solid var(--primary);
    backdrop-filter: blur(10px);
}

/* ============================================
   1️⃣7️⃣ Timer Bar
   ============================================ */
.timer-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--gradient-warning);
    color: #1e293b;
    padding: 10px 20px;
    text-align: center;
    font-weight: bold;
    z-index: 1001;
    box-shadow: 0 4px 20px rgba(240, 200, 74, 0.3);
    animation: slideDown 0.5s ease;
    font-family: monospace;
    font-size: 18px;
}

    .timer-bar.warning {
        background: var(--gradient-danger);
        color: white;
        animation: pulse 1s infinite;
    }

    .timer-bar .timer-countdown {
        font-size: 24px;
        font-weight: bold;
        margin: 0 10px;
        background: rgba(0, 0, 0, 0.3);
        padding: 5px 15px;
        border-radius: 50px;
        display: inline-block;
        color: white;
    }

/* ============================================
   1️⃣8️⃣ إصلاح Bootstrap
   ============================================ */
.bg-light, .bg-white, .bg-body {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.border {
    border-color: var(--border) !important;
}

/* ============================================
   1️⃣9️⃣ الشاشات الصغيرة
   ============================================ */
@media (max-width: 768px) {
    :root {
        --radius-xl: 18px;
    }

    body::before {
        opacity: 0.6;
    }

    h1 {
        font-size: 1.8rem !important;
    }

    h2 {
        font-size: 1.6rem !important;
    }

    h3 {
        font-size: 1.3rem !important;
    }
}

/* ============================================
   2️⃣0️⃣ الطباعة
   ============================================ */
@media print {
    body::before {
        display: none;
    }

    .no-print {
        display: none !important;
    }
}
