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

html {
    scroll-behavior: smooth;
}

/* RTL Support */
[dir="rtl"] .article-card {
    flex-direction: row-reverse;
}

[dir="rtl"] .article-content {
    padding: 1.5rem;
    padding-right: 0;
    padding-left: 1.5rem;
}

[dir="rtl"] .nav-links a {
    border-left: 3px solid transparent;
    border-bottom: none;
}

[dir="rtl"] .nav-links a:hover,
[dir="rtl"] .nav-links a.active {
    border-left-color: var(--primary-color);
    border-bottom-color: transparent;
}

:root {
    --primary-color: #2c5aa0;
    --secondary-color: #1a3a66;
    --accent-color: #e74c3c;
    --text-dark: #333;
    --text-light: #666;
    --bg-light: #f4f4f4;
    --white: #ffffff;
    --border-color: #ddd;
    --shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-light);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--white);
    padding: 1.5rem 0;
    box-shadow: var(--shadow);
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
}

.header-content a {
    display: block;
    line-height: 0;
    background: transparent !important;
    padding: 0;
    margin: 0;
}

.logo {
    height: 90px;
    width: 450px;
    max-width: 100%;
    transition: transform 0.3s ease;
    background: transparent !important;
    display: block;
    border: none;
}

.logo:hover {
    transform: scale(1.05);
}

header .tagline {
    font-size: 1.1rem;
    opacity: 0.9;
    margin: 0;
}

