:root {
    --primary-color: #1e40af;
    --primary-light: #3b82f6;
    --primary-dark: #1e3a8a;
    --bg-color: #f9fafb;
    --card-bg: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow-light: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-medium: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.dark {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --shadow-light: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-medium: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    transition: background-color 0.3s, color 0.3s;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.nav-link {
    position: relative;
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

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

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 2px;
    background: var(--primary-light);
    border-radius: 1px;
}

.search-input {
    width: 200px;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    width: 250px;
}

.search-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
}

.theme-toggle {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: var(--card-bg);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.theme-toggle:hover {
    transform: scale(1.1);
    border-color: var(--primary-light);
}

.lang-toggle {
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.lang-toggle:hover {
    transform: scale(1.05);
    border-color: var(--primary-light);
    color: var(--primary-light);
}

.lang-dropdown-wrapper {
    position: relative;
}

.lang-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-medium);
    min-width: 160px;
    max-height: 320px;
    overflow-y: auto;
    z-index: 100;
    padding: 0.25rem 0;
}

.lang-dropdown.show {
    display: block;
}

.lang-option {
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.lang-option:hover {
    background: var(--bg-color);
    color: var(--primary-light);
}

.carousel-container {
    height: 400px;
}

.carousel-track {
    height: 100%;
}

.carousel-slide {
    height: 100%;
    position: relative;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.carousel-slide .slide-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 50%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 2rem;
}

.carousel-slide .slide-title {
    color: white;
    font-size: 1.75rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.carousel-slide .slide-summary {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.carousel-slide .slide-meta {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
    display: flex;
    gap: 1rem;
}

.carousel-prev,
.carousel-next {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: background 0.2s;
}

.carousel-prev:hover,
.carousel-next:hover {
    background: rgba(255, 255, 255, 0.4);
}

.carousel-indicators button {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.carousel-indicators button.active {
    background: white;
    border-color: white;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--card-bg);
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: var(--primary-light);
    color: var(--primary-light);
}

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

.news-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-light);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

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

.news-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.news-card:hover::before {
    opacity: 1;
}

.news-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.news-card-content {
    padding: 1.25rem;
}

.news-card-category {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-light);
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 12px;
    margin-bottom: 0.75rem;
}

.news-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-card-summary {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.sidebar-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: var(--shadow-light);
}

/* 侧边栏 sticky + 独立滚动 */
@media (min-width: 1024px) {
    main .flex.lg\:flex-row > aside {
        position: sticky;
        top: 6rem;
        max-height: calc(100vh - 8rem);
        overflow-y: scroll;
        scrollbar-gutter: stable;
        padding-right: 0.5rem;
    }

    /* Firefox 滚动条 */
    main .flex.lg\:flex-row > aside {
        scrollbar-width: thin;
        scrollbar-color: var(--text-secondary) transparent;
    }

    /* 侧边栏内部滚动条样式 (WebKit) */
    main .flex.lg\:flex-row > aside::-webkit-scrollbar {
        width: 8px;
    }

    main .flex.lg\:flex-row > aside::-webkit-scrollbar-track {
        background: var(--bg-color);
        border-radius: 4px;
    }

    main .flex.lg\:flex-row > aside::-webkit-scrollbar-thumb {
        background: var(--text-secondary);
        border-radius: 4px;
    }

    main .flex.lg\:flex-row > aside::-webkit-scrollbar-thumb:hover {
        background: var(--primary-light);
    }
}

.hot-news-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

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

.hot-news-item:hover {
    background: rgba(59, 130, 246, 0.05);
    margin: 0 -0.75rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    border-radius: 8px;
}

.hot-news-rank {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    border-radius: 4px;
    flex-shrink: 0;
}

.hot-news-rank.hot {
    background: #ef4444;
}

.hot-news-title {
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.category-tag {
    padding: 0.375rem 0.875rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.category-tag:hover {
    border-color: var(--primary-light);
    color: var(--primary-light);
}

.category-tag.active {
    background: var(--primary-light);
    border-color: var(--primary-light);
    color: white;
}

.recent-news-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

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

.recent-news-item:hover {
    background: rgba(59, 130, 246, 0.05);
    margin: 0 -0.75rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    border-radius: 8px;
}

.recent-news-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.recent-news-title {
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--primary-light);
    border-color: var(--primary-light);
    color: white;
}

.modal-body {
    padding: 2rem;
    max-height: calc(90vh - 4rem);
    overflow-y: auto;
}

.modal-body img {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.modal-body h1 {
    font-size: 1.75rem;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 1rem;
    line-height: 1.4;
}

.modal-body .modal-meta {
    display: flex;
    gap: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.modal-body .modal-content-text {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-primary);
}

.modal-body .modal-content-text p {
    margin-bottom: 1rem;
}

.modal-body .modal-content-text p:last-child {
    margin-bottom: 0;
}

.modal-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.modal-nav-btn {
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-nav-btn:hover {
    border-color: var(--primary-light);
    color: var(--primary-light);
}

.modal-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.related-news {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.related-news h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.related-news-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.related-news-item {
    display: flex;
    gap: 0.75rem;
    cursor: pointer;
    transition: background 0.2s;
    padding: 0.5rem;
    border-radius: 8px;
}

.related-news-item:hover {
    background: rgba(59, 130, 246, 0.05);
}

.related-news-item img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.related-news-item .related-news-title {
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.scroll-animate {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-animate.visible {
    opacity: 1;
    transform: translateY(0);
}

.animation-delay-200 {
    transition-delay: 0.2s;
}

.animation-delay-400 {
    transition-delay: 0.4s;
}

.animation-delay-600 {
    transition-delay: 0.6s;
}

@media (max-width: 768px) {
    .carousel-container {
        height: 280px;
    }

    .carousel-slide .slide-title {
        font-size: 1.25rem;
    }

    .carousel-slide .slide-summary {
        display: none;
    }

    .news-card-image {
        height: 160px;
    }

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

@media (max-width: 480px) {
    .search-input {
        width: 150px;
    }

    .search-input:focus {
        width: 200px;
    }

    .carousel-container {
        height: 220px;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-body img {
        height: 200px;
    }

    .modal-body h1 {
        font-size: 1.25rem;
    }
}