/* =========================================
   1. إعدادات الهوية والخطوط (Variables & Fonts)
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Changa:wght@300;400;600;700;800&display=swap');

:root {
    /* --- الوضع الداكن (الافتراضي) --- */
    --primary-color: #8b5cf6;       /* بنفسجي */
    --primary-dark: #7c3aed;
    --secondary-color: #2dd4bf;     /* تركواز نيون */
    --accent-color: #f59e0b;        /* برتقالي للتحذيرات */
    --error-color: #ef4444;         /* أحمر للحذف والأخطاء */
    
    --main-bg: #0f172a;             /* خلفية الصفحة */
    --card-bg: #1e293b;             /* خلفية البطاقات */
    --glass-bg: rgba(30, 41, 59, 0.7); /* خلفية زجاجية */
    
    --text-main: #f8fafc;           /* النص الأساسي */
    --text-sec: #94a3b8;            /* النص الثانوي */
    --border-color: rgba(255, 255, 255, 0.1);
    
    --radius: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* --- الوضع النهاري (Light Mode) --- */
body.light-mode {
    --main-bg: #f8fafc;
    --card-bg: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.85);
    
    --text-main: #0f172a;
    --text-sec: #475569;
    --border-color: rgba(0, 0, 0, 0.1);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.05);

    /* تعديل طفيف للألوان لتناسب الخلفية البيضاء */
    --primary-color: #7c3aed; 
}

/* =========================================
   2. التنسيقات العامة (Global Reset)
   ========================================= */
* { box-sizing: border-box; outline: none; margin: 0; padding: 0; }

body {
    font-family: "Changa", sans-serif;
    background-color: var(--main-bg);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex; flex-direction: column;
    transition: background-color 0.5s ease, color 0.5s ease;
}

a { text-decoration: none; color: inherit; transition: var(--transition); }
ul { list-style: none; }

/* Scrollbar Customization */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--main-bg); }
::-webkit-scrollbar-thumb { background: var(--primary-color); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--secondary-color); }

/* =========================================
   3. الهيدر والقائمة (Header & Nav)
   ========================================= */
header {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 5%;
    position: sticky; top: 0; z-index: 1000;
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;
}

body.light-mode header { background: rgba(255, 255, 255, 0.85); }

header h1 {
    margin: 0; font-size: 1.5rem; font-weight: 800;
    color: var(--primary-color);
    display: flex; align-items: center; gap: 10px;
    text-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
}

nav { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }

nav a {
    padding: 8px 16px; font-weight: 600; border-radius: var(--radius);
    color: var(--text-sec); font-size: 0.95rem; cursor: pointer;
}

nav a:hover, nav a.active {
    background: rgba(139, 92, 246, 0.15);
    color: var(--primary-color);
}

.theme-btn {
    background: transparent; border: 1px solid var(--border-color);
    color: var(--text-main); width: 40px; height: 40px; border-radius: 50%;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: var(--transition); margin: 0 10px;
}
.theme-btn:hover { background: var(--primary-color); color: white; border-color: var(--primary-color); }

/* أزرار تسجيل الدخول في الهيدر */
.btn-auth {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white !important; padding: 8px 20px; border-radius: 12px;
    font-weight: bold; font-size: 0.9rem;
}
.btn-logout {
    color: var(--error-color) !important; font-size: 1.2rem; cursor: pointer; margin-right: 10px;
}

/* =========================================
   4. المكونات الأساسية (Components)
   ========================================= */
main { flex: 1; }
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }

/* Hero Section */
.hero {
    text-align: center; padding: 60px 20px;
    background: radial-gradient(circle at center, rgba(139, 92, 246, 0.15) 0%, transparent 70%);
}
.hero h2 {
    font-size: 2.5rem; margin-bottom: 15px; color: var(--text-main);
}
.hero p { color: var(--text-sec); font-size: 1.1rem; max-width: 600px; margin: 0 auto; }