/* Navigation Styles */
nav {
    background-color: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav .container {
    padding: 0;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0;
}

.nav-links li {
    flex-shrink: 0;
}

.nav-links a {
    display: block;
    padding: 1rem 1.5rem;
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.nav-links a:hover {
    background-color: var(--bg-light);
    border-bottom-color: var(--primary-color);
}

.nav-links a.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background-color: var(--bg-light);
}

/* Main Content */
main {
    padding: 2rem 0;
    min-height: calc(100vh - 400px);
}

/* Hero Section */
.hero {
    background-color: var(--white);
    padding: 3rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    text-align: center;
}

.hero h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.hero p {
    font-size: 1.1rem;
    color: var(--text-light);
}

/* Categories Grid */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.category-card {
    background-color: var(--white);
    border-radius: 8px;
    padding: 2rem;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.category-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.category-card p {
    color: var(--text-light);
    margin-bottom: 1rem;
}

.feed-sources {
    list-style: none;
    margin: 1rem 0;
    padding-left: 0;
}

.feed-sources li {
    padding: 0.5rem 0;
    color: var(--text-light);
    font-size: 0.9rem;
    border-bottom: 1px solid var(--bg-light);
}

.feed-sources li:last-child {
    border-bottom: none;
}

.feed-sources li a {
    color: var(--text-dark);
    text-decoration: none;
    transition: color 0.3s ease;
    display: block;
}

.feed-sources li a:hover {
    color: var(--primary-color);
}

.btn {
    display: inline-block;
    background-color: var(--primary-color);
    color: var(--white);
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.3s ease;
    margin-top: 1rem;
}

.btn:hover {
    background-color: var(--secondary-color);
}

/* Category Page */
.category-banner {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    padding: 3rem 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    text-align: center;
}

.category-banner h2 {
    font-size: 2.5rem;
    color: var(--white);
    margin: 0;
    font-weight: 700;
}

/* Articles List */
.articles-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.article-card {
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: row;
    gap: 1.5rem;
}

.article-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.article-card:target {
    animation: highlight 2s ease;
    scroll-margin-top: 100px;
}

@keyframes highlight {
    0% {
        background-color: #fff3cd;
        transform: scale(1.02);
    }
    100% {
        background-color: var(--white);
        transform: scale(1);
    }
}

.article-media {
    flex-shrink: 0;
    width: 250px;
    overflow: hidden;
    background-color: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

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

.article-content {
    padding: 1.5rem;
    padding-left: 0;
    flex: 1;
    min-width: 0;
}

.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.source {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.date {
    color: var(--text-light);
    font-size: 0.9rem;
}

.article-title {
    margin-bottom: 1rem;
}

.article-title a {
    color: var(--text-dark);
    text-decoration: none;
    font-size: 1.3rem;
    line-height: 1.4;
    transition: color 0.3s ease;
}

.article-title a:hover {
    color: var(--primary-color);
}

.article-description {
    color: var(--text-light);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.read-more {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    transition: color 0.3s ease;
}

.read-more:hover {
    color: var(--secondary-color);
}

/* Share Buttons */
.share-buttons {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.share-label {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 600;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: all 0.3s ease;
    text-decoration: none;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.share-btn.facebook {
    background-color: #1877f2;
    color: #ffffff;
}

.share-btn.facebook:hover {
    background-color: #0d65d9;
}

.share-btn.twitter {
    background-color: #000000;
    color: #ffffff;
}

.share-btn.twitter:hover {
    background-color: #333333;
}

.share-btn.whatsapp {
    background-color: #25d366;
    color: #ffffff;
}

.share-btn.whatsapp:hover {
    background-color: #1faa52;
}

.no-articles {
    background-color: var(--white);
    padding: 3rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: var(--shadow);
}

.no-articles p {
    color: var(--text-light);
    font-size: 1.1rem;
}

.refresh-info {
    margin-top: 2rem;
    padding: 1rem;
    background-color: var(--white);
    border-radius: 8px;
    text-align: center;
    box-shadow: var(--shadow);
}

.refresh-info p {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Footer */
footer {
    background-color: var(--secondary-color);
    color: var(--white);
    padding: 2rem 0;
    margin-top: 3rem;
}

footer p {
    text-align: center;
    margin: 0.5rem 0;
    opacity: 0.9;
}

/* Ad Container - prevent ads from breaking layout */
.ad-container {
    max-width: 100%;
    overflow: hidden;
    margin: 1rem 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .logo {
        height: 70px;
        width: auto;
    }

    header .tagline {
        font-size: 1rem;
    }

    /* Horizontal scrolling navigation on mobile */
    nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .nav-links {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
    }

    .nav-links::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }

    .nav-links a {
        white-space: nowrap;
        padding: 0.85rem 1rem;
        font-size: 0.9rem;
    }

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

    .hero {
        padding: 2rem 1rem;
    }

    .hero h2 {
        font-size: 1.5rem;
    }

    .category-banner {
        padding: 2rem 1.5rem;
    }

    .category-banner h2 {
        font-size: 1.8rem;
    }

    .article-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Stack article card vertically on mobile */
    .article-card {
        flex-direction: column !important;
        gap: 0;
        display: block !important;
    }

    [dir="rtl"] .article-card {
        flex-direction: column !important;
    }

    .article-media {
        width: 100%;
        max-height: 200px;
        padding: 0.75rem;
        flex-shrink: 1;
        display: block;
    }

    .article-media img {
        max-height: 180px;
        max-width: 100%;
        width: auto;
        height: auto;
        margin: 0 auto;
        display: block;
    }

    .article-content {
        padding: 1rem !important;
        display: block !important;
        width: 100% !important;
    }

    .article-title a {
        font-size: 1.15rem;
    }

    .article-description {
        font-size: 0.95rem;
    }

    .share-buttons {
        flex-wrap: wrap;
    }
}

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

    .logo {
        height: 50px;
        width: auto;
    }

    header .tagline {
        font-size: 0.9rem;
    }

    .nav-links a {
        padding: 0.75rem 0.85rem;
        font-size: 0.85rem;
    }

    .category-banner {
        padding: 1.5rem 1rem;
    }

    .category-banner h2 {
        font-size: 1.5rem;
    }

    .article-title a {
        font-size: 1rem;
    }

    .article-description {
        font-size: 0.9rem;
    }

    .category-card {
        padding: 1rem;
    }

    .article-card {
        border-radius: 6px;
        display: block !important;
    }

    .article-content {
        padding: 0.85rem !important;
        display: block !important;
    }

    .article-media {
        padding: 0.5rem;
        max-height: 180px;
        display: block;
        text-align: center;
    }

    .article-media img {
        max-height: 160px;
        max-width: 100%;
    }

    .share-btn {
        width: 32px;
        height: 32px;
    }

    .share-label {
        font-size: 0.85rem;
    }

    .source {
        font-size: 0.8rem;
        padding: 0.2rem 0.6rem;
    }

    .date {
        font-size: 0.8rem;
    }
}

/* Prevent horizontal overflow globally */
html, body {
    overflow-x: hidden;
}

main, .container {
    max-width: 100%;
    overflow-x: hidden;
}
