/**
 * أنماط CSS المحسنة لنظام تتبع رحلات طيران اليمنية
 */

:root {
    --primary-color: #1a3a6c;
    --secondary-color: #26a69a;
    --accent-color: #ffc107;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --transition-speed: 0.25s;
    --border-radius: 8px;
    --font-main: 'Tajawal', sans-serif;
}

/* ===== تنسيقات عامة ===== */
body {
    background-color: #f9f9f9;
    font-family: var(--font-main);
    line-height: 1.6;
    padding-top: 60px; /* للهيدر الثابت */
    color: var(--gray-800);
}

.page-content {
    min-height: calc(100vh - 400px); /* ارتفاع الصفحة مع مراعاة الهيدر والفوتر */
}

/* ===== هيدر الصفحة ===== */
.page-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 15px 0;
    text-align: center;
    margin-bottom: 20px;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

.header-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.plane-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.plane-icon {
    color: #1a3a6c;
    transform: rotate(180deg); /* اتجاه الطائرة من اليمين إلى اليسار */
}


.current-date {
    font-size: 0.9rem;
    opacity: 0.9;
}

.last-update-container {
    font-size: 0.85rem;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 8px;
}

.refresh-btn {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.refresh-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: rotate(180deg);
}

.refresh-btn.loading {
    animation: spinner 1s linear infinite;
}

@keyframes spinner {
    to {
        transform: rotate(360deg);
    }
}

/* ===== البحث والفلترة ===== */
.search-filter-section {
    margin-bottom: 20px;
}

.search-box {
    padding: 12px 16px;
    border-radius: var(--border-radius);
    background-color: white;
    box-shadow: var(--card-shadow);
}

.search-container {
    position: relative;
}

.search-input {
    height: 46px;
    padding-right: 40px;
    border-radius: 6px;
    border: 1px solid var(--gray-300);
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(26, 58, 108, 0.15);
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-500);
}

/* فلتر المدن */
.city-filter {
    margin-top: 15px;
}

.filter-label {
    display: block;
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: var(--gray-700);
}

.filter-container {
    position: relative;
    overflow: hidden;
}

.filter-scroll {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    padding-bottom: 5px;
    gap: 8px;
}

.filter-scroll::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Edge */
}

.filter-btn {
    white-space: nowrap;
    border: none;
    background-color: var(--gray-200);
    color: var(--gray-700);
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    font-weight: 500;
}

.filter-btn.active {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 2px 5px rgba(26, 58, 108, 0.2);
}

.filter-btn:hover:not(.active) {
    background-color: var(--gray-300);
}

.filter-fade {
    position: absolute;
    top: 0;
    height: 100%;
    width: 30px;
    pointer-events: none;
    z-index: 1;
}

.filter-fade.right {
    right: 0;
    background: linear-gradient(to left, #fff 40%, rgba(255, 255, 255, 0));
}

.filter-fade.left {
    left: 0;
    background: linear-gradient(to right, #fff 40%, rgba(255, 255, 255, 0));
}

/* ===== عنوان اليوم ===== */
.day-header {
    background-color: var(--gray-100);
    border-radius: var(--border-radius);
    padding: 12px 15px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--card-shadow);
}

.day-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-color);
}

.day-date {
    font-size: 0.85rem;
    color: var(--gray-600);
    font-weight: normal;
}

.day-stats {
    display: flex;
    align-items: center;
    gap: 10px;
}

.day-stat {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.day-stat i {
    font-size: 0.8rem;
}

.stat-ontime {
    color: var(--success-color);
}

.stat-delayed {
    color: var(--warning-color);
}

/* ===== الإحصائيات ===== */
.flight-stats-section {
    margin-bottom: 20px;
}

.stat-card {
    background-color: white;
    padding: 12px;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--gray-600);
    margin-top: 5px;
}

