/* تنسيقات الفلاتر المبسطة */
.flight-filter-container {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    direction: rtl;
    position: relative;
    background: #f0f2f5; /* لون خلفية أفتح وأكثر حداثة */
    min-height: 100vh;
    padding: 20px;
}

/* الفلاتر المدمجة */
.filters-container.compact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08); /* ظل أعمق */
    margin-bottom: 25px;
    border: 1px solid #e9ecef;
    max-height: 200px;
    overflow-y: auto;
}

.filters-container.compact .filter-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}

.filters-container.compact label {
    font-size: 13px;
    margin-bottom: 5px;
    font-weight: 600;
    color: #2c3e50;
    white-space: nowrap;
}

.filters-container.compact input,
.filters-container.compact select {
    padding: 10px; /* زيادة التباعد الداخلي */
    border-radius: 8px; /* حواف أكثر دائرية */
    border: 1px solid #ddd;
    font-size: 13px;
    background-color: #ffffff;
    transition: all 0.2s ease;
    font-family: inherit;
    height: 40px; /* زيادة الارتفاع */
}

.filters-container.compact input:focus,
.filters-container.compact select:focus {
    border-color: #007bff; /* لون أزرق عصري */
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

.filters-container.compact .filter-group .flatpickr-wrapper {
    width: 100%;
}

.filters-container.compact .filter-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-start;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e9ecef;
}

.filters-container.compact button {
    padding: 10px 20px;
    background: #007bff; /* لون أساسي جديد */
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    font-family: inherit;
    margin-left: 10px;
}

.filters-container.compact button:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

#clear-all-filters-btn {
    background: #6c757d;
}

#clear-all-filters-btn:hover {
    background: #5a6268;
}

/* حقل عدد الليالي والسعر المدمج */
.night-inputs, .price-inputs {
    display: flex;
    align-items: center;
    gap: 5px;
}

.night-inputs input, .price-inputs input {
    width: calc(50% - 10px); 
    text-align: center;
}

.night-inputs span, .price-inputs span {
    font-size: 12px;
    color: #7f8c8d;
    white-space: nowrap;
}

/* زر إظهار/إخفاء الفلاتر */
#filter-toggle {
    position: fixed;
    top: 15px;
    right: 15px;
    padding: 12px 18px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    z-index: 10000;
    display: none;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
    font-family: inherit;
}

#filter-toggle:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

#filter-toggle i {
    margin-left: 5px;
}

/* =============================================== */
/* تنسيقات نظام البطاقات (Booking/Trivago Style) */
/* =============================================== */

/* إخفاء الجدول الأصلي ومكوناته */
.cards-wrapper table { 
    display: none !important;
}

/* تنسيقات حاوية البطاقات */
.cards-wrapper { 
    padding: 0 20px;
}

#flights-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    padding: 20px 0;
}

/* تنسيق البطاقة الواحدة */
.flight-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08); /* ظل ناعم */
    transition: all 0.3s ease;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid #dee2e6;
}

.flight-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

.card-header {
    background: #f8f9fa;
    color: #495057;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    border-bottom: 1px solid #e9ecef;
}

.flight-type-tag {
    background: #28a745; /* لون أخضر للنوع */
    color: white;
    padding: 4px 10px;
    border-radius: 20px; /* حافة دائرية */
    font-size: 12px;
    font-weight: 700;
}

.flight-code {
    color: #adb5bd;
    font-size: 12px;
}

.card-body {
    padding: 20px;
    display: grid;
    grid-template-columns: 2fr 1fr; /* تقسيم إلى معلومات وسعر */
    gap: 20px;
}

/* قسم المعلومات (اليسار) */
.card-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-left: 15px;
    border-left: 1px solid #e9ecef;
}

.card-info-item {
    display: flex;
    align-items: center;
    font-size: 13px;
    color: #343a40;
}

.card-info-item i {
    color: #007bff;
    margin-left: 10px;
    font-size: 16px;
    min-width: 20px;
}

.card-info-item .label {
    font-weight: 500;
    color: #6c757d;
    margin-left: 5px;
}

.card-info-item .value {
    font-weight: 600;
}

.airline-value {
    font-weight: 700;
    color: #2c3e50;
}

/* قسم السعر والإجراء (اليمين) */
.card-price-action {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

.main-price-display {
    text-align: center;
    margin-bottom: 15px;
}

.price-label {
    font-size: 12px;
    color: #7f8c8d;
    font-weight: 500;
    display: block;
    margin-bottom: 5px;
}

.price-value {
    font-size: 24px; /* حجم كبير للسعر */
    font-weight: 800;
    color: #dc3545; /* لون أحمر بارز */
    line-height: 1;
}

.main-price-display .price-badge {
    background: #ffc107;
    color: #343a40;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 700;
    margin-top: 5px;
    display: inline-block;
}

.action-btn {
    padding: 10px 15px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
    width: 100%;
    text-align: center;
}

.action-btn:hover {
    background: #0056b3;
}

/* تفاصيل الأسعار الإضافية */
.card-additional-prices {
    padding: 0 20px 15px;
    border-top: 1px solid #e9ecef;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-start;
}

.price-small-badge {
    background: #f8f9fa;
    color: #495057;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid #e9ecef;
}

/* تحسينات للجوال */
@media (max-width: 768px) {
    .flight-filter-container {
        padding: 0;
    }
    
    .filters-container.compact {
        grid-template-columns: 1fr;
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        height: 100vh;
        max-height: 100vh;
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
        overflow-y: auto;
        z-index: 9999;
        transition: right 0.3s ease-in-out;
        padding: 20px;
        margin: 0;
        border-radius: 0;
        border: none;
    }

    .filters-container.compact.open {
        right: 0;
    }

    #filter-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 15px;
        right: 15px;
        z-index: 10000;
    }

    .cards-wrapper { 
        margin-top: 60px;
        padding: 10px;
    }
    
    #flights-cards-container {
        grid-template-columns: 1fr;
        padding: 0;
        gap: 20px;
    }
    
    .price-inputs input {
        width: calc(50% - 15px); 
    }

    .flight-card {
        border-radius: 0; /* لإلغاء الحواف في الجوال */
    }
    
    .card-body {
        grid-template-columns: 1fr;
        padding: 15px;
        gap: 15px;
    }

    .card-info {
        border-left: none;
        padding-left: 0;
        border-bottom: 1px dashed #e9ecef;
        padding-bottom: 15px;
    }

    .card-price-action {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .action-btn {
        width: auto;
        padding: 8px 12px;
        font-size: 13px;
    }

    .main-price-display {
        text-align: right;
        margin-bottom: 0;
    }

    .price-value {
        font-size: 20px;
    }

    .card-additional-prices {
        justify-content: center;
        padding: 15px;
    }
}

