/* تنسيق صفحة التقويم الدراسي - academic-calendar.css */

/* تنسيق قسم التقويم */
.calendar-section {
    padding: 3rem 0;
}

/* تفاصيل العام الدراسي */
.academic-year-details {
    margin-bottom: 2rem;
    font-size: 1.1rem;
    color: #555;
}

/* فلتر التقويم */
.calendar-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: #f5f5f5;
    border-radius: 6px;
}

.filter-group {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 250px;
}

.filter-group label {
    margin-left: 1rem;
    font-weight: 500;
    min-width: 120px;
}

.filter-group select {
    flex: 1;
    padding: 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: white;
    font-family: 'Tajawal', sans-serif;
    font-size: 1rem;
}

/* تبويبات التقويم */
.calendar-tabs {
    margin: 2rem 0;
}

.tab-headers {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    border-bottom: 2px solid var(--border-color);
}

.tab-headers li {
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.tab-headers li.active {
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 700;
}

.tab-headers li:hover:not(.active) {
    color: var(--primary-color);
    background-color: rgba(0, 94, 124, 0.05);
}

.tab-content {
    padding: 1.5rem 0;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.5s;
}

/* عرض محتوى العام الدراسي */
.academic-year-content {
    display: none;
}

.academic-year-content.active {
    display: block;
}

/* تنسيق جدول التقويم الدراسي */
.academic-calendar-table {
    width: 100%;
    margin-top: 20px;
    border-collapse: collapse;
    text-align: center;
}

.academic-calendar-table th, 
.academic-calendar-table td {
    padding: 12px;
    border: 1px solid #eaeaea;
}

.academic-calendar-table th {
    background-color: var(--primary-color);
    color: white;
    font-weight: 700;
}

.academic-calendar-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.academic-calendar-table tr:hover {
    background-color: #f0f7ff;
}

.academic-calendar-table .date-hijri {
    color: var(--primary-color);
    font-weight: 600;
}

.academic-calendar-table .date-gregorian {
    color: #666;
    font-size: 0.9em;
}

/* خط زمني للتواريخ المهمة */
.timeline {
    position: relative;
    padding: 2rem 0;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    right: 25px;
    width: 3px;
    background-color: var(--primary-color);
    z-index: 1;
}

.timeline-item {
    position: relative;
    padding: 2rem 70px 2rem 0;
    margin-bottom: 2.5rem;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-date {
    position: absolute;
    right: 0;
    top: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 2;
    width: 55px; /* تحديد عرض ثابت */
}

.date-circle {
    width: 50px;
    height: 50px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.7rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.date-text {
    font-size: 0.85rem;
    color: #666;
    text-align: center;
    width: 100%;
    line-height: 1.4;
    word-wrap: break-word;
}

.timeline-content {
    background-color: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border-right: 4px solid var(--secondary-color);
    min-height: 100px; /* ضمان ارتفاع كافي */
}

.timeline-content h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-size: 1.2rem;
    line-height: 1.5;
}

.timeline-content p {
    margin-bottom: 0;
    color: #666;
    line-height: 1.6;
    font-size: 1rem;
}

/* قائمة الإجازات الرسمية */
.holidays-card {
    margin-top: 3rem;
}

.holidays-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.holiday-item {
    display: flex;
    align-items: center;
    padding: 1.2rem;
    background-color: #f9f9f9;
    border-radius: 8px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.holiday-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.holiday-icon {
    background-color: var(--primary-color);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-left: 1rem;
}

.holiday-details h3 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.holiday-details p {
    margin: 0.3rem 0 0;
    color: #666;
}

/* تنزيل التقويم الدراسي */
.download-calendar {
    margin-top: 3rem;
    text-align: center;
    padding: 2rem;
    background-color: #f5f5f5;
    border-radius: 8px;
}

.download-calendar h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.download-calendar p {
    margin-bottom: 1.5rem;
    color: #555;
}

.download-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.download-buttons .btn {
    padding: 0.8rem 1.5rem;
    min-width: 200px;
}

.download-buttons .btn i {
    margin-left: 0.5rem;
}

/* قسم حساب الوقت المتبقي للمدرسة */
.school-countdown-section {
    margin: 2rem 0;
}

.countdown-card {
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    border-radius: 20px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    padding: 2.5rem;
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.countdown-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.countdown-card .card-title {
    color: #3a1c71;
    font-size: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.countdown-description {
    color: #666;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.countdown-timer {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin: 2rem 0;
}

.countdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 5px;
}

#countdown-days, 
#countdown-hours, 
#countdown-minutes {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #3a1c71, #d76d77);
    color: #fff;
    padding: 15px;
    border-radius: 10px;
    min-width: 70px;
    text-align: center;
    box-shadow: 0 10px 20px rgba(58, 28, 113, 0.2);
    position: relative;
    overflow: hidden;
}

#countdown-days::before, 
#countdown-hours::before, 
#countdown-minutes::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.countdown-label {
    font-size: 1rem;
    margin-top: 10px;
    color: #555;
    font-weight: 600;
}

.flip-clock {
    display: inline-block;
    position: relative;
    width: 90px;
    height: 90px;
    margin: 5px;
    perspective: 400px;
}

.flip-card {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.flip-card.flipped {
    transform: rotateX(180deg);
}

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(58, 28, 113, 0.2);
    overflow: hidden;
    min-width: 70px;
}

.flip-card-front {
    background: linear-gradient(135deg, #3a1c71, #d76d77);
}

.flip-card-front::after, .flip-card-back::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
    background-color: rgba(0, 0, 0, 0.1);
    z-index: 2;
}

.flip-card-front::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 50%;
    background: rgba(255, 255, 255, 0.1);
}

.flip-card-back {
    background: linear-gradient(135deg, #3a1c71, #d76d77);
    transform: rotateX(180deg);
}

.flip-card-back::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 50%;
    background: rgba(255, 255, 255, 0.1);
}

.flip-card.flipping {
    box-shadow: 0 0 30px rgba(58, 28, 113, 0.4);
}

.flip-clock-label {
    position: absolute;
    bottom: -25px;
    left: 0;
    width: 100%;
    font-size: 14px;
    color: #555;
    text-align: center;
    font-weight: 600;
}

.countdown-message {
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 1.5rem;
    text-align: center;
    color: #3a1c71;
    background: rgba(255, 255, 255, 0.8);
    padding: 10px 20px;
    border-radius: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

/* تحسينات للأجهزة المحمولة */
@media (max-width: 768px) {
    .countdown-timer {
        gap: 1rem;
    }
    
    #countdown-days, 
    #countdown-hours, 
    #countdown-minutes {
        font-size: 2rem;
        padding: 12px;
        min-width: 60px;
    }
    
    .countdown-card {
        padding: 1.5rem;
    }
    
    .flip-clock {
        width: 70px;
        height: 80px;
    }
}

@media (max-width: 480px) {
    .countdown-timer {
        gap: 0.5rem;
    }
    
    #countdown-days, 
    #countdown-hours, 
    #countdown-minutes {
        font-size: 1.8rem;
        padding: 10px;
        min-width: 50px;
    }
    
    .countdown-label {
        font-size: 0.8rem;
    }
    
    .countdown-message {
        font-size: 1.1rem;
    }
    
    .flip-clock {
        width: 60px;
        height: 70px;
    }
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* تحسين أداء INP */
:root {
    --base-font-size: 16px;
    font-size: var(--base-font-size);
}

/* تحسين أداء التفاعلات */
a, button, .card, .service-card, select, input, .mobile-toggle {
    /* تحسين أداء النقر والتفاعل */
    touch-action: manipulation;
}

/* تطبيق will-change على العناصر التفاعلية */
.countdown-card,
.card,
.service-card {
    will-change: transform;
    /* تسريع التحويلات باستخدام GPU */
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* تحسين أداء التمرير */
.tab-content,
.calendar-table-container {
    -webkit-overflow-scrolling: touch;
    /* تسريع التمرير باستخدام GPU */
    transform: translateZ(0);
}

/* تحسين أداء الحالة النشطة للأزرار */
button:active,
a:active,
.touch-active {
    /* تسريع التفاعلات باستخدام GPU */
    transform: translateZ(0);
}

/* تحسين أداء التحويلات */
.countdown-card:hover,
.card:hover,
.service-card:hover {
    /* تسريع التحويلات باستخدام GPU */
    transform: translateY(-5px) translateZ(0);
}

/* تحسين أداء الانتقالات */
.countdown-card,
.card,
.service-card,
button,
a,
select,
input {
    /* تحسين أداء الانتقالات */
    transition-property: transform, box-shadow, opacity;
    transition-duration: 0.3s;
    transition-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
}

/* تحسين أداء التحميل المتأخر للصور */
img {
    content-visibility: auto;
}

/* تحسين أداء العناصر الغير مرئية */
.hidden,
[hidden] {
    content-visibility: hidden;
    contain: strict;
}

/* تحسين أداء التفاعلات للأجهزة المحمولة */
@media (hover: hover) {
    /* تطبيق التأثيرات فقط على الأجهزة التي تدعم التحويم */
    .countdown-card:hover,
    .card:hover,
    .service-card:hover {
        transform: translateY(-5px) translateZ(0);
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
    }
}

@media (hover: none) {
    /* تعطيل تأثيرات التحويم على الأجهزة التي لا تدعم التحويم */
    .countdown-card:hover,
    .card:hover,
    .service-card:hover {
        transform: translateZ(0);
        box-shadow: 0 6px 15px rgba(0, 0, 0, 0.08);
    }
}

/* تنسيقات تأثير Flip Clock للثواني */
.flip-clock {
    display: inline-block;
    position: relative;
    width: 90px;
    height: 90px;
    margin: 5px;
    perspective: 400px;
}

.flip-card {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.flip-card.flipped {
    transform: rotateX(180deg);
}

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(58, 28, 113, 0.2);
    overflow: hidden;
    min-width: 70px;
}

.flip-card-front {
    background: linear-gradient(135deg, #3a1c71, #d76d77);
}

.flip-card-front::after, .flip-card-back::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
    background-color: rgba(0, 0, 0, 0.1);
    z-index: 2;
}

.flip-card-front::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 50%;
    background: rgba(255, 255, 255, 0.1);
}

.flip-card-back {
    background: linear-gradient(135deg, #3a1c71, #d76d77);
    transform: rotateX(180deg);
}

.flip-card-back::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 50%;
    background: rgba(255, 255, 255, 0.1);
}

.flip-card.flipping {
    box-shadow: 0 0 30px rgba(58, 28, 113, 0.4);
}

.flip-clock-label {
    position: absolute;
    bottom: -25px;
    left: 0;
    width: 100%;
    font-size: 14px;
    color: #555;
    text-align: center;
    font-weight: 600;
}

@media (max-width: 768px) {
    .flip-clock {
        width: 70px;
        height: 80px;
    }
    
    .flip-card-front, .flip-card-back {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .flip-clock {
        width: 60px;
        height: 70px;
    }
    
    .flip-card-front, .flip-card-back {
        font-size: 1.8rem;
    }
}

/* تنسيق عنوان الثواني */
.countdown-item:last-child .countdown-label {
    margin-top: 10px;
    display: block;
}

/* تنسيق عناصر العد التنازلي */
.countdown-timer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.countdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 5px;
}

#countdown-days, 
#countdown-hours, 
#countdown-minutes {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ff6b6b, #ee5253);
    color: #fff;
    padding: 10px 15px;
    border-radius: 8px;
    min-width: 60px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(238, 82, 83, 0.3);
}

