/* تنسيقات جدول الحصص المطور */
.timetable-section {
    padding: 140px 0 60px;
    background: #fdfdfd;
}

.timetable-section .container {
    max-width: 1600px;
    /* زيادة عرض الحاوية للجدول */
    width: 95%;
}

.timetable-header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease;
}

.timetable-header h2 {
    color: var(--primary-color);
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.header-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.week-selector {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.week-btn {
    background: white;
    border: 1px solid #ddd;
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-color);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.week-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(0, 100, 0, 0.02);
}

.week-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 15px rgba(0, 100, 0, 0.2);
}

.date-range-badge {
    background: #fff;
    border: 1px solid #f0f0f0;
    padding: 0.8rem 2rem;
    border-radius: 12px;
    display: inline-block;
    margin-bottom: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.1rem;
    box-shadow: var(--soft-shadow);
}

.date-range-badge i {
    color: var(--secondary-color);
    margin-left: 8px;
}

.day-date-small {
    display: block;
    font-size: 0.75rem;
    font-weight: 400;
    color: #666;
    margin-top: 4px;
}

.print-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.print-btn:hover {
    background: var(--secondary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

@media print {
    @page {
        size: landscape;
        margin: 5mm;
    }

    body {
        background: white !important;
        min-height: auto !important;
    }

    .navbar,
    footer,
    .whatsapp-float,
    .back-to-top,
    .print-btn,
    .mobile-menu {
        display: none !important;
    }

    .timetable-section {
        padding: 0 !important;
        margin: 0 !important;
    }

    .timetable-header {
        margin-bottom: 1rem !important;
    }

    .timetable-header h2 {
        font-size: 1.5rem !important;
    }

    .timetable-wrapper {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        overflow: visible !important;
    }

    .modern-timetable {
        min-width: 100% !important;
        border-spacing: 2px !important;
        zoom: 0.8;
        /* تصغير الجدول ليتناسب مع الصفحة الواحدة */
    }

    .lesson-cell {
        min-height: 80px !important;
        padding: 5px !important;
        border: 1px solid #ccc !important;
        page-break-inside: avoid;
    }

    .subject-name {
        font-size: 0.9rem !important;
    }

    .teacher-name {
        font-size: 0.7rem !important;
    }
}

.class-badge {
    background: var(--secondary-color);
    color: var(--primary-color);
    padding: 0.5rem 2rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1.2rem;
    display: inline-block;
    box-shadow: 0 4px 10px rgba(255, 183, 77, 0.3);
}

.timetable-wrapper {
    overflow-x: auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    padding: 2rem;
    /* زيادة البادينج الداخلي */
    position: relative;
    border: 1px solid #eee;
}

.modern-timetable {
    width: 100%;
    border-collapse: separate;
    border-spacing: 8px;
    /* تقليل المسافات قليلاً لتوفير مساحة عرضية */
    min-width: 1100px;
    /* عرض أدنى مناسب لـ 8 حصص بالإضافة للاستراحة */
}

/* أعمدة الحصص */
.modern-timetable th {
    background: var(--primary-color);
    color: white;
    padding: 1rem 0.5rem;
    border-radius: 12px;
    font-weight: 600;
    text-align: center;
    min-width: 110px;
}

.session-time {
    display: block;
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.85;
    margin-top: 4px;
    color: var(--secondary-color);
}

.modern-timetable th.corner-cell {
    background: var(--secondary-color);
    color: var(--primary-color);
}

/* صفوف الأيام */
.modern-timetable tr td:first-child {
    background: #f1f8f1;
    color: var(--primary-color);
    font-weight: 700;
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
    border-right: 4px solid var(--primary-color);
}

/* خلايا الحصص المعدلة */
.lesson-cell {
    background: white;
    border: 1px solid #f0f0f0;
    border-radius: 15px;
    padding: 1.2rem 0.8rem;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    min-height: 130px;
    /* زيادة الطول لاستيعاب النصوص */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}

.lesson-cell:hover {
    transform: translateY(-8px) scale(1.03);
    box-shadow: 0 12px 25px rgba(255, 183, 77, 0.15);
    /* ظل برتقالي خفيف */
    border-color: var(--secondary-color);
    background-color: rgba(255, 183, 77, 0.05);
    /* هوفر برتقالي خفيف جداً */
    z-index: 10;
}

.break-cell {
    background: rgba(255, 183, 77, 0.08) !important;
    color: var(--secondary-color) !important;
    font-weight: 700;
    text-align: center;
    vertical-align: middle;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    padding: 10px !important;
    font-size: 1.1rem;
    letter-spacing: 4px;
    border: 1px dashed var(--secondary-color) !important;
    min-width: 45px !important;
}

@media (max-width: 992px) {
    .break-cell {
        writing-mode: horizontal-tb;
        transform: none;
        letter-spacing: 2px;
        min-width: 80px !important;
        padding: 15px 5px !important;
    }
}

.subject-name {
    display: block;
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.15rem;
    /* تكبير بسيط للخط */
    line-height: 1.3;
    margin-bottom: 2px;
}

.teacher-name {
    display: block;
    font-size: 0.85rem;
    color: #888;
    font-weight: 400;
    font-style: italic;
}

.teacher-name::before {
    content: "\f51c";
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900;
    margin-left: 5px;
    color: var(--secondary-color);
}

/* أرقام الحصص */
.lesson-num {
    display: block;
    font-size: 0.75rem;
    color: var(--secondary-color);
    text-transform: uppercase;
    margin-bottom: 2px;
}

/* تلوين الأيام بألوان النظام المتناسقة */
.day-sun td:first-child {
    background: rgba(0, 100, 0, 0.08) !important;
    color: var(--primary-color);
}

.day-mon td:first-child {
    background: rgba(255, 183, 77, 0.12) !important;
    color: #d35400;
}

.day-tue td:first-child {
    background: rgba(0, 100, 0, 0.04) !important;
    color: var(--primary-color);
}

.day-wed td:first-child {
    background: rgba(255, 183, 77, 0.08) !important;
    color: #d35400;
}

.day-thu td:first-child {
    background: rgba(0, 100, 0, 0.12) !important;
    color: var(--primary-color);
}

.day-fri td:first-child {
    background: rgba(255, 183, 77, 0.15) !important;
    color: #d35400;
}

/* الانيميشن */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modern-timetable tr {
    opacity: 0;
    animation: fadeInUp 0.5s forwards;
}

.modern-timetable tr:nth-child(1) {
    animation-delay: 0.1s;
}

.modern-timetable tr:nth-child(2) {
    animation-delay: 0.2s;
}

.modern-timetable tr:nth-child(3) {
    animation-delay: 0.3s;
}

.modern-timetable tr:nth-child(4) {
    animation-delay: 0.4s;
}

.modern-timetable tr:nth-child(5) {
    animation-delay: 0.5s;
}

.modern-timetable tr:nth-child(6) {
    animation-delay: 0.6s;
}

/* تحسينات الشاشات الصغيرة - الموبايل */
@media (max-width: 992px) {
    .timetable-wrapper {
        padding: 1rem;
        margin: 0 -10px;
        /* لزيادة المساحة قليلاً */
        border-radius: 0;
    }

    .modern-timetable {
        min-width: 1000px;
        /* ضمان إمكانية التمرير بوضوح */
    }

    .timetable-header h2 {
        font-size: 1.8rem;
    }

    .class-badge {
        font-size: 1rem;
        padding: 0.4rem 1.2rem;
    }
}

@media (max-width: 768px) {
    .timetable-section {
        padding: 100px 0 40px;
        /* تقليل البادينج العلوي */
    }

    .header-actions {
        flex-direction: column;
        gap: 0.8rem;
    }

    .lesson-cell {
        padding: 0.8rem 0.4rem;
        min-height: 110px;
    }

    .subject-name {
        font-size: 1rem;
    }

    .teacher-name {
        font-size: 0.75rem;
    }
}