@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&display=swap');
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: #1c1815; /* خلفية داكنة دافئة */
    direction: rtl;
    color: #f4ede2;            /* نص كريمي مريح للعين */
}

/* Header & Footer */
/* ==========================================
   تنسيق الهيدر المتوازن (الشعار يمين - القائمة وسط - الأزرار يسار)
   ========================================== */
.official-header {
    width: 100%;
    background-color: #171311;
    border-bottom: 1px solid #433830;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1400px;
    width: 95%;
    margin: 0 auto;
    padding: 12px 1rem;
    display: grid;
    grid-template-columns: 1fr auto 1fr; /* العمود الأيمن للشعار، الوسط للقائمة، الأيسر للأزرار */
    align-items: center;
}

/* 1. الشعار في أقصى اليمين */
.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-self: start; /* يثبت في اليمين (لأن الصفحة RTL) */
}

.site-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.logo-text {
    font-family: 'Cairo', sans-serif;
    color: #f4ede2;
    font-size: 1.2rem;
    font-weight: 700;
}

/* 2. القائمة في المنتصف تماماً وبشكل دائم */
.navigation {
    justify-self: center; 
}

.navigation ul {
    list-style: none;
    display: flex;
    gap: 2rem;
    margin: 0;
    padding: 0;
}

.navigation a {
    text-decoration: none;
    color: #b8afa4;
    font-family: 'Cairo', sans-serif;
    font-size: 19px;
    font-weight: 700;
    position: relative;
    padding: 4px 0;
    transition: color 0.25s ease;
}

.navigation a:hover,
.navigation a.active {
    color: #d4a373; /* لون عسلي دافئ */
}

/* 3. الأزرار (مثل زر وضع الليل) في أقصى اليسار */
.header-actions {
    justify-self: end; /* يثبت في اليسار */
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-toggle-btn {
    background: #28221d;
    border: 1px solid #433830;
    color: #f4ede2;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
    background-color: #332b25;
    border-color: #d4a373;
}

/* Main Layout */
.schedule-container {
    max-width: 1400px;
    width: 95%;
    margin: 2.5rem auto;
}

.schedule-header { text-align: center; margin-bottom: 2rem; }
.page-title { font-family: 'Cairo', sans-serif; font-size: 34px; color: #f4ede2; margin-bottom: 8px; }
.page-subtitle { font-family: 'Cairo', sans-serif; font-size: 18px; color: #b8afa4; }

.builder-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
}

@media (max-width: 992px) {
    .builder-layout { grid-template-columns: 1fr; }
}

.form-section {
    background-color: #28221d;
    border: 1px solid #433830;
    border-radius: 12px;
    padding: 20px;
    height: fit-content;
}

.form-section h3 { font-family: 'Cairo', sans-serif; color: #f4ede2; margin-bottom: 15px; font-size: 22px; }

.input-group {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label { font-family: 'Cairo', sans-serif; font-size: 16px; color: #f4ede2; }

.styled-select {
    width: 100%;
    padding: 10px;
    background-color: #1c1815;
    border: 1px solid #433830;
    border-radius: 6px;
    color: #f4ede2;
    font-family: 'Cairo', sans-serif;
    font-size: 15px;
    outline: none;
}

.styled-select:focus {
    border-color: #d4a373;
}

.input-group input[type="color"] {
    width: 100%;
    height: 40px;
    background: transparent;
    border: 1px solid #433830;
    border-radius: 6px;
    cursor: pointer;
}

.btn-add {
    width: 100%;
    padding: 10px;
    background-color: #d4a373;
    border: none;
    border-radius: 6px;
    color: #1c1815;
    font-family: 'Cairo', sans-serif;
    font-weight: bold;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.25s ease;
}

.btn-add:hover {
    background-color: #e9c46a;
}

.added-courses-list { margin-top: 20px; border-top: 1px solid #433830; padding-top: 15px; }
.added-courses-list h4 { font-family: 'Cairo', sans-serif; color: #f4ede2; margin-bottom: 10px; }
.added-courses-list ul { list-style: none; }
.added-courses-list li {
    background-color: #1c1815;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #433830;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Cairo', sans-serif;
    font-size: 15px;
    color: #f4ede2;
}

/* Schedule Table Grid */
.grid-section {
    background-color: #28221d;
    border: 1px solid #433830;
    border-radius: 12px;
    padding: 20px;
    overflow-x: auto;
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
}

.schedule-table th, .schedule-table td {
    border: 1px solid #433830;
    padding: 10px;
    min-width: 110px;
}

.schedule-table th {
    background-color: #171311;
    font-family: 'Cairo', sans-serif;
    font-size: 18px;
    color: #d4a373;
}

.schedule-table td { font-family: 'Cairo', sans-serif; font-size: 14px; height: 55px; vertical-align: middle; color: #f4ede2; }

.course-block {
    padding: 6px;
    border-radius: 6px;
    color: #fff;
    font-weight: bold;
    font-size: 13px;
    line-height: 1.3;
}

.official-footer {
    text-align: center;
    padding: 1.5rem;
    background-color: #171311;
    border-top: 1px solid #433830;
    margin-top: 3rem;
    font-family: 'Cairo', sans-serif;
    color: #b8afa4;
}

/* تنسيق قسم زر موقع الجامعة الرسمي */
.official-schedule-link {
    margin: 15px 0;
    padding: 15px;
    background-color: rgba(212, 163, 115, 0.05);
    border: 1px dashed #d4a373;
    border-radius: 8px;
    text-align: center;
}

.official-schedule-link p {
    font-size: 0.85rem;
    color: #b8afa4;
    margin-bottom: 12px;
    line-height: 1.4;
}

.btn-university {
    display: inline-block;
    width: 100%;
    padding: 10px;
    background-color: #d4a373;
    color: #1c1815;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.95rem;
    transition: background-color 0.3s ease;
}

.btn-university:hover {
    background-color: #e9c46a;
    color: #1c1815;
}

.section-divider {
    border: 0;
    border-top: 1px solid #433830;
    margin: 20px 0;
}

/* تنسيقات الإدخال اليدوي */
.styled-input {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #433830;
    background-color: #1c1815;
    color: #f4ede2;
    font-size: 0.9rem;
    font-family: inherit;
}

.styled-input:focus {
    outline: none;
    border-color: #d4a373;
}

.days-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 5px;
}

.days-checkboxes label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    color: #f4ede2;
    cursor: pointer;
    background-color: #1c1815;
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid #433830;
    transition: 0.2s;
}

.days-checkboxes label:hover {
    background-color: #332b25;
}

.time-group {
    display: flex;
    gap: 15px;
}
.time-group .input-group {
    flex: 1;
}

/* تعديل محاذاة أوقات الجدول والمادة لتتطابق مع الخطوط */
.schedule-table td {
    padding: 0 !important;
    vertical-align: top;
    height: 40px;
}

.schedule-table td:first-child {
    padding-top: 5px !important; 
    font-size: 0.85rem;
    color: #b8afa4;
}

.course-card {
    width: 100%;
    height: 100%;
    min-height: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-sizing: border-box;
    margin: 0;
    border-radius: 4px;
    padding: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}