/* Grid Layout */
.grid-container {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px; padding: 20px 0;
}

/* Cards Style */
.card {
    background: var(--card-bg); border-radius: var(--radius); overflow: hidden;
    border: 1px solid var(--border-color); transition: var(--transition);
    position: relative; box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-8px); border-color: var(--primary-color); box-shadow: 0 15px 30px rgba(139, 92, 246, 0.2); }

.card-image { width: 100%; height: 200px; object-fit: cover; }
.card-badge {
    position: absolute; top: 15px; left: 15px; /* تم توحيد الجهة لليسار */
    background: rgba(15, 23, 42, 0.8); backdrop-filter: blur(5px);
    color: var(--secondary-color); padding: 5px 12px; border-radius: 20px;
    font-size: 0.85rem; font-weight: bold; border: 1px solid rgba(45, 212, 191, 0.3);
}

.card-content { padding: 20px; display: flex; flex-direction: column; flex: 1; }
.card h3 { margin: 0 0 10px; font-size: 1.25rem; color: var(--text-main); }
.card-meta { display: flex; justify-content: space-between; margin-bottom: 15px; color: var(--text-sec); font-size: 0.9rem; }

/* Buttons */
.btn-primary, .btn-submit, .btn-book, .btn-save, .btn-analyze {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white; border: none; padding: 12px 20px; border-radius: 12px;
    font-weight: 700; cursor: pointer; text-align: center; width: 100%;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: var(--transition); font-family: inherit; font-size: 1rem;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}
.btn-primary:hover, .btn-book:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(139, 92, 246, 0.5); }
.btn-primary:disabled { background: #64748b; cursor: not-allowed; transform: none; box-shadow: none; }

/* Inputs & Forms */
input, select, textarea {
    width: 100%; padding: 14px 15px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color); border-radius: 12px;
    font-family: inherit; color: var(--text-main); transition: var(--transition);
}
body.light-mode input, body.light-mode select { background: #ffffff; border: 1px solid #cbd5e1; }
input:focus, textarea:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15); }

/* =========================================
   5. تخصيصات الصفحات (Page Specifics)
   ========================================= */

/* --- Login Page Animation --- */
.blobs { position: fixed; width: 100%; height: 100%; z-index: -1; overflow: hidden; top:0; left:0; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: 0.4; animation: float 10s infinite alternate; }
.blob-1 { top: 10%; left: 10%; width: 300px; height: 300px; background: var(--primary-color); }
.blob-2 { bottom: 10%; right: 10%; width: 250px; height: 250px; background: var(--secondary-color); animation-delay: -5s; }
@keyframes float { 0% { transform: translate(0, 0); } 100% { transform: translate(30px, 50px); } }

.auth-container {
    background: var(--glass-bg); backdrop-filter: blur(20px);
    border: 1px solid var(--border-color); padding: 40px; border-radius: 30px;
    box-shadow: var(--shadow); width: 90%; max-width: 450px;
    text-align: center; margin: 40px auto; position: relative;
}

/* --- AI Pages (Preferences) --- */
.ai-engine-container {
    max-width: 900px; margin: 0 auto 60px; padding: 40px;
    background: var(--glass-bg); border-radius: 30px;
    border: 1px solid rgba(139, 92, 246, 0.2);
}
.pref-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px; margin-bottom: 30px; }
.pref-card {
    background: var(--card-bg); padding: 20px; border-radius: 20px; text-align: center;
    cursor: pointer; border: 2px solid var(--border-color); transition: var(--transition);
}
.pref-card:hover, .pref-card.selected { border-color: var(--secondary-color); background: rgba(45, 212, 191, 0.1); }
.pref-card.selected i { color: var(--secondary-color); }
.pref-card i { font-size: 2rem; color: var(--text-sec); margin-bottom: 10px; display: block; }

