/* ========= GLOBAL & VARIABLES ========= */
/* Google Fonts imported locally in header */

:root {
    /* Colors */
    --purple-500: #8B5CF6;
    --purple-600: #7C3AED;
    --purple-700: #6D28D9;
    --violet-500: #8B5CF6;
    --blue-500: #3B82F6;
    --blue-600: #2563EB;
    --pink-500: #EC4899;

    /* Grays */
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;

    --white: #FFFFFF;
    --black: #000000;

    /* Semantic */
    --bg-primary: var(--white);
    --bg-secondary: var(--gray-50);
    --text-primary: var(--gray-900);
    --text-secondary: var(--gray-500);
    --border-color: var(--gray-200);

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    /* Gradients */
    --gradient-purple: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-stat-purple: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
    --gradient-stat-blue: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    --gradient-stat-violet: linear-gradient(135deg, #c084fc 0%, #a855f7 100%);
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --text-primary: #e8e8e8;
    --text-secondary: #a0a0a0;
    --border-color: #2a2a4a;
    --gray-50: #1a1a2e;
    --gray-100: #232347;
    --gray-200: #2d2d5a;
    --white: #1a1a2e;
}

/* ========= RESET & BASE ========= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Hide the global header from layout */
body>header {
    display: none;
}

body.show-header>header {
    display: block !important;
}

/* ========= PAGE CONTAINER ========= */
.page-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px 40px;
}

.page-container.compact {
    padding: 0 10px;
    max-width: 1400px;
    margin: 0 auto;
    overflow-x: hidden;
}

/* ========= SITE HEADER ========= */
.site-header {
    padding: 12px 0;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color, #eee);
}

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

.header-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
    min-width: 0;
}

.brand-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.brand-name-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
}

