@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

:root {
    --primary-color: #0f172a;
    --secondary-color: #334155;
    --accent-color: #38bdf8;
    --bg-color: #f1f5f9;
    --text-color: #1e293b;
    --light-color: #e2e8f0;
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-600: #4b5563;
    --gray-900: #111827;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.15), 0 10px 10px -5px rgba(0,0,0,0.04);
    --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    --radius-sm: 16px;
    --radius-md: 16px;
    --radius-lg: 16px;
    --glass: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    line-height: 1.8;
    color: var(--text-color);
    background-color: var(--bg-color);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

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

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

.article-card h3 a {
    color: #1a1a1a;
    transition: var(--transition);
    background-image: linear-gradient(var(--primary-color), var(--primary-color));
    background-position: 0% 100%;
    background-repeat: no-repeat;
    background-size: 0% 2px;
}

.article-card:hover h3 a {
    background-size: 100% 2px;
    color: var(--primary-color);
}

h1, h2, h3, h4 {
    font-family: 'Inter', system-ui, sans-serif;
    font-weight: 800;
    line-height: 1.3;
    color: #1a1a1a;
    letter-spacing: -0.02em;
}

.container {
    width: 90%;
    margin: 0 auto;
}

/* 确保所有布局下容器宽度一致 */
.layout-sidebar-right .container,
.layout-sidebar-left .container,
.layout-centered-wide .container,
.layout-centered-narrow .container,
.layout-magazine .container,
.layout-minimal .container {
    max-width: 100%;
    width: 90%;
}

/* Header Styles */
.header-classic .header {
    background-color: var(--white);
    border-bottom: 1px solid var(--gray-200);
}

.header-sticky .header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
}

.header-minimal .header {
    background: transparent;
    border: none;
    padding: 2rem 0;
}

.header-centered .header-content {
    flex-direction: column;
    gap: 1.5rem;
}

.header-centered .nav {
    justify-content: center;
}

/* Footer Styles */
.footer-simple .footer {
    padding: 2rem 0;
}

/* Ensure essential links are always visible even in simple mode */
.footer-simple .footer-links-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.footer-simple .footer-links-section h3 {
    display: none;
}

.footer-detailed .footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 3rem;
}

/* Article Card Styles */
.card-style-grid .article-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.card-style-list .article-grid {
    grid-template-columns: 1fr;
}

.card-style-list .article-card {
    flex-direction: row;
    align-items: center;
}

.card-style-list .article-card-image {
    width: 300px;
    height: 200px;
    padding-top: 0;
}

.card-style-masonry .article-grid {
    column-count: 3;
    column-gap: 1.5rem;
    display: block;
}

.card-style-masonry .article-card {
    break-inside: avoid;
    margin-bottom: 1.5rem;
}

.card-style-minimal .article-card {
    box-shadow: none;
    border: none;
    background: transparent;
    padding: 1rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.card-style-minimal .article-card-image {
    width: 100%;
    height: 180px;
    margin-bottom: 1rem;
    border-radius: var(--radius-sm);
}

.card-style-minimal .article-card:hover {
    transform: none;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo a {
    font-family: 'Playfair Display', serif;
    font-size: 1.75rem;
    color: var(--primary-color);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Search Bar Styles */
.search-container {
    margin-left: 1.5rem;
}

.search-form {
    display: flex;
    align-items: center;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 50px;
    padding: 0.25rem 0.5rem 0.25rem 1.25rem;
    transition: var(--transition);
}

.search-form:focus-within {
    background: var(--white);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--light-color);
}

.search-form input {
    border: none;
    background: transparent;
    outline: none;
    padding: 0.5rem 0;
    width: 180px;
    font-size: 0.9rem;
    color: var(--text-color);
}

.search-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    margin-left: 0.5rem;
}

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

.search-btn svg {
    width: 16px;
    height: 16px;
}

.nav-link {
    color: var(--gray-600);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
    border: none;
    background: none;
    cursor: pointer;
    padding: 0.5rem 0;
    position: relative;
}

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

.nav-dropdown {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--white);
    min-width: 200px;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-100);
    margin-top: 0.5rem;
    animation: fadeIn 0.2s ease-out;
}

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