/* شريط الفلاتر الثابت (في الحاسوب) */
@media (min-width: 769px) {
    .filters-sticky {
        position: fixed;
        top: 0;
        right: 0;
        left: 0;
        width: 100%;
        background-color: white;
        z-index: 1000;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        padding: 10px 0;
        animation: slideDown 0.3s ease-in-out;
        margin-top: 0;
        border-bottom: 1px solid #e9ecef;
    }

    .filters-sticky .filters-container.compact {
        margin-bottom: 0;
        box-shadow: none;
        padding: 15px;
        max-width: 1400px;
        margin: 0 auto;
        border-radius: 0;
        border: none;
        max-height: 150px;
    }

    .cards-wrapper { 
        margin-top: 20px;
        padding: 20px;
    }
    
    .filters-sticky + #flight-filter-container .cards-wrapper { 
        margin-top: 80px !important;
    }

    @keyframes slideDown {
        from {
            transform: translateY(-100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }

    .filters-container.compact {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)) auto;
        align-items: end;
    }
    
    .filters-container.compact .filter-actions {
        grid-column: auto;
        margin-top: 0;
        padding-top: 0;
        border-top: none;
        align-self: center;
    }
}

/* تنسيقات الـ Modal (تم الحفاظ عليها) */

.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    transition: opacity 0.3s ease-in-out;
}

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 25px;
    border: none;
    width: 95%;
    max-width: 600px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    font-family: inherit;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    border-bottom: 2px solid #007bff;
    padding-bottom: 10px;
    font-size: 20px;
    font-weight: 700;
    text-align: center;
}

.modal-body p {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #f1f2f6;
    display: flex;
    justify-content: space-between;
}

.modal-body p::before {
    content: attr(id);
    font-weight: 600;
    color: #007bff;
    text-transform: capitalize;
    min-width: 120px;
}

.close-modal {
    color: #95a5a6;
    position: absolute;
    top: 15px;
    left: 15px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-modal:hover,
.close-modal:focus {
    color: #dc3545;
    background-color: #f8f9fa;
}

/* تنسيقات أزرار الواتساب في الـ Modal */
.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 25px;
    flex-wrap: wrap;
}

.modal-actions .share-btn,
.modal-actions .inquiry-btn {
    flex: 1;
    min-width: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

.modal-actions .share-btn::before,
.modal-actions .inquiry-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.modal-actions .share-btn:hover::before,
.modal-actions .inquiry-btn:hover::before {
    left: 100%;
}

/* زر المشاركة - لون أخضر مريح */
.whatsapp-share-btn {
    background: linear-gradient(135deg, #28a745 0%, #218838 100%);
    color: white;
    border: 2px solid #218838;
}

.whatsapp-share-btn:hover {
    background: linear-gradient(135deg, #218838 0%, #28a745 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.3);
}

/* زر الاستفسار - لون أزرق مريح */
.whatsapp-inquiry-btn {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border: 2px solid #0056b3;
}

.whatsapp-inquiry-btn:hover {
    background: linear-gradient(135deg, #0056b3 0%, #007bff 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.3);
}

/* أيقونات الأزرار */
.modal-actions .share-btn i,
.modal-actions .inquiry-btn i {
    margin-left: 8px;
    font-size: 18px;
    transition: transform 0.3s ease;
}

.modal-actions .share-btn:hover i,
.modal-actions .inquiry-btn:hover i {
    transform: scale(1.2);
}

/* تنسيقات شبكة الأسعار في الـ Modal */
.prices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin: 15px 0;
    padding: 15px;
    background: linear-gradient(135deg, #e9ecef, #dee2e6);
    border-radius: 10px;
    border: 1px solid #ced4da;
}

.price-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
}

.price-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.price-icon {
    font-size: 20px;
    margin-bottom: 5px;
}

.price-label {
    font-size: 12px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 3px;
}

.price-value {
    font-size: 13px;
    font-weight: 700;
    color: #dc3545; /* لون سعر متناسق */
    background: rgba(220, 53, 69, 0.1);
    padding: 3px 8px;
    border-radius: 15px;
    border: 1px solid rgba(220, 53, 69, 0.2);
}

/* مؤشر التحميل */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #007bff; 
    animation: spin 1s ease-in-out infinite;
    margin-left: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* زر تحديث البيانات */
#refresh-data-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    padding: 8px 12px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    z-index: 1000;
    font-size: 11px;
    display: none;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
    transition: all 0.3s ease;
}

#refresh-data-btn.show {
    display: flex;
    align-items: center;
    gap: 5px;
}

#refresh-data-btn:hover {
    background: #218838;
    transform: translateY(-1px);
}