.brand-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-domain {
    font-size: 0.55rem;
    color: var(--text-secondary, #6B7280);
    letter-spacing: 0.03em;
    font-weight: 400;
    opacity: 0.7;
    margin-top: -2px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.layout-btns {
    display: flex;
    gap: 4px;
}

.action-btn {
    background: var(--bg-secondary, #f5f5f5);
    border: 1px solid var(--border-color, #ddd);
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.15s;
    line-height: 1;
    color: var(--text-primary);
}

.action-btn:hover {
    background: var(--bg-hover, #e8e8e8);
}

.action-btn.active {
    background: var(--accent-color, #e63946);
    color: #fff;
    border-color: var(--accent-color, #e63946);
}

/* Theme toggle icons */
#theme-toggle .icon-light {
    display: none;
}

[data-theme="dark"] #theme-toggle .icon-dark {
    display: none;
}

[data-theme="dark"] #theme-toggle .icon-light {
    display: inline;
}

/* Responsive visibility */
.hide-mobile {
    display: flex;
}

.hide-desktop {
    display: none;
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }

    .hide-desktop {
        display: flex !important;
    }

    .brand-text {
        font-size: 0.9em;
    }

    .header-brand {
        font-size: 1em;
    }
}

/* ========= HERO HEADER ========= */
.hero-header {
    background: var(--gradient-purple);
    border-radius: 0 0 24px 24px;
    padding: 32px 40px 40px;
    margin: 0 -24px 32px;
    color: white;
}

.hero-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
}

.hero-branding {
    display: block;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}

.hero-logo {
    font-size: 2.5rem;
}

.hero-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 12px;
}

.hero-update-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.hero-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

.icon-button {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-button:hover {
    background: rgba(255, 255, 255, 0.25);
}

.theme-icon-light {
    display: none;
}

html[data-theme='dark'] .theme-icon-light {
    display: block;
}

html[data-theme='dark'] .theme-icon-dark {
    display: none;
}

.lang-button {
    background: var(--blue-600);
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

.lang-button:hover {
    background: var(--blue-500);
}

/* Stats Row */
.stats-row {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.stat-pill {
    flex: 1;
    min-width: 160px;
    padding: 20px 28px;
    border-radius: 16px;
    text-align: center;
    color: white;
}

.stat-purple {
    background: var(--gradient-stat-purple);
}

.stat-blue {
    background: var(--gradient-stat-blue);
}

.stat-violet {
    background: var(--gradient-stat-violet);
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    display: block;
    font-size: 1rem;
    font-weight: 500;
    opacity: 0.9;
}

/* ========= FILTER PANEL ========= */
.filter-panel {
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.filter-form {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.filter-input,
.filter-select {
    min-width: 160px;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.filter-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 1.2em 1.2em;
    padding-right: 40px;
}

.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--purple-500);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.filter-input:hover,
.filter-select:hover {
    border-color: var(--gray-400);
}

.search-group .filter-input {
    min-width: 200px;
}

.filter-actions {
    margin-left: auto;
}

.clear-filters-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    background: var(--blue-600);
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-filters-btn:hover {
    background: var(--blue-500);
}

.btn-icon {
    font-size: 1rem;
}

.filter-summary {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

.total-count {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.total-count strong {
    color: var(--text-primary);
}

/* Layout Toggle */
.layout-toggle-row {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    margin-bottom: 24px;
}

.layout-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.layout-toggle-btn:first-child {
    border-radius: 8px 0 0 8px;
}

.layout-toggle-btn:last-child {
    border-radius: 0 8px 8px 0;
    border-left: none;
}

.layout-toggle-btn:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.layout-toggle-btn.active {
    background: var(--gray-200);
    color: var(--text-primary);
}

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

/* ========= MAIN CONTENT GRID ========= */
.main-content-grid {
    display: grid;
    grid-template-columns: minmax(0, 2.5fr) minmax(280px, 1fr);
    gap: 32px;
}

/* ========= NEWS COLUMN - LIST VIEW (default) ========= */
.news-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ========= NEWS COLUMN - GRID VIEW ========= */
.news-column.layout-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

/* ========= NEWS CARD - BASE ========= */
.news-card {
    background: var(--bg-primary);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: row;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

/* ========= NEWS CARD - LIST VIEW (horizontal) ========= */
.news-column.layout-list .news-card {
    flex-direction: row;
}

.news-column.layout-list .news-card.card-left .news-card-image-wrapper {
    order: 0;
}

.news-column.layout-list .news-card.card-right .news-card-image-wrapper {
    order: 1;
}

.news-column.layout-list .news-card-image-wrapper {
    flex: 0 0 300px;
    min-height: 250px;
}

/* ========= NEWS CARD - GRID VIEW (vertical) ========= */
.news-column.layout-grid .news-card {
    flex-direction: column;
}

.news-column.layout-grid .news-card.card-left .news-card-image-wrapper,
.news-column.layout-grid .news-card.card-right .news-card-image-wrapper {
    order: 0;
}

.news-column.layout-grid .news-card-image-wrapper {
    flex: none;
    height: 180px;
    min-height: 180px;
}

/* Alternating image positions - list view only */
.news-card.card-left .news-card-image-wrapper {
    order: 0;
}

.news-card.card-right .news-card-image-wrapper {
    order: 1;
}

.news-card-image-wrapper {
    flex: 0 0 300px;
    height: auto;
    min-height: 250px;
    overflow: hidden;

}

.news-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    min-height: 250px;
}

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

.news-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.flag-icon {
    font-size: 1rem;
}

.lang-badge {
    background: var(--gray-100);
    color: var(--text-primary);
    padding: 3px 10px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.8rem;
}

.date-meta {
    color: var(--text-secondary);
}

.category-tag {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    margin-bottom: 12px;
    align-self: flex-start;
}

.news-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.news-card-summary {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.7;
    flex-grow: 1;
    margin-bottom: 16px;
}

.news-card-footer {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.source-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--purple-500);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}

.source-link:hover {
    color: var(--purple-600);
}

.no-results-card {
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 60px 40px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.no-results-card p {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.no-results-card p:first-child {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ========= SIDEBAR ========= */
.sidebar-column {
    position: sticky;
    top: 24px;
    align-self: start;
}

.sidebar-widget {
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.sidebar-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.events-widget .sidebar-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 16px;
}

.event-item {
    display: flex;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.event-item:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.event-date {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.event-info {
    flex: 1;
}

.event-name {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 4px;
}

.event-location {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.sidebar-link {
    display: block;
    text-align: center;
    color: var(--purple-500);
    font-weight: 600;
    font-size: 0.95rem;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    transition: color 0.2s;
}

.sidebar-link:hover {
    color: var(--purple-600);
}

/* ========= PAGINATION ========= */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 40px;
    padding: 20px 0;
}

.page-btn,
.page-num {
    padding: 10px 16px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.page-btn:hover,
.page-num:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

.page-num.active {
    background: var(--purple-500);
    color: white;
    border-color: var(--purple-500);
}

.ellipsis {
    padding: 10px 8px;
    color: var(--text-secondary);
}

/* Loading state */
#news-container.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* ========= RESPONSIVE ========= */
@media (max-width: 1200px) {
    .news-card {
        flex-direction: column;
    }

    .news-card.card-right .news-card-image-wrapper {
        order: 0;
    }

    .news-card-image-wrapper {
        flex: none;
        height: 200px;
        min-height: 200px;
    }
}

@media (max-width: 1024px) {
    .main-content-grid {
        grid-template-columns: 1fr;
    }

    .sidebar-column {
        order: -1;
        position: static;
    }
}

@media (max-width: 768px) {
    .page-container {
        padding: 0 16px 32px;
    }

    .hero-header {
        padding: 24px;
        margin: 0 -16px 24px;
    }

    .hero-top-bar {
        flex-direction: column;
        gap: 16px;
    }

    .hero-title {
        font-size: 1.75rem;
    }

    .hero-controls {
        width: 100%;
        justify-content: flex-end;
    }

    .stats-row {
        gap: 12px;
    }

    .stat-pill {
        min-width: 100px;
        padding: 16px 20px;
    }

    .stat-number {
        font-size: 1.75rem;
    }

    .filter-form {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        width: 100%;
    }

    .filter-input,
    .filter-select {
        width: 100%;
    }

    .filter-actions {
        margin-left: 0;
        margin-top: 8px;
    }

    .clear-filters-btn {
        width: 100%;
        justify-content: center;
    }

    .news-card-image-wrapper {
        height: 180px;
        min-height: 180px;
    }
}

@media (max-width: 480px) {
    .stat-pill {
        min-width: 80px;
        padding: 12px 16px;
    }

    .stat-number {
        font-size: 1.5rem;
    }

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

.news-excerpt {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
    /* Removed text truncation as requested */
}

/* ========= NEWS MASONRY CONTAINER & LAYOUTS ========= */
.news-masonry {
    gap: 15px;
}

/* 1. Masonry Layout (CSS Columns) */
.news-masonry.layout-masonry {
    display: block;
    column-count: 3;
    column-gap: 15px;
}

.news-masonry.layout-masonry .news-card-compact {
    break-inside: avoid;
    margin-bottom: 15px;
}

/* 2. Grid Layout (CSS Grid) - Chronological order */
.news-masonry.layout-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    align-items: start;
}

.news-masonry.layout-grid .news-card-compact {
    margin-bottom: 0;
}

/* 3. List Layout (Flex Column) */
.news-masonry.layout-list {
    display: flex;
    flex-direction: column;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* Responsive for news-masonry */
@media (max-width: 1100px) {
    .news-masonry.layout-masonry {
        column-count: 2;
    }

    .news-masonry.layout-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .news-masonry.layout-masonry {
        column-count: 1;
    }

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

/* Related articles section uses 2 columns instead of 3 */
.related-articles-section .news-masonry.layout-masonry {
    column-count: 2;
}

.related-articles-section .news-masonry.layout-grid {
    grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 768px) {
    .related-articles-section .news-masonry.layout-masonry {
        column-count: 1;
    }

    .related-articles-section .news-masonry.layout-grid {
        grid-template-columns: 1fr;
    }
}

/* ========= COMPACT CARD STYLES (Used in JS/PHP Cluster View) ========= */
.news-card-compact {
    background: var(--bg-secondary, #fff);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color, #e5e5e5);
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    break-inside: avoid;
    transition: box-shadow 0.2s;
}

.news-card-compact:hover {
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
}

.news-card-compact.with-image .news-thumb,
.news-card-compact .news-thumb {
    width: 100%;
    height: 220px;
    min-height: 220px;
    overflow: hidden;
    position: relative;
}

.news-card-compact .news-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

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

.news-card-compact .news-body {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
}

/* Meta Row - Single Line */
.news-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    font-size: 0.7em;
    color: #888;
    margin-bottom: 6px;
}

.meta-flag {
    font-size: 1em;
}

.meta-lang {
    background: #eee;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 600;
    font-size: 0.9em;
}

[data-theme="dark"] .meta-lang {
    background: var(--gray-200);
}

.meta-date {
    color: #999;
}

.meta-cat {
    color: #fff;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.85em;
}

/* Card Title */
.news-title {
    font-size: 0.95em;
    line-height: 1.3;
    margin: 0 0 6px 0;
    font-weight: 600;
}

.news-title a {
    color: inherit;
    text-decoration: none;
}

.news-title a:hover {
    color: var(--accent-color, #e63946);
}

/* Card Excerpt */
.news-excerpt {
    font-size: 0.8em;
    color: #666;
    line-height: 1.4;
    margin: 0 0 8px 0;
}

[data-theme="dark"] .news-excerpt {
    color: var(--text-secondary);
}

/* Card Source */
.news-source {
    font-size: 0.75em;
}

.news-source a {
    color: #888;
    text-decoration: none;
}

.news-source a:hover {
    color: var(--accent-color, #e63946);
}

/* Responsive adjust for compact card */
@media (min-width: 769px) {

    /* On Desktop, make it horizontal if in list mode */
    .layout-list .news-card-compact {
        flex-direction: row;
    }

    .layout-list .news-card-compact.with-image .news-thumb {
        flex: 0 0 320px;
        /* Fixed width for image on desktop */
        height: auto;
        min-height: 240px;
    }
}

/* ========= CLUSTER SPECIFIC STYLES ========= */
.cluster-card {
    border: 1px solid var(--purple-500, #8B5CF6);
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(139, 92, 246, 0.1);
}

/* Карточки кластеров с источниками - вертикальный layout на десктопе */
@media (min-width: 769px) {
    .layout-list .cluster-card.has-sources {
        flex-direction: column;
    }

    .layout-list .cluster-card.has-sources .news-thumb {
        flex: none;
        width: 100%;
        height: 280px;
        min-height: 280px;
    }

    .layout-list .cluster-card.has-sources .news-body {
        padding: 20px 24px;
    }
}

.cluster-sources {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color, #eee);
    font-size: 0.8em;
}

.sources-label {
    font-weight: 600;
    color: var(--text-secondary, #666);
    margin-bottom: 6px;
    font-size: 0.8em;
}

.sources-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.source-item {
    margin-bottom: 3px;
}

.source-item:last-child {
    margin-bottom: 0;
}

.source-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-primary, #333);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 5px;
    background: var(--bg-secondary, #f9f9f9);
    transition: background 0.2s;
    border: 1px solid transparent;
    font-size: 0.9em;
}

.source-link:hover {
    background: var(--gray-100, #eee);
    border-color: var(--gray-200, #ddd);
}

.source-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.source-lang-badge {
    background: var(--gray-200, #ddd);
    color: var(--text-secondary, #555);
    font-size: 0.65em;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 600;
}

.source-date {
    margin-left: auto;
    color: var(--text-secondary, #999);
    font-size: 0.85em;
    flex-shrink: 0;
}

.source-arrow {
    color: var(--purple-500, #8B5CF6);
    font-size: 0.9em;
}

/* Mobile Tweaks for sources */
@media (max-width: 480px) {
    .source-link {
        padding: 4px 8px;
        gap: 6px;
        font-size: 0.85rem;
    }

    .source-name {
        max-width: 120px;
    }

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

    .cluster-sources {
        margin-top: 10px;
        font-size: 0.8rem;
    }

    /* Mobile tweaks for cluster badge if needed */
    .news-meta-row {
        flex-wrap: wrap;
        /* Allow wrapping if too tight */
    }
}

/* ========= ARTICLE PAGE ========= */
.article-content-wrapper {
    max-width: 800px;
    margin: 0 auto 60px;
}

/* Breadcrumbs */
.article-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.article-breadcrumbs a {
    color: var(--text-secondary);
    transition: color 0.2s;
}

.article-breadcrumbs a:hover {
    color: var(--purple-500);
}

.breadcrumb-separator {
    color: var(--gray-300);
    font-size: 0.8em;
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 500;
}

/* Article Header */
.article-header {
    margin-bottom: 32px;
}

.article-meta-badges {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.article-h1 {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.article-meta-info {
    display: flex;
    gap: 20px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.article-meta-info span {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Article Lead & Body */
.article-lead {
    font-size: 1.25rem;
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: 32px;
    font-weight: 500;
}

.article-image {
    margin-bottom: 32px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--gray-100);
}

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

.image-caption {
    padding: 8px 12px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
}

.article-body {
    font-size: 1.1rem;
    line-height: 1.8;
}

.content-section {
    margin-bottom: 32px;
}

.content-section h3 {
    font-size: 1.5rem;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.content-section.muted {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    font-size: 1rem;
    color: var(--text-secondary);
}

/* Source Block */
.source-block {
    display: flex;
    gap: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 24px;
    border-radius: 16px;
    margin-bottom: 40px;
    align-items: flex-start;
}

.source-block-icon {
    width: 48px;
    height: 48px;
    background: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--purple-500);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.source-block-content h4 {
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.source-block-content p {
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.btn-outline {
    display: inline-block;
    padding: 10px 20px;
    border: 2px solid var(--purple-500);
    color: var(--purple-500);
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-outline:hover {
    background: var(--purple-500);
    color: white;
}

/* Tags */
.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.tag {
    background: var(--gray-100);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.tag:hover {
    background: var(--purple-500);
    color: white;
}

/* Related Articles */
.related-articles-section {
    padding-top: 40px;
    border-top: 1px solid var(--border-color);
    max-width: 1000px;
    margin: 0 auto;
}

.section-title {
    font-size: 1.75rem;
    margin-bottom: 24px;
    font-weight: 800;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

@media (max-width: 768px) {
    .article-h1 {
        font-size: 1.75rem;
    }

    .article-lead {
        font-size: 1.1rem;
    }

    .source-block {
        flex-direction: column;
        gap: 16px;
    }
}

/* Share Buttons */
.share-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.share-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    transition: transform 0.2s, opacity 0.2s;
}

.share-btn:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

.share-tg {
    background: #0088cc;
}

.share-vk {
    background: #0077ff;
}

.share-wa {
    background: #25D366;
}

/* ========= TELEGRAM WEBAPP STYLES ========= */
/* Note: These styles only apply when site is opened inside Telegram Mini App */

/* Ensure full coverage and no bleed-through */
.telegram-webapp,
.telegram-webapp body {
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    width: 100%;
}

.telegram-webapp body {
    /* Safe area padding for Telegram UI elements */
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
    /* Use existing theme variables, not Telegram colors */
    background-color: var(--bg-secondary);
}

/* Fix main container */
.telegram-webapp main,
.telegram-webapp .page-container {
    position: relative;
    z-index: 1;
}

/* Hide sidebar in Telegram (too narrow) */
.telegram-webapp .sidebar-column {
    display: none !important;
}

.telegram-webapp .main-content-grid {
    display: block;
}

/* Hide some elements in Telegram */
.telegram-webapp .site-header {
    /* Telegram has its own header */
    padding-top: 8px;
}

.telegram-webapp .hero-header {
    /* Smaller hero in Telegram */
    padding: 16px 16px 20px;
    margin: 0 0 16px;
    border-radius: 0 0 12px 12px;
}

.telegram-webapp .hero-title {
    font-size: 1.5rem;
}

.telegram-webapp .hero-subtitle {
    font-size: 0.9rem;
}

/* Compact stats in Telegram */
.telegram-webapp .stats-row {
    gap: 8px;
}

.telegram-webapp .stat-pill {
    padding: 10px 12px;
    min-width: auto;
}

.telegram-webapp .stat-number {
    font-size: 1.5rem;
}

.telegram-webapp .stat-label {
    font-size: 0.8rem;
}

/* Better news cards in narrow view */
.telegram-webapp .news-card {
    margin-bottom: 12px;
    flex-direction: column !important;
}

.telegram-webapp .news-card-image-wrapper {
    flex: none !important;
    height: 180px !important;
    min-height: 180px !important;
    order: 0 !important;
}

.telegram-webapp .news-card-content {
    padding: 16px;
}

.telegram-webapp .btn,
.telegram-webapp button {
    min-height: 44px;
}

/* Hide cookie consent in Telegram (not applicable) */
.telegram-webapp .cookie-consent {
    display: none !important;
}

/* Hide filter panel toggle on very narrow screens */
.telegram-webapp .filter-panel {
    padding: 12px;
}

/* Footer safe area */
.telegram-webapp footer {
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0));
}