.countdown-label {
    font-size: 1rem;
    margin-top: 5px;
    color: #555;
    font-weight: 600;
}

@media (max-width: 768px) {
    #countdown-days, 
    #countdown-hours, 
    #countdown-minutes {
        font-size: 2rem;
        padding: 8px 12px;
        min-width: 50px;
    }
    
    .countdown-label {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    #countdown-days, 
    #countdown-hours, 
    #countdown-minutes {
        font-size: 1.8rem;
        padding: 6px 10px;
        min-width: 40px;
    }
    
    .countdown-label {
        font-size: 0.8rem;
    }
}

/* التوافق مع الهواتف المحمولة */
@media (max-width: 768px) {
    .tab-headers {
        flex-direction: column;
        border-bottom: none;
    }
    
    .tab-headers li {
        border-bottom: 1px solid var(--border-color);
        margin-bottom: 0;
        text-align: center;
    }
    
    .tab-headers li.active {
        border-bottom: 1px solid var(--border-color);
        border-right: 4px solid var(--primary-color);
    }
    
    .timeline::before {
        right: 20px;
    }
    
    .timeline-item {
        padding: 2rem 60px 2rem 0;
    }
    
    .date-circle {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .holidays-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .timeline-item {
        padding: 1.5rem 55px 1.5rem 0;
    }
    
    .timeline-date {
        top: 1.5rem;
    }
    
    .date-circle {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    .timeline-item {
        padding: 2rem 60px 2rem 0;
    }
    
    .timeline::before {
        right: 20px;
    }
    
    .timeline-date {
        width: 45px;
    }
    
    .date-circle {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .date-text {
        font-size: 0.7rem;
    }
    
    .timeline-content h3 {
        font-size: 1.1rem;
    }
    
    .timeline-content p {
        font-size: 0.9rem;
    }
}

.countdown-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.countdown-type {
    width: 100%;
    max-width: 400px;
}

.countdown-type label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #495057;
}

.countdown-type select {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-size: 1rem;
    color: #495057;
    background-color: #fff;
    transition: border-color 0.2s ease;
}

.countdown-type select:focus {
    border-color: #3a1c71;
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(58, 28, 113, 0.25);
}

.countdown-display {
    width: 100%;
    max-width: 500px;
    background: linear-gradient(135deg, #3a1c71, #d76d77);
    border-radius: 15px;
    padding: 2rem;
    color: #fff;
    box-shadow: 0 10px 25px rgba(58, 28, 113, 0.3);
}
