/* ==================== CSS Variables ==================== */
:root {
    --primary-color: #4CAF50;
    --primary-dark: #2e7d32;
    --primary-light: #81c784;
    --secondary-color: #1976d2;
    --accent-color: #ff6b6b;
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --danger-color: #f44336;
    
    --bg-light: #ffffff;
    --bg-secondary: #f5f5f5;
    --text-dark: #1a1a1a;
    --text-light: #666666;
    --border-color: #e0e0e0;
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
    
    --transition: all 0.3s ease;
    --max-width: 1200px;
}

body.dark-mode {
    --bg-light: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --text-dark: #ffffff;
    --text-light: #b0b0b0;
    --border-color: #404040;
}

/* ==================== Reset & Base Styles ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Cairo', 'Tajawal', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    direction: rtl;
    text-align: right;
    transition: var(--transition);
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ==================== Container & Layout ==================== */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* ==================== Navigation Bar ==================== */
.navbar {
    background-color: var(--bg-light);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: var(--transition);
}

.nav-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    font-weight: 900;
    color: var(--primary-color);
}

.logo-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.logo-text {
    font-weight: 700;
    letter-spacing: 0.5px;
}

.nav-menu {
    display: flex;
    gap: 30px;
    align-items: center;
}

.nav-link {
    font-weight: 500;
    color: var(--text-dark);
    position: relative;
    transition: var(--transition);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    right: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: var(--transition);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-icons {
    display: flex;
    gap: 15px;
    align-items: center;
}

.dark-mode-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dark);
    transition: var(--transition);
}

.dark-mode-toggle:hover {
    background-color: var(--primary-color);
    color: white;
}

.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background-color: var(--text-dark);
    border-radius: 2px;
    transition: var(--transition);
}

/* ==================== Live Scores Bar ==================== */
.live-scores-bar {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 12px 0;
    overflow: hidden;
}

.live-scores-scroll {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding: 5px 0;
    scroll-behavior: smooth;
}

.live-scores-scroll::-webkit-scrollbar {
    height: 4px;
}

.live-scores-scroll::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.live-scores-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.live-score-item {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-size: 14px;
}