.stat-icon {
    font-size: 1.2rem;
    margin-bottom: 5px;
    width: 36px;
    height: 36px;
    background-color: var(--gray-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-total .stat-icon {
    color: var(--primary-color);
}

.stat-ontime .stat-icon {
    color: var(--success-color);
}

.stat-delayed .stat-icon {
    color: var(--warning-color);
}

/* ===== التبويبات ===== */
.flights-tabs {
    border-bottom: 0;
    margin-bottom: 20px;
}

.flights-tabs .nav-link {
    color: var(--gray-700);
    font-weight: 500;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    padding: 10px 20px;
    border: 1px solid var(--gray-300);
    border-bottom: 0;
    background-color: var(--gray-100);
    transition: all 0.3s ease;
    margin-right: 5px;
    font-size: 0.95rem;
}

.flights-tabs .nav-link.active {
    color: white;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.flights-tabs .nav-link:hover:not(.active) {
    background-color: var(--gray-200);
}

.flights-content {
    background-color: white;
    border-radius: 0 var(--border-radius) var(--border-radius) var(--border-radius);
    box-shadow: var(--card-shadow);
    padding: 20px 15px;
}

/* ===== بطاقات الرحلات ===== */
.flight-card {
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    margin-bottom: 15px;
    background-color: white;
    border: 1px solid var(--gray-200);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.flight-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.1);
}

/* راس البطاقة مع معلومات الرحلة الرئيسية */
.flight-header {
    padding: 12px;
    border-bottom: 1px solid var(--gray-200);
    background-color: var(--gray-100);
}

.route-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.flight-number {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.9rem;
    padding: 4px 8px;
    background-color: rgba(26, 58, 108, 0.08);
    border-radius: 4px;
}

.flight-status {
    font-size: 0.8rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 20px;
}

.status-on-time {
    background-color: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
}

.status-delayed {
    background-color: rgba(255, 193, 7, 0.1);
    color: var(--warning-color);
}

.status-cancelled {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

.route-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--gray-800);
    text-align: center;
}

/* معلومات الإقلاع والهبوط */
.flight-content {
    padding: 12px;
}

.flight-details {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.trip-point {
    text-align: center;
    flex: 1;
}

.time {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.2;
}

.date {
    font-size: 0.75rem;
    color: var(--gray-600);
    margin-top: 2px;
}

.city {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--gray-700);
    margin-top: 3px;
}

.trip-divider {
    position: relative;
    width: 70px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.trip-line {
    height: 2px;
    background-color: var(--gray-300);
    width: 100%;
    position: relative;
}

.trip-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    color: var(--primary-color);
    padding: 5px;
    font-size: 1rem;
}

.trip-duration {
    font-size: 0.75rem;
    color: var(--gray-600);
    margin-top: 5px;
    text-align: center;
}

/* ===== حالة التحميل ===== */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.spinner-container {
    text-align: center;
    padding: 20px;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* ===== رسائل الخطأ والتحذير ===== */
.alert {
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
}

/* ===== زر العودة للأعلى ===== */
.back-to-top-btn {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 40px;
    height: 40px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 99;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.back-to-top-btn.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top-btn:hover {
    background-color: var(--secondary-color);
    transform: translateY(-5px);
}

/* ===== حالة عدم وجود بيانات ===== */
.no-flights {
    text-align: center;
    padding: 30px 0;
}

.no-flights-icon {
    font-size: 2.5rem;
    color: var(--gray-400);
    margin-bottom: 15px;
}

.no-flights-message {
    color: var(--gray-600);
    font-size: 1rem;
}

/* ===== معلومات إضافية ===== */
.additional-info {
    margin-top: 25px;
    margin-bottom: 25px;
}

.info-card {
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    background-color: white;
}

.info-header {
    padding: 15px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
}

.info-body {
    padding: 15px;
}

.info-list {
    margin: 0;
    padding-right: 20px;
}

.info-list li {
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--gray-700);
}

.info-list li:last-child {
    margin-bottom: 0;
}

/* ===== التكيف مع الأجهزة المحمولة ===== */
@media (max-width: 767px) {
    .flights-tabs .nav-link {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    .flights-content {
        padding: 15px 10px;
    }
    
    .time {
        font-size: 1.1rem;
    }
    
    .flight-card {
        margin-bottom: 12px;
    }
    
    .stat-value {
        font-size: 1.3rem;
    }
    
    .day-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .day-stats {
        margin-top: 10px;
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 575px) {
    .flight-details {
        flex-direction: column;
        gap: 15px;
    }
    
    .trip-divider {
        width: 100%;
        flex-direction: row;
        margin: 5px 0;
    }
    
    .trip-line {
        width: 100%;
    }
    
    .trip-duration {
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
        margin-top: 2px;
        white-space: nowrap;
    }
}