/* Modern CSS Reset & Base Styles */
:root {
    --primary-color: #007cba;
    --primary-dark: #005a8b;
    --secondary-color: #f8f9fa;
    --text-color: #333;
    --text-light: #666;
    --border-color: #e0e0e0;
    --background-color: #ffffff;
    --background-alt: #f8f9fa;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.15);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    overflow-x: hidden;
    width: 100%;
}

/* Prevent all images from breaking layout */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Prevent text overflow */
body, p, h1, h2, h3, h4, h5, h6, div, span, a {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Layout Components */
.site-header {
    border-bottom: 1px solid var(--border-color);
    background: var(--background-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
    width: 100%;
    max-height: 100vh;
    overflow-y: auto;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    width: 100%;
}

.header-ad {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    overflow: hidden;
}

.ad-wrapper {
    margin: 0 auto;
    max-width: 100%;
    overflow: hidden;
}

.main-nav {
    padding: 0.5rem 0;
    width: 100%;
}

.nav-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    width: 100%;
}

.nav-brand {
    margin-right: 2rem;
}

.brand-link {
    text-decoration: none;
    color: var(--text-color);
    display: inline-block;
}

.brand-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    white-space: nowrap;
}

.nav-menu {
    list-style: none;
    display: flex;
    gap: 2rem;
    align-items: center;
    flex-grow: 1;
    flex-wrap: wrap;
    max-height: none;
}

.nav-menu li a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: var(--transition);
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    display: inline-block;
}

.nav-menu li a:hover {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.nav-admin {
    display: flex;
    gap: 1rem;
    margin-left: 1rem;
    flex-wrap: wrap;
}

.admin-link, .logout-link {
    text-decoration: none;
    color: var(--text-light);
    font-size: 0.9rem;
    transition: var(--transition);
    white-space: nowrap;
}

.admin-link:hover, .logout-link:hover {
    color: var(--primary-color);
}

/* Main Content Layout */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    width: 100%;
    overflow-x: hidden;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    width: 100%;
}

.content-main {
    min-height: 500px;
    width: 100%;
    overflow-x: hidden;
}

.content-sidebar {
    position: sticky;
    top: 100px;
    height: fit-content;
    overflow-x: hidden;
}

/* Homepage Styles */
.featured-content {
    margin-bottom: 3rem;
    width: 100%;
}

.section-title {
    font-size: 1.8rem;
    text-align: center;
    margin: 2rem 0;
    color: var(--text-color);
}

.category-feed {
    margin-bottom: 3rem;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--background-color);
    width: 100%;
    overflow: hidden;
}

.feed-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.feed-title {
    font-size: 1.2rem;
    margin: 0;
}

.feed-title a {
    color: var(--primary-color);
    text-decoration: none;
}

.article-count {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: normal;
    margin-left: 0.5rem;
}

.view-all-link {
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
    white-space: nowrap;
}

.view-all-link:hover {
    color: var(--primary-color);
}

.feed-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    width: 100%;
}

.featured-article {
    margin-bottom: 1rem;
    width: 100%;
}