.live-badge {
    background-color: var(--danger-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ==================== Hero Section ==================== */
.hero {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 80px 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 120"><path d="M0,50 Q300,0 600,50 T1200,50 L1200,120 L0,120 Z" fill="rgba(255,255,255,0.05)"/></svg>');
    background-repeat: repeat-x;
    animation: wave 15s linear infinite;
}

@keyframes wave {
    0% { transform: translateX(0); }
    100% { transform: translateX(1200px); }
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: 48px;
    font-weight: 900;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.hero-subtitle {
    font-size: 20px;
    margin-bottom: 30px;
    opacity: 0.95;
}

.hero-search {
    display: flex;
    gap: 10px;
    max-width: 500px;
    margin: 0 auto;
    background: white;
    border-radius: 50px;
    padding: 5px;
    box-shadow: var(--shadow-lg);
}

.search-input {
    flex: 1;
    border: none;
    background: none;
    padding: 12px 20px;
    font-size: 16px;
    color: var(--text-dark);
    outline: none;
}

.search-btn {
    background-color: var(--primary-color);
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.search-btn:hover {
    background-color: var(--primary-dark);
    transform: scale(1.05);
}

/* ==================== Main Content ==================== */
.main-content {
    padding: 60px 0;
    background-color: var(--bg-light);
}

.container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 40px;
}

/* ==================== Section Styles ==================== */
.section-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 30px;
    color: var(--text-dark);
    position: relative;
    padding-bottom: 15px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    border-radius: 2px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

/* ==================== Featured Section ==================== */
.featured-section {
    margin-bottom: 60px;
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

/* ==================== News Grid ==================== */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

/* ==================== News Card ==================== */
.news-card {
    background-color: var(--bg-light);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.news-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.news-card.featured-card {
    grid-column: span 2;
}

.card-image {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, var(--bg-secondary), var(--border-color));
    overflow: hidden;
    position: relative;
}

.news-card:not(.loading) .card-image {
    background-size: cover;
    background-position: center;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.news-card:hover .card-image img {
    transform: scale(1.05);
}

.card-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-category {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
    width: fit-content;
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 10px;
    line-height: 1.4;
    flex-grow: 1;
}

.card-excerpt {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 15px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-light);
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.card-date {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ==================== Category Filter ==================== */
.category-filter {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid var(--border-color);
    border-radius: 20px;
    background-color: transparent;
    color: var(--text-dark);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.filter-btn:hover,
.filter-btn.active {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
    color: white;
}

/* ==================== Sidebar ==================== */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.sidebar-widget {
    background-color: var(--bg-light);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-md);
}

.widget-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--text-dark);
}

.widget-description {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 15px;
}

/* ==================== Trending List ==================== */
.trending-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.trending-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 8px;
    background-color: var(--bg-secondary);
    transition: var(--transition);
    cursor: pointer;
}

.trending-item:hover {
    background-color: var(--primary-light);
    color: white;
}

.trending-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 14px;
}

.trending-text {
    font-size: 14px;
    font-weight: 500;
}

/* ==================== Newsletter Form ==================== */
.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.newsletter-form input {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-secondary);
    color: var(--text-dark);
    font-size: 14px;
    transition: var(--transition);
}

.newsletter-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.btn-primary {
    padding: 12px 20px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 8px;
    font-weight: 600;
    transition: var(--transition);
    cursor: pointer;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ==================== Footer ==================== */
.footer {
    background-color: var(--text-dark);
    color: white;
    padding: 60px 0 20px;
    margin-top: 60px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--primary-light);
}

.footer-text {
    font-size: 14px;
    line-height: 1.6;
    opacity: 0.8;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary-light);
    padding-right: 5px;
}

.social-links {
    display: flex;
    gap: 15px;
}

.social-link {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transition: var(--transition);
}

.social-link:hover {
    background-color: var(--primary-color);
    transform: translateY(-3px);
}

.contact-info {
    list-style: none;
}

.contact-info li {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 14px;
    opacity: 0.8;
}

.contact-info a {
    color: rgba(255, 255, 255, 0.8);
    transition: var(--transition);
}

.contact-info a:hover {
    color: var(--primary-light);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 14px;
    opacity: 0.7;
}

/* ==================== Loading State ==================== */
.loading {
    pointer-events: none;
}

.loading .card-image {
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

/* ==================== Responsive Design ==================== */
@media (max-width: 768px) {
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        flex-direction: column;
        gap: 0;
        background-color: var(--bg-light);
        box-shadow: var(--shadow-md);
        padding: 20px;
        z-index: 999;
    }

    .nav-menu.active {
        display: flex;
    }

    .hamburger {
        display: flex;
    }

    .hero-title {
        font-size: 32px;
    }

    .hero-subtitle {
        font-size: 16px;
    }

    .section-title {
        font-size: 24px;
    }

    .featured-grid {
        grid-template-columns: 1fr;
    }

    .news-card.featured-card {
        grid-column: span 1;
    }

    .news-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        order: -1;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .category-filter {
        width: 100%;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 40px 0;
    }

    .hero-title {
        font-size: 24px;
    }

    .hero-subtitle {
        font-size: 14px;
    }

    .hero-search {
        flex-direction: column;
    }

    .search-input {
        padding: 10px 15px;
    }

    .search-btn {
        width: 40px;
        height: 40px;
    }

    .news-grid {
        grid-template-columns: 1fr;
    }

    .nav-menu {
        gap: 10px;
    }

    .nav-link {
        padding: 10px 0;
    }

    .nav-link::after {
        display: none;
    }

    .section-title {
        font-size: 20px;
    }

    .main-content {
        padding: 30px 0;
    }
}