/* --- Bookings Page --- */
.tabs-container {
    max-width: 900px; margin: -20px auto 30px; display: flex; gap: 10px;
    justify-content: center; flex-wrap: wrap;
}
.tab-btn {
    background: var(--card-bg); border: 1px solid var(--border-color); color: var(--text-sec);
    padding: 10px 20px; border-radius: 15px; cursor: pointer; font-weight: 700; transition: var(--transition);
    display: flex; align-items: center; gap: 8px;
}
.tab-btn.active { background: var(--primary-color); color: white; border-color: var(--primary-color); }
.tab-btn.trash-tab.active { background: var(--error-color); border-color: var(--error-color); }

.booking-card {
    background: var(--card-bg); border-radius: var(--radius); padding: 20px; margin-bottom: 20px;
    border: 1px solid var(--border-color); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
    border-right: 5px solid transparent; /* للون المميز */
}
/* ألوان حدود البطاقات حسب النوع */
.card-hotel { border-right-color: var(--accent-color); }
.card-program { border-right-color: #10b981; }
.card-souvenir { border-right-color: #ec4899; }
.card-deleted { border-right-color: var(--error-color); opacity: 0.7; filter: grayscale(0.8); }

/* --- Contact Page --- */
.contact-wrapper {
    display: grid; grid-template-columns: 1fr 1.5fr; gap: 40px;
    background: var(--card-bg); padding: 40px; border-radius: var(--radius);
    box-shadow: 0 20px 50px rgba(0,0,0,0.2); 
    border: 1px solid var(--border-color);
    position: relative; overflow: hidden;
}
.info-item { display: flex; gap: 20px; align-items: flex-start; margin-bottom: 30px; }
.info-icon {
    width: 50px; height: 50px; background: rgba(45, 212, 191, 0.1); 
    color: var(--secondary-color); border-radius: 50%; 
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; flex-shrink: 0; border: 1px solid rgba(45, 212, 191, 0.2);
}
@media (max-width: 768px) { .contact-wrapper { grid-template-columns: 1fr; } }

/* =========================================
   6. المودال والنوافذ المنبثقة (Modals)
   ========================================= */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(5px);
    z-index: 2000; display: none; align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-container {
    background: var(--card-bg); width: 90%; max-width: 900px;
    border-radius: 25px; overflow: hidden; display: flex;
    border: 1px solid var(--border-color); box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}
.modal-image { width: 40%; position: relative; background: #000; }
.modal-image img { width: 100%; height: 100%; object-fit: cover; }
.modal-content { width: 60%; padding: 30px; position: relative; overflow-y: auto; max-height: 90vh; }

.modal-close {
    width: 35px; height: 35px; background: rgba(0,0,0,0.5); color: white;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: 0.3s;
}
.modal-close:hover { background: var(--error-color); }

@media (max-width: 768px) {
    .modal-container { flex-direction: column; }
    .modal-image, .modal-content { width: 100%; }
    .modal-image { height: 150px; }
}

/* =========================================
   7. الشات والفوتر (Chat & Footer)
   ========================================= */
#chat-widget-btn {
    box-shadow: 0 0 20px rgba(45, 212, 191, 0.4);
    transition: transform 0.3s; animation: pulse 2s infinite;
}
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(45, 212, 191, 0.4); } 70% { box-shadow: 0 0 0 15px rgba(45, 212, 191, 0); } 100% { box-shadow: 0 0 0 0 rgba(45, 212, 191, 0); } }

#chat-box {
    background: var(--card-bg); border-radius: 20px; border: 1px solid var(--border-color);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5); display: flex; flex-direction: column;
}

footer {
    background: #0b1120; color: var(--text-sec); text-align: center;
    padding: 30px; margin-top: auto; border-top: 1px solid var(--border-color);
}

/* رسائل التنبيه */
.message {
    padding: 15px; border-radius: 12px; margin-top: 20px; text-align: center; display: none; font-weight: bold;
}
.message.success { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.message.error { background: rgba(239, 68, 68, 0.15); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.3); }