.article-card {
    background: var(--background-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: var(--transition);
    width: 100%;
}

.main-card {
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

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

.secondary-card {
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
    display: flex;
    gap: 1rem;
    padding: 1rem;
    align-items: flex-start;
}

.secondary-card:hover {
    box-shadow: var(--shadow-hover);
}

.article-image {
    overflow: hidden;
    position: relative;
}

.featured-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    transition: var(--transition);
}

.main-card:hover .featured-image {
    transform: scale(1.05);
}

.thumbnail-image {
    width: 100px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.article-content {
    padding: 1rem;
    width: 100%;
    overflow: hidden;
}

.secondary-card .article-content {
    padding: 0;
    flex-grow: 1;
    min-width: 0;
}

.article-meta {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.article-meta .publish-date {
    font-weight: 500;
}

.article-title {
    margin: 0 0 0.5rem 0;
    line-height: 1.3;
}

.article-title a {
    color: var(--text-color);
    text-decoration: none;
    transition: var(--transition);
}

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

.article-excerpt {
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.5;
}

.secondary-articles {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

/* Quick Navigation */
.quick-navigation {
    margin-top: 3rem;
    padding: 2rem 0;
    background: var(--background-alt);
    border-radius: var(--border-radius);
    width: 100%;
}

.nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    width: 100%;
}

.nav-item {
    background: var(--background-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

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

.nav-link {
    display: block;
    padding: 2rem;
    text-decoration: none;
    color: var(--text-color);
    text-align: center;
}

.nav-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.nav-title {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

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

/* Single Article Styles */
.single-article {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    overflow-x: hidden;
}

.article-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    width: 100%;
}

.single-article .article-meta {
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.article-separator {
    color: var(--text-light);
}

.single-article .article-title {
    font-size: 2rem;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.article-excerpt {
    font-size: 1.1rem;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.featured-image-container {
    margin: 1.5rem 0;
    width: 100%;
    overflow: hidden;
}

.article-featured-image {
    width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.article-body {
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 2rem;
    width: 100%;
    overflow-x: hidden;
}

.article-body h1, .article-body h2, .article-body h3, .article-body h4, .article-body h5, .article-body h6 {
    margin: 1.5rem 0 1rem 0;
    color: var(--text-color);
}

.article-body p {
    margin-bottom: 1rem;
}

.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    margin: 1rem 0;
}

.article-body blockquote {
    border-left: 3px solid var(--primary-color);
    margin: 1.5rem 0;
    padding: 1rem 1.5rem;
    background: var(--background-alt);
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.article-tags {
    margin: 2rem 0;
    padding: 1rem;
    background: var(--background-alt);
    border-radius: var(--border-radius);
    width: 100%;
}

.tags-title {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--text-light);
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
}

.article-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--background-alt);
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
    width: 100%;
}

.article-stats {
    font-size: 0.9rem;
    color: var(--text-light);
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.social-share {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

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

.share-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

.share-link:hover {
    text-decoration: underline;
}

/* Related Articles */
.related-articles {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    width: 100%;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
    width: 100%;
}

.related-article {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--background-color);
    transition: var(--transition);
}

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

.related-image {
    overflow: hidden;
}

.related-thumbnail {
    width: 100%;
    height: 150px;
    object-fit: cover;
    transition: var(--transition);
}

.related-article:hover .related-thumbnail {
    transform: scale(1.05);
}

.related-content {
    padding: 1rem;
    width: 100%;
}

.related-meta {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.other-related {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.more-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.more-link:hover {
    text-decoration: underline;
}

/* Sidebar Styles */
.sidebar-ad {
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 2rem;
    text-align: center;
    width: 100%;
    overflow: hidden;
}

.ad-label {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.sidebar-section {
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 2rem;
    width: 100%;
}

.sidebar-title {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.category-list, .popular-list {
    list-style: none;
}

.category-list li, .popular-list li {
    margin-bottom: 0.5rem;
}

.category-list a, .popular-list a {
    color: var(--text-color);
    text-decoration: none;
    transition: var(--transition);
    display: block;
}

.category-list a:hover, .popular-list a:hover {
    color: var(--primary-color);
}

.category-list .count {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Footer Styles */
.site-footer {
    margin-top: 3rem;
    padding: 2rem;
    background: var(--background-alt);
    border-top: 1px solid var(--border-color);
    width: 100%;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.footer-ad {
    text-align: center;
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--background-color);
    overflow: hidden;
}

.footer-info {
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Utility Classes */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    width: 100%;
}

.no-articles {
    text-align: center;
    color: var(--text-light);
    font-style: italic;
    padding: 2rem;
}

/* Inline Ad Styles */
.inline-ad {
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--background-alt);
    border: 1px dashed var(--border-color);
    border-radius: var(--border-radius);
    text-align: center;
    width: 100%;
    overflow: hidden;
}

.ad-image {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
}

.ad-placeholder {
    color: var(--text-light);
    font-style: italic;
    padding: 2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    html {
        font-size: 15px;
    }
    
    /* Fix header to not be sticky on mobile and limit height */
    .site-header {
        position: relative;
        max-height: none;
    }
    
    /* Collapse menu by default - add hamburger menu */
    .header-content {
        padding: 0 0.5rem;
    }
    
    .main-nav {
        padding: 0.5rem 0;
    }
    
    .content-wrapper {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .content-sidebar {
        position: static;
        top: auto;
    }
    
    .nav-content {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }
    
    .nav-brand {
        margin-right: 0;
        width: 100%;
        margin-bottom: 0;
        padding: 0.5rem 0;
        border-bottom: 1px solid var(--border-color);
    }
    
    .brand-title {
        font-size: 1.3rem;
    }
    
    /* Compact menu layout */
    .nav-menu {
        flex-direction: row;
        width: 100%;
        gap: 0;
        align-items: stretch;
        flex-wrap: wrap;
        justify-content: flex-start;
        padding: 0.5rem 0;
    }
    
    .nav-menu li {
        width: auto;
        flex: 0 0 auto;
        border-bottom: none;
        border-right: 1px solid var(--border-color);
    }
    
    .nav-menu li:last-child {
        border-right: none;
    }
    
    .nav-menu li a {
        display: block;
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
        white-space: nowrap;
        border-bottom: none;
    }
    
    .nav-admin {
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
        padding: 0.5rem 0;
        border-top: 1px solid var(--border-color);
        gap: 0.75rem;
    }
    
    .admin-link, .logout-link {
        font-size: 0.85rem;
    }
    
    .feed-content {
        grid-template-columns: 1fr;
    }
    
    .secondary-card {
        flex-direction: column;
    }
    
    .thumbnail-image {
        width: 100%;
        height: 150px;
    }
    
    .nav-grid {
        grid-template-columns: 1fr;
    }
    
    .related-grid {
        grid-template-columns: 1fr;
    }
    
    .article-footer {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .single-article .article-title {
        font-size: 1.5rem;
    }
    
    .social-share {
        width: 100%;
    }
    
    .category-feed {
        padding: 1rem;
    }
    
    .main-content {
        padding: 1rem;
        padding-top: 0.5rem;
    }
    
    .featured-image {
        height: 200px;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
    
    /* Ensure header doesn't stick on small screens */
    .site-header {
        position: relative;
    }
    
    .header-content {
        padding: 0 0.5rem;
    }
    
    .main-nav {
        padding: 0.5rem 0;
    }
    
    .main-content {
        padding: 0.5rem;
    }
    
    .nav-content {
        padding: 0;
        gap: 0.5rem;
    }
    
    .brand-title {
        font-size: 1.2rem;
        padding: 0.5rem 0;
    }
    
    .nav-menu {
        gap: 0;
    }
    
    .nav-menu li a {
        padding: 0.65rem 0.5rem;
        font-size: 0.95rem;
    }
    
    .section-title {
        font-size: 1.4rem;
    }
    
    .single-article .article-title {
        font-size: 1.3rem;
    }
    
    .quick-navigation {
        padding: 1rem;
    }
    
    .nav-item {
        margin-bottom: 1rem;
    }
    
    .nav-link {
        padding: 1.5rem;
    }
    
    .category-feed {
        padding: 0.75rem;
    }
    
    .article-content {
        padding: 0.75rem;
    }
    
    .feed-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .article-body {
        font-size: 0.95rem;
    }
    
    .featured-image {
        height: 180px;
    }
}

/* Extra small devices */
@media (max-width: 360px) {
    html {
        font-size: 13px;
    }
    
    .brand-title {
        font-size: 1.1rem;
    }
    
    .nav-menu li a {
        font-size: 0.9rem;
        padding: 0.4rem;
    }
    
    .featured-image {
        height: 150px;
    }
}