.nav-dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-content a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--gray-600);
    text-decoration: none;
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.dropdown-content a:hover {
    background-color: var(--gray-50);
    color: var(--primary-color);
}

/* Home Banner */
.home-banner {
    position: relative;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 6rem 1rem;
    text-align: center;
    color: var(--white);
    margin-bottom: 3rem;
}

.home-banner h2 {
    font-size: clamp(2rem, 8vw, 4rem);
    color: var(--white);
    margin-bottom: 1.5rem;
}

.home-banner p {
    font-size: clamp(1rem, 4vw, 1.25rem);
    opacity: 0.9;
    max-width: 700px;
    margin: 0 auto;
}

/* Main Content Layout */
.main {
    padding-bottom: 6rem;
}

/* Layout: Sidebar Right (Default) */
.layout-sidebar-right .content-and-sidebar {
    display: flex;
    justify-content: space-between;
    gap: 5%;
}

.layout-sidebar-right .main-content {
    flex: 0 0 80%;
    max-width: 100%;
}

.layout-sidebar-right .sidebar {
    flex: 0 0 15%;
    position: sticky;
    top: 100px;
    height: fit-content;
}

/* Layout: Sidebar Left */
.layout-sidebar-left .content-and-sidebar {
    display: flex;
    justify-content: space-between;
    gap: 5%;
    flex-direction: row-reverse;
}

.layout-sidebar-left .main-content {
    flex: 0 0 80%;
    max-width: 100%;
}

.layout-sidebar-left .sidebar {
    flex: 0 0 15%;
    position: sticky;
    top: 100px;
    height: fit-content;
}

/* Layout: Centered Wide */
.layout-centered-wide .content-and-sidebar {
    display: flex;
    flex-direction: column;
}

.layout-centered-wide .main-content {
    flex: 0 0 100%;
    max-width: 100%;
}

.layout-centered-wide .sidebar {
    display: none;
}

/* Layout: Centered Narrow */
.layout-centered-narrow .content-and-sidebar {
    display: flex;
    flex-direction: column;
}

.layout-centered-narrow .main-content {
    flex: 0 0 100%;
    max-width: 100%;
}

.layout-centered-narrow .sidebar {
    display: none;
}

/* Layout: Magazine */
.layout-magazine .content-and-sidebar {
    display: flex;
    justify-content: space-between;
    gap: 4%;
}

.layout-magazine .main-content {
    flex: 0 0 75%;
    max-width: 100%;
}

.layout-magazine .sidebar {
    flex: 0 0 21%;
    position: sticky;
    top: 100px;
    height: fit-content;
}

.layout-magazine .article-grid {
    gap: 2rem;
}

.layout-magazine .article-card {
    border-radius: var(--radius-lg);
}

/* Layout: Minimal */
.layout-minimal .header {
    padding: 0.75rem 0;
}

.layout-minimal .logo a {
    font-size: 1.5rem;
}

.layout-minimal .content-and-sidebar {
    display: flex;
    flex-direction: column;
}

.layout-minimal .main-content {
    flex: 0 0 100%;
    max-width: 100%;
}

.layout-minimal .sidebar {
    display: none;
}

.layout-minimal .home-banner {
    padding: 4rem 1rem;
}

.layout-minimal .article-full {
    padding: 2rem 1rem;
    box-shadow: none;
    border: none;
}

/* Sidebar Widgets */
.sidebar-widget {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius-md);
    margin-bottom: 2.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
}

.sidebar-widget h3 {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--light-color);
}

.sidebar-news-item {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-50);
}

.sidebar-news-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.sidebar-news-item a {
    text-decoration: none;
    color: var(--gray-900);
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
}

