/**
 * ========================================
 * تنسيقات البحث المتقدم - قاعدة البيانات
 * Advanced Database Search Styles
 * ========================================
 */

/* ========================================
   Overlay النتائج
   ======================================== */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.search-overlay.active {
    display: flex;
    opacity: 1;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.search-overlay-content {
    background: #fff;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.4s ease;
}

/* ========================================
   Header البحث
   ======================================== */
.search-header {
    background: linear-gradient(135deg, #4CAF50, #66BB6A);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: bold;
}

.close-search {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 28px;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-search:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* ========================================
   التابات
   ======================================== */
.search-tabs {
    display: flex;
    background: #f5f5f5;
    padding: 0;
    border-bottom: 2px solid #e0e0e0;
}

.search-tab {
    flex: 1;
    padding: 15px 20px;
    background: transparent;
    border: none;
    color: #666;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.search-tab:hover {
    background: rgba(76, 175, 80, 0.1);
    color: #4CAF50;
}

.search-tab.active {
    color: #4CAF50;
    background: white;
    font-weight: bold;
}

.search-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: #4CAF50;
}

/* ========================================
   حاوية النتائج
   ======================================== */
.search-results-container {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    background: #fafafa;
    position: relative;
}

.search-results {
    display: none;
}

/* ========================================
   مؤشر التحميل
   ======================================== */
.loading-indicator {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e0e0e0;
    border-top-color: #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-indicator p {
    color: #666;
    font-size: 16px;
    margin: 0;
}

/* ========================================
   رسالة عدم وجود نتائج
   ======================================== */
.no-results-message {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.no-results-message .icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.no-results-message h4 {
    color: #333;
    font-size: 22px;
    margin: 0 0 10px;
}

.no-results-message p {
    color: #666;
    font-size: 16px;
    margin: 0;
}

/* ========================================
   أقسام النتائج
   ======================================== */
.results-section {
    margin-bottom: 40px;
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.section-title {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    margin: 0 0 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

/* ========================================
   بطاقات المباريات
   ======================================== */
.matches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.match-result-card {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border-radius: 12px;
    padding: 15px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
    cursor: pointer;
}

.match-result-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-color: #4CAF50;
}

.match-header-mini {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.championship-name {
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

.match-time-badge {
    background: linear-gradient(135deg, #4CAF50, #66BB6A);
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
}

.teams-row {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
}

.team-mini {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.team-mini img {
    width: 45px;
    height: 45px;
    object-fit: contain;
    border-radius: 8px;
}

.team-mini span {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    text-align: center;
}

.vs-text {
    font-weight: bold;
    color: #999;
    font-size: 14px;
}

.match-footer-mini {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
    margin-top: 12px;
}

.date-badge {
    font-size: 12px;
    color: #666;
}

.channel-badge {
    font-size: 12px;
    color: #4CAF50;
    font-weight: 500;
}

/* ========================================
   قائمة المقالات
   ======================================== */
.articles-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.article-result-card {
    background: white;
    border: 2px solid #f0f0f0;
    border-radius: 10px;
    padding: 20px;
    transition: all 0.3s ease;
    display: block;
    text-decoration: none;
    color: inherit;
}

.article-result-card:hover {
    border-color: #4CAF50;
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.article-content h5 {
    font-size: 18px;
    color: #333;
    margin: 0 0 10px;
    font-weight: bold;
}

.article-content p {
    font-size: 14px;
    color: #666;
    margin: 0 0 10px;
    line-height: 1.6;
}

.article-date {
    font-size: 12px;
    color: #999;
}

/* ========================================
   شبكة البطولات
   ======================================== */
.championships-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.championship-card {
    background: white;
    border: 2px solid #f0f0f0;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.championship-card:hover {
    border-color: #4CAF50;
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

.championship-card img {
    width: 60px;
    height: 60px;
    object-fit: contain;
}

.championship-card span {
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    color: #333;
}

/* ========================================
   صندوق الاقتراحات
   ======================================== */
.suggestions-box {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #4CAF50;
    border-top: none;
    border-radius: 0 0 15px 15px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    margin-top: -8px;
}

.suggestion-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 15px;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: #f0f9f0;
    color: #4CAF50;
}

/* ========================================
   رسالة الخطأ
   ======================================== */
.error-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.error-message .icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.error-message p {
    color: #f44336;
    font-size: 18px;
    margin: 0;
}

/* ========================================
   الرسوم المتحركة
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   Scrollbar مخصص
   ======================================== */
.search-results-container::-webkit-scrollbar {
    width: 8px;
}

.search-results-container::-webkit-scrollbar-track {
    background: #f0f0f0;
}

.search-results-container::-webkit-scrollbar-thumb {
    background: #4CAF50;
    border-radius: 4px;
}

.search-results-container::-webkit-scrollbar-thumb:hover {
    background: #45a049;
}

/* ========================================
   Responsive - الأجهزة المحمولة
   ======================================== */
@media (max-width: 768px) {
    .search-overlay-content {
        width: 95%;
        max-height: 95vh;
        border-radius: 15px;
    }
    
    .search-header {
        padding: 15px 20px;
    }
    
    .search-header h3 {
        font-size: 18px;
    }
    
    .close-search {
        width: 35px;
        height: 35px;
        font-size: 24px;
    }
    
    .search-tabs {
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .search-tab {
        padding: 12px 15px;
        font-size: 14px;
        flex: none;
        min-width: 100px;
    }
    
    .search-results-container {
        padding: 20px 15px;
    }
    
    .results-section {
        padding: 20px 15px;
        margin-bottom: 25px;
    }
    
    .section-title {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    .matches-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .championships-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
    }
    
    .match-result-card {
        padding: 12px;
    }
    
    .team-mini img {
        width: 35px;
        height: 35px;
    }
    
    .team-mini span {
        font-size: 12px;
    }
    
    .article-result-card {
        padding: 15px;
    }
    
    .article-content h5 {
        font-size: 16px;
    }
    
    .article-content p {
        font-size: 13px;
    }
}

/* ========================================
   تحسينات إضافية
   ======================================== */

/* حالة التركيز */
.search-overlay.active .search-results-container {
    animation: contentFadeIn 0.5s ease 0.3s both;
}

@keyframes contentFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* تأثير Hover على البطاقات */
.match-result-card,
.article-result-card,
.championship-card {
    position: relative;
    overflow: hidden;
}

.match-result-card::before,
.article-result-card::before,
.championship-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(76, 175, 80, 0.1), transparent);
    transition: 0.5s;
}

.match-result-card:hover::before,
.article-result-card:hover::before,
.championship-card:hover::before {
    left: 100%;
}

/* Badge للنتائج الجديدة */
.new-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ff5722;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
}

/* حالة Empty State محسّنة */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #999;
}

.empty-state-icon {
    font-size: 80px;
    margin-bottom: 20px;
    opacity: 0.3;
}

/* Print Styles */
@media print {
    .search-overlay {
        display: none !important;
    }
}
