/* ========================================
   المتغيرات العامة
   ======================================== */
:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --secondary: #764ba2;
    --success: #2ecc71;
    --danger: #ff4757;
    --warning: #f39c12;
    --dark: #1a202c;
    --light: #f8f9fa;
    --gray: #6c757d;
    --border: #e9ecef;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* ========================================
   الإعدادات الأساسية
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', sans-serif;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ========================================
   Header
   ======================================== */
.header {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    flex-wrap: wrap;
    gap: 20px;
}

.logo h1 {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: 28px;
    margin-bottom: 4px;
}

.logo span {
    font-size: 12px;
    color: var(--gray);
}

.nav-menu {
    display: flex;
    gap: 32px;
}

.nav-link {
    text-decoration: none;
    color: var(--dark);
    font-weight: 600;
    transition: var(--transition);
    position: relative;
    padding: 8px 0;
}

.nav-link:hover {
    color: var(--primary);
}

.nav-link.active {
    color: var(--primary);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
}

.search-box {
    display: flex;
    gap: 8px;
}

.search-box input {
    padding: 10px 18px;
    border: 2px solid var(--border);
    border-radius: 30px;
    outline: none;
    font-size: 14px;
    width: 250px;
    transition: var(--transition);
    font-family: inherit;
}

.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-box button {
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 16px;
}

.search-box button:hover {
    background: var(--primary-dark);
    transform: scale(1.02);
}

/* ========================================
   Main Content
   ======================================== */
.main-content {
    padding: 40px 0;
}

/* ========================================
   Sections
   ======================================== */
.matches-section {
    background: white;
    border-radius: 24px;
    padding: 32px;
    margin-bottom: 40px;
    box-shadow: var(--shadow);
    animation: fadeInUp 0.5s ease;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border);
}

.section-header h2 {
    font-size: 26px;
    font-weight: 800;
    color: var(--dark);
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--danger);
    color: white;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: bold;
    animation: pulse 1.5s infinite;
}

.live-dot {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: blink 1s infinite;
}

.date-badge {
    background: var(--light);
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 14px;
    color: var(--gray);
    font-weight: 500;
}

/* ========================================
   Matches Grid
   ======================================== */
.matches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 24px;
}

/* ========================================
   Match Card
   ======================================== */
.match-card {
    background: var(--light);
    border-radius: 20px;
    padding: 20px;
    transition: var(--transition);
    cursor: pointer;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.match-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--primary);
}

.match-card.live-card {
    border-right: 4px solid var(--danger);
}

.match-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: bold;
    margin-bottom: 16px;
}

.match-status.live {
    background: var(--danger);
    color: white;
    animation: blink 1s infinite;
}

.match-status.finished {
    background: var(--success);
    color: white;
}

.match-status.not-started {
    background: var(--gray);
    color: white;
}

.match-teams {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 16px;
}

.team {
    text-align: center;
    flex: 1;
}

.team-logo {
    width: 56px;
    height: 56px;
    object-fit: contain;
    margin-bottom: 10px;
}

.team-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--dark);
}

.match-score {
    text-align: center;
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    min-width: 70px;
}

.match-score.live-score {
    color: var(--danger);
    animation: scorePulse 1s ease;
}

.match-info {
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--gray);
}

.match-time {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 8px;
}

.match-league {
    font-weight: 600;
    color: var(--primary);
    font-size: 12px;
}

.match-events {
    margin-top: 12px;
    font-size: 11px;
    color: var(--gray);
    text-align: center;
}

/* ========================================
   Loading States
   ======================================== */
.loading-state {
    text-align: center;
    padding: 60px;
    color: var(--gray);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

/* ========================================
   Error State
   ======================================== */
.error-message {
    text-align: center;
    padding: 40px;
    color: var(--danger);
    background: #fff5f5;
    border-radius: 16px;
    border: 1px solid #ffe0e0;
}

.error-message button {
    margin-top: 16px;
    padding: 8px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

/* ========================================
   Empty State
   ======================================== */
.empty-state {
    text-align: center;
    padding: 60px;
    color: var(--gray);
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* ========================================
   Footer
   ======================================== */
.footer {
    background: var(--dark);
    color: white;
    padding: 40px 0;
    margin-top: 60px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 24px;
}

.footer-info p {
    margin-bottom: 6px;
    font-size: 14px;
}

.data-source {
    font-size: 11px;
    opacity: 0.6;
}

.footer-links {
    display: flex;
    gap: 24px;
}

.footer-links a {
    color: white;
    text-decoration: none;
    font-size: 13px;
    opacity: 0.7;
    transition: var(--transition);
}

.footer-links a:hover {
    opacity: 1;
}

.social-links {
    display: flex;
    gap: 20px;
}

.social-link {
    color: white;
    text-decoration: none;
    font-size: 20px;
    opacity: 0.7;
    transition: var(--transition);
}

.social-link:hover {
    opacity: 1;
    transform: translateY(-2px);
}

/* ========================================
   Animations
   ======================================== */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scorePulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
        gap: 20px;
    }
    
    .search-box {
        width: 100%;
    }
    
    .search-box input {
        flex: 1;
    }
    
    .matches-grid {
        grid-template-columns: 1fr;
    }
    
    .match-teams {
        flex-direction: column;
        gap: 12px;
    }
    
    .match-score {
        order: 2;
        margin: 8px 0;
    }
    
    .team:first-child {
        order: 1;
    }
    
    .team:last-child {
        order: 3;
    }
    
    .section-header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .matches-section {
        padding: 20px;
    }
    
    .section-header h2 {
        font-size: 22px;
    }
    
    .team-logo {
        width: 48px;
        height: 48px;
    }
    
    .team-name {
        font-size: 12px;
    }
    
    .match-score {
        font-size: 24px;
    }
}