.sidebar-news-item a:hover {
    color: var(--primary-color);
}

/* Article Cards */
.page-title {
    font-size: 2.5rem;
    margin-bottom: 2.5rem;
}

.article-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.article-card {
    background: var(--white);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    height: 100%;
}

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

.article-card-image {
    position: relative;
    padding-top: 56.25%;
    overflow: hidden;
}

.article-card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-card-content {
    padding: 1.25rem;
    flex: 1;
}

.category-tag {
    display: inline-block;
    background-color: var(--light-color);
    color: var(--primary-color);
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

.article-card h3 {
    font-size: 1.15rem;
    margin-bottom: 0.75rem;
}

.article-card h3 a {
    color: var(--gray-900);
    text-decoration: none;
}

.article-card p {
    color: var(--gray-600);
    font-size: 0.875rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Article Detail */
.article-full {
    background: var(--white);
    padding: 4rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
}

.article-header {
    margin-bottom: 3rem;
    text-align: center;
}

.article-header h1 {
    font-size: 3rem;
    margin-bottom: 1.5rem;
}

.article-meta {
    color: var(--gray-600);
    font-size: 0.95rem;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.article-body {
    font-size: 1.15rem;
    line-height: 1.9;
}

.article-body h2 {
    margin: 3rem 0 1.5rem;
    font-size: 2rem;
}

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

.article-full img {
    width: 100%;
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
}

/* Pagination */
.pagination {
    margin-top: 4rem;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.page-btn {
    padding: 0.6rem 1rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    color: var(--gray-600);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

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

/* Footer */
.footer {
    background-color: var(--gray-900);
    color: var(--white);
    padding: 4rem 0 2rem;
}

.footer-content {
    margin-bottom: 2rem;
    width: 100%;
}

.footer-links-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.footer-links-container a {
    color: var(--gray-300);
    text-decoration: none;
    font-size: 0.875rem;
}

/* Legal Footer (Mandatory) */
.footer-legal {
    padding: 1.5rem 0;
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    width: 100%;
    clear: both;
    text-align: center;
}

.footer-legal a {
    color: var(--gray-300);
    text-decoration: none;
    font-size: 0.75rem;
    transition: var(--transition);
}

.footer-legal a:hover {
    color: var(--white);
}

.footer-bottom {
    padding-top: 1.5rem;
    text-align: center;
    color: var(--gray-600);
    font-size: 0.8125rem;
    width: 100%;
    display: block;
    clear: both;
}

/* Ads */
.ad-slot {
    max-width: 100%;
    overflow: hidden;
    margin: 2rem 0;
}

.ad-skeleton {
    min-height: 90px;
    background: var(--gray-100);
    display: flex;
    justify-content: center;
    align-items: center;
}

.ad-label {
    font-size: 0.7rem;
    color: var(--gray-300);
}

/* Floating Ads */
.floating-ads {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
}

.floating-ad {
    background: var(--white);
    box-shadow: var(--shadow-lg);
    position: relative;
    padding: 1rem;
}

.close-ad-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    z-index: 10;
    transition: var(--transition);
}

.close-ad-btn:hover {
    background: var(--primary-color);
}

.ad-countdown {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    pointer-events: none;
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}

.mobile-menu-toggle span {
    display: block;
    width: 25px;
    height: 2px;
    background-color: var(--primary-color);
    transition: var(--transition);
}

/* Responsive Overrides */
@media (max-width: 1024px) {
    .mobile-menu-toggle {
        display: flex;
    }

    .nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--white);
        flex-direction: column;
        padding: 1rem 0;
        box-shadow: var(--shadow-lg);
        border-top: 1px solid var(--gray-100);
        z-index: 1000;
        gap: 0;
    }

    .nav.active {
        display: flex;
    }

    .nav-link {
        width: 100%;
        padding: 1rem 2rem;
        border-bottom: 1px solid var(--gray-50);
    }

    .nav-dropdown {
        width: 100%;
    }

    .dropdown-content {
        position: static;
        display: block;
        box-shadow: none;
        border: none;
        padding: 0;
        background: var(--gray-50);
    }

    .dropdown-content a {
        padding: 1rem 3rem;
    }

    .content-and-sidebar {
        flex-direction: column !important;
        gap: 2rem !important;
    }
    .main-content, .sidebar {
        flex: 0 0 100% !important;
        width: 100% !important;
    }
    .header-content {
        flex-direction: column;
        gap: 1.5rem;
    }

    .search-container {
        margin-left: 0;
        width: 100%;
    }

    .search-form {
        width: 100%;
    }

    .search-form input {
        width: 100%;
    }

    /* Adjust Grid for Tablets */
    .article-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
    }
}

@media (max-width: 768px) {
    .article-grid {
        grid-template-columns: 1fr !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 1.5rem !important;
    }

    .card-style-list .article-card {
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    .card-style-list .article-card-image {
        width: 100% !important;
        height: 200px !important;
    }

    .card-style-masonry .article-grid {
        column-count: 1 !important;
        display: flex !important;
    }

    .article-full {
        padding: 1.5rem !important;
    }
    
    .home-banner {
        padding: 4rem 1rem !important;
    }

    .home-banner h2 {
        font-size: 2.5rem !important;
    }

    .footer-detailed .footer-content {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }

    .stats-widget {
        grid-template-columns: 1fr 1fr !important;
    }
}

@media (max-width: 480px) {
    .container {
        width: 95% !important;
    }
    
    .article-card h3 {
        font-size: 1.25rem !important;
    }

    .newsletter-signup input {
        width: 100% !important;
        margin-bottom: 1rem !important;
        margin-right: 0 !important;
    }
    
    .newsletter-signup button {
        width: 100% !important;
    }
}

/* ===== Module Styles ===== */
.featured-section {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 3rem 1rem;
    margin: 2rem 0;
    border-radius: var(--radius-lg);
}

.featured-section h2 {
    color: white;
    margin-bottom: 1rem;
}

.featured-section .featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.featured-card {
    background: rgba(255, 255, 255, 0.15);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    backdrop-filter: blur(10px);
}

.featured-card h4 {
    color: white;
    margin-bottom: 0.5rem;
}

.featured-card a {
    color: white;
    font-weight: 600;
    opacity: 0.9;
}

.featured-card a:hover {
    opacity: 1;
    text-decoration: none;
}

.category-highlights {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.category-highlight-card {
    background: var(--light-color);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    text-align: center;
    border: 1px solid var(--gray-200);
    transition: var(--transition);
}

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

.trending-articles {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    margin: 2rem 0;
    border: 1px solid var(--gray-200);
}

.trending-articles .trending-list {
    list-style: none;
    padding: 0;
}

.trending-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-100);
}

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

.about-widget {
    background: var(--light-color);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
}

.newsletter-signup {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 2rem;
    border-radius: var(--radius-lg);
    text-align: center;
    margin: 2rem 0;
}

.newsletter-signup h3 {
    color: white;
    margin-bottom: 0.5rem;
}

.newsletter-signup input {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: none;
    width: 250px;
    margin-right: 0.5rem;
}

.newsletter-signup button {
    padding: 0.75rem 1.5rem;
    background: white;
    color: var(--primary-color);
    border: none;
    border-radius: var(--radius-sm);
    font-weight: bold;
    cursor: pointer;
}

.recent-comments {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
}

.comment-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-100);
}

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

.stats-widget {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    text-align: center;
    border: 1px solid var(--gray-200);
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.social-links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    text-decoration: none;
    transition: var(--transition);
}

.social-link:hover {
    background: var(--secondary-color);
    transform: scale(1.1);
}

.popular-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-item {
    background: var(--light-color);
    color: var(--text-color);
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    text-decoration: none;
    font-size: 0.875rem;
    transition: var(--transition);
}

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