
/* ============================================
   THEME VARIABLES (Deep Indigo & Slate)
   ============================================ */
:root {
    /* Brand Colors */
    --color-primary: #4f46e5;       /* Indigo-600 */
    --color-primary-hover: #4338ca; /* Indigo-700 */
    --color-primary-light: #e0e7ff; /* Indigo-100 */
    
    /* Backgrounds */
    --bg-body: #fafafa;             /* Slate-50 */
    --bg-card: #ffffff;             /* White */
    --bg-input: #f1f5f9;            /* Slate-100 */
    
    /* Text */
    --text-main: #0f172a;           /* Slate-900 */
    --text-muted: #64748b;          /* Slate-500 */
    --text-inverse: #ffffff;        /* White */
    
    /* Borders */
    --border-color: #e2e8f0;        /* Slate-200 */
    --border-focus: #4f46e5;        /* Indigo-600 */
    
    /* Semantic Colors */
    --accent-success: #059669;      /* Emerald-600 */
    --accent-success-bg: #d1fae5;   /* Emerald-100 */
    --accent-breaking: #dc2626;     /* Red-600 */
    --accent-breaking-bg: #fee2e2;  /* Red-100 */
    --accent-warning: #d97706;      /* Amber-600 */
    --accent-warning-bg: #fef3c7;   /* Amber-100 */
    --accent-info: #0284c7;         /* Sky-600 */
    --accent-info-bg: #e0f2fe;      /* Sky-100 */
}

/* Dark Theme Overrides */
body.dark-theme {
    /* Brand Colors */
    --color-primary: #818cf8;       /* Indigo-400 */
    --color-primary-hover: #a5b4fc; /* Indigo-300 */
    --color-primary-light: #312e81; /* Indigo-900 */
    
    /* Backgrounds */
    --bg-body: #0f172a;             /* Slate-900 */
    --bg-card: #1e293b;             /* Slate-800 */
    --bg-input: #334155;            /* Slate-700 */
    
    /* Text */
    --text-main: #f1f5f9;           /* Slate-100 */
    --text-muted: #94a3b8;          /* Slate-400 */
    --text-inverse: #0f172a;        /* Slate-900 */
    
    /* Borders */
    --border-color: #334155;        /* Slate-700 */
    --border-focus: #818cf8;        /* Indigo-400 */
    
    /* Semantic Colors */
    --accent-success: #34d399;      /* Emerald-400 */
    --accent-success-bg: #064e3b;   /* Emerald-900 */
    --accent-breaking: #f87171;     /* Red-400 */
    --accent-breaking-bg: #7f1d1d;  /* Red-900 */
    --accent-warning: #fbbf24;      /* Amber-400 */
    --accent-warning-bg: #451a03;   /* Amber-950 */
    --accent-info: #38bdf8;         /* Sky-400 */
    --accent-info-bg: #0c4a6e;      /* Sky-900 */
}

/* ============================================
   RESET & BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    text-size-adjust: 100%;
}

html {
    -webkit-tap-highlight-color: transparent;
    color-scheme: light dark;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-main);
    line-height: 1.7; /* Increased for Bangla readability */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    background-color: var(--bg-body);
    background-size: 50px 50px;
    letter-spacing: -0.011em;
    /* transition: background-color 0.3s ease, color 0.3s ease; */
    background-image:
        linear-gradient(0deg, transparent 24%, rgba(79, 70, 229, .03) 25%, rgba(79, 70, 229, .03) 26%, transparent 27%, transparent 74%, rgba(79, 70, 229, .03) 75%, rgba(79, 70, 229, .03) 76%, transparent 77%, transparent),
        linear-gradient(90deg, transparent 24%, rgba(79, 70, 229, .03) 25%, rgba(79, 70, 229, .03) 26%, transparent 27%, transparent 74%, rgba(79, 70, 229, .03) 75%, rgba(79, 70, 229, .03) 76%, transparent 77%, transparent);
}

/* Subtle grid pattern using theme colors */

    

body.dark-theme {
    background-image:
        linear-gradient(0deg, transparent 24%, rgba(255, 255, 255, .01) 25%, rgba(255, 255, 255, .01) 26%, transparent 27%, transparent 74%, rgba(255, 255, 255, .01) 75%, rgba(255, 255, 255, .01) 76%, transparent 77%, transparent),
        linear-gradient(90deg, transparent 24%, rgba(255, 255, 255, .01) 25%, rgba(255, 255, 255, .01) 26%, transparent 27%, transparent 74%, rgba(255, 255, 255, .01) 75%, rgba(255, 255, 255, .01) 76%, transparent 77%, transparent);
}

/* ============================================
   LAYOUT & CONTAINER
   ============================================ */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* ============================================
   NAVIGATION
   ============================================ */
.navbar {
    background-color: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid var(--border-color);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
    /* transition: background-color 0.3s ease, border-color 0.3s ease; */
}

body.dark-theme .navbar {
    background-color: rgba(30, 41, 59, 0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.navbar-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    padding: 0 24px;
    height: 60px;
    gap: 16px;
}

.logo {
    font-weight: 700;
    font-size: 20px;
    color: var(--color-primary);;
    text-decoration: none;
    letter-spacing: -0.5px;
    white-space: nowrap;
}

.nav-tabs {
    display: flex;
    gap: 8px;
    flex: 1;
}

.nav-tab {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 4px;
    /* transition: all 0.2s ease; */
    cursor: pointer;
    white-space: nowrap;
}

.nav-tab:hover {
    color: var(--text-main);
    background-color: var(--bg-input);
}

.nav-tab.active {
    color: var(--text-inverse);
    background-color: var(--color-primary);
}

/* ============================================
   NAV BUTTONS (Filter, Lang, Theme)
   ============================================ */

.filter-button,
.lang-toggle,
.theme-toggle {
    padding: 8px 12px;
    background-color: var(--bg-input);
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
    /* transition: all 0.2s ease; */
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    gap: 6px;
    white-space: nowrap;
}

.filter-button:hover,
.lang-toggle:hover,
.theme-toggle:hover {
    background-color: var(--border-color);
    transform: scale(1.05);
}

.filter-button.active {
    background-color: var(--color-primary);
    color: var(--text-inverse);
    border-color: var(--color-primary);
}

.filter-button {
    color: var(--color-primary);
}


/* ============================================
   FILTER PANEL
   ============================================ */
.filter-panel {
    max-width: 1200px;
    margin: 0 auto;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: none;
    /* transition: background-color 0.3s ease, border-color 0.3s ease; */
}

.filter-panel.open {
    display: block;
    animation: slideDown 0.3s ease;
}

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

.filter-panel-inner {
    padding: 20px 24px;
    max-height: 500px;
    overflow-y: auto;
}

.filter-section {
    margin-bottom: 20px;
}

.filter-section:last-child {
    margin-bottom: 0;
}

.filter-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 12px;
    display: block;
}

.source-lang-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    background-color: var(--bg-input);
    padding: 4px;
    border-radius: 5px;
    width: fit-content;
}

.source-lang-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 4px;
    background-color: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    /* transition: all 0.2s ease; */
}

.source-lang-btn:hover {
    color: var(--text-main);
}

.source-lang-btn.active {
    background-color: var(--bg-card);
    color: var(--color-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.source-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.source-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.source-checkbox:hover {
    background-color: var(--border-color);
    border-color: var(--text-muted);
}

.source-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--color-primary);
}

.source-checkbox label {
    font-size: 14px;
    color: var(--text-main);
    cursor: pointer;
    flex: 1;
}

.filter-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.filter-actions button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.apply-filters {
    background-color: var(--color-primary);
    color: var(--text-inverse);
}

.apply-filters:hover {
    background-color: var(--color-primary-hover);
}

.clear-filters {
    background-color: var(--bg-input);
    color: var(--text-muted);
}

.clear-filters:hover {
    background-color: var(--border-color);
    color: var(--text-main);
}

.active-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background-color: var(--color-primary-light);
    color: var(--color-primary);
    border-radius: 3px;
    font-size: 13px;
    font-weight: 500;
}

.filter-tag button {
    background: none;
    border: none;
    color: var(--color-primary);
    cursor: pointer;
    padding: 0;
    font-size: 16px;
    line-height: 1;
}

/* ============================================
   NEWS GRID & CARDS
   ============================================ */
.news-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 18px;
    padding: 0;
    background-color: transparent;
    box-shadow: none;
}

.news-item {
    background-color: var(--bg-card);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.news-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    border-color: var(--color-primary);
}

body.dark-theme .news-item:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}



.news-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}


/* Language Badges */
.source-lang-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 2px;
    text-transform: uppercase;
}

.source-lang-badge.bangla {
    background: var(--accent-info-bg);
    color: var(--accent-info);
}

.source-lang-badge.english {
    background: var(--accent-success-bg);
    color: var(--accent-success);
}

/* Recency Badges */
.recency-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    margin-left: auto;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.recency-badge.breaking {
    background: var(--accent-breaking-bg);
    color: var(--accent-breaking);
    animation: pulse 2s ease-in-out infinite;
}

.nav-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--color-primary);
    border-radius: 1.5px 1.5px 0 0;
}

.recency-badge.new {
    background: var(--accent-warning-bg);
    color: var(--accent-warning);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Content Area */
.news-content {
    padding: 10px 20px 20px 20px; /* Increased from 16px */
    display: flex;
    flex-direction: column;
    flex: 1;
}

.news-title {
    font-size: 16px;
    line-height: 1.5; /* Tighter for English, adequate for Bangla */
    font-weight: 600;
    margin: 0;
}

/* Specific adjustment for Bangla titles if needed via JS class */
.news-title.bn {
    line-height: 1.7;
    font-weight: 500;
}

.news-title a {
    color: var(--text-main);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

.news-excerpt {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-muted);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}


.news-date {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

.date-icon {
    font-size: 13px;
}

.category-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg-input);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}

.category-icon {
    font-size: 14px;
}

/* ============================================
   STATES (Loading, Error, Empty)
   ============================================ */
.loading {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.loading::after {
    content: '';
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 12px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error,
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background-color: var(--bg-card);
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
}

.error h3 {
    color: var(--accent-breaking);
    margin-bottom: 8px;
    font-size: 18px;
}

.error p,
.empty-state p {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

.empty-state h3 {
    margin-bottom: 8px;
    color: var(--text-main);
    font-size: 18px;
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    margin-top: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.pagination button {
    padding: 10px 20px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
    transition: all 0.2s ease;
}

.pagination button:hover:not(:disabled) {
    background-color: var(--color-primary);
    color: var(--text-inverse);
    border-color: var(--color-primary);
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-info {
    padding: 0 12px;
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .navbar-content {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 16px;
        gap: 12px;
    }

    .logo {
        font-size: 18px;
        order: 1;
    }

    .filter-button {
        font-size: 13px;
        padding: 6px 12px;
        order: 2;
        margin-left: auto;
    }

    .lang-toggle,
    .theme-toggle {
        order: 3;
        padding: 6px 10px;
        font-size: 16px;
        min-width: 40px;
    }

    .nav-tabs {
        order: 4;
        width: 100%;
        gap: 6px;
        flex: 1 1 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        white-space: nowrap;
        padding-bottom: 4px;
    }

    .nav-tabs::-webkit-scrollbar {
        display: none;
    }

    .nav-tab {
        flex-shrink: 0;
        font-size: 13px;
        padding: 6px 12px;
    }

    .filter-panel-inner {
        padding: 16px;
        max-height: 70vh;
    }

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

    .source-lang-toggle {
        width: 100%;
    }

    .source-lang-btn {
        flex: 1;
    }

    .container {
        padding: 20px 16px;
    }

    .news-list {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .news-item {
        padding: 0; /* Reset padding for card layout */
    }

    .news-title {
        font-size: 15px;
    }

    .news-meta {
        font-size: 12px;
    }

    .pagination button {
        padding: 8px 16px;
        font-size: 13px;
    }

    .filter-actions {
        flex-direction: column;
    }

    .filter-actions button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .navbar-content {
        padding: 10px 12px;
        gap: 10px;
    }

    .logo {
        font-size: 16px;
    }

    .filter-button {
        font-size: 12px;
        padding: 5px 10px;
    }

    .lang-toggle,
    .theme-toggle {
        padding: 5px 8px;
        font-size: 15px;
        min-width: 36px;
    }

    .nav-tab {
        padding: 5px 8px;
        font-size: 12px;
    }

    .filter-panel-inner {
        padding: 12px;
        max-height: 65vh;
    }

    .container {
        padding: 16px 12px;
    }

    .news-list {
        gap: 18px;
    }

    .news-item {
        border-radius: 4px;
    }

    .news-card-header {
        padding: 10px 12px 8px 12px;
    }

    .news-content {
        padding: 5px 20px 12px 20px;;
        gap: 5px;
    }

    .news-title {
        font-size: 15px;
    }

    .news-excerpt {
        font-size: 12px;
    }
}

/* ============================================
   UTILITIES
   ============================================ */
.source-favicon {
    width: 16px;
    height: 16px;
    border-radius: 1.5px;
}

.preview-header {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
}

.preview-header .source-favicon {
    width: 16px;
    height: 16px;
    border-radius: 1.5px;
    margin-top: 2px;
    flex-shrink: 0;
}

.preview-title {
    flex: 1;
}

/* Link Preview Tooltip */
.link-preview-tooltip {
    position: absolute;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-width: 300px;
    z-index: 1000;
    pointer-events: none;
    display: none;
}

.link-preview-tooltip.active {
    display: block;
}


/* ============================================
   NEWS GRID & CARDS (Updated for Spacious Layout)
   ============================================ */
.news-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 18px; /* Increased from 20px */
    padding: 0;
    background-color: transparent;
    box-shadow: none;
}

.news-item {
    background-color: var(--bg-card);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    /* transition: all 0.2s ease; */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 20; /* Reset - padding handled by inner sections */
}

.news-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    border-color: var(--color-primary);
}

body.dark-theme .news-item:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* Card Header - More Spacious */
.news-card-header {
    display: flex;
    align-items: center;
    gap: 12px; /* Increased from 10px */
    padding: 16px 20px; /* Increased from 14px 16px 12px 16px */
    /* border-bottom: 1px solid var(--border-color); */
}

.news-source-favicon {
    width: 24px; /* Increased from 24px */
    height: 24px; /* Increased from 24px */
    border-radius: 3px;
    flex-shrink: 0;
    background-color: var(--bg-input);
}

.news-card-meta {
    display: flex;
    align-items: center;
    gap: 8px; /* Increased from 8px */
    flex: 1;
}

.news-source-name {
    font-size: 13px; /* Increased from 13px */
    font-weight: 600;
    color: var(--color-primary);
}


/* Recency Badges */
.recency-badge {
    font-size: 12px; /* Increased from 11px */
    font-weight: 700;
    padding: 4px 10px; /* Increased from 3px 8px */
    border-radius: 6px;
    margin-left: auto;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Content Area - More Spacious */


.news-title {
    font-size: 17px; /* Increased from 16px */
    line-height: 1.6; /* Increased from 1.5 */
    font-weight: 600;
    margin: 0;
}

/* Bangla Title Adjustment */
.news-title.bn {
    line-height: 1.8; /* Increased from 1.7 */
    font-weight: 500;
}

.news-title a {
    color: var(--text-main);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

.news-excerpt {
    font-size: 14px; /* Increased from 13px */
    line-height: 1.7; /* Increased from 1.6 */
    color: var(--text-muted);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Footer - More Spacious */
.news-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 16px; /* Increased from 12px */
    /* border-top: 1px solid var(--border-color); */
}

.date-icon {
    font-size: 14px; /* Increased from 13px */
}


.category-icon {
    font-size: 15px; /* Increased from 14px */
}


/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-body);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* Logo Animation - Works for both IMG and SVG */
.logo-animated {
    width: 80px;
    height: 80px;
    object-fit: contain; /* For IMG */
    animation: breathe 2s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.08);
        opacity: 0.85;
    }
}

/* Loading Text */
.loading-text {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
    animation: fadeInOut 1.5s ease-in-out infinite;
    margin: 0;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .logo-animated,
    .loading-text {
        animation: none !important;
    }
    
    .logo-animated {
        opacity: 1;
    }
}


/* ============================================
   NEWS SKELETON LOADER
   ============================================ */

.skeleton-news-item {
    opacity: 0;
    animation: skeletonFadeIn 0.3s ease forwards;
    pointer-events: none;
    user-select: none;
}

@keyframes skeletonFadeIn {
    to {
        opacity: 1;
    }
}

.skeleton {
    background: linear-gradient(
        90deg,
        #e5e7eb 0%,
        #d1d5db 50%,
        #e5e7eb 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Skeleton elements for news cards */
.skeleton-favicon {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    flex-shrink: 0;
}

.skeleton-source-name {
    height: 14px;
    width: 120px;
}

.skeleton-badge {
    height: 20px;
    width: 60px;
    border-radius: 12px;
}

.skeleton-title-wrapper {
    margin-bottom: 12px;
}

.skeleton-title-line {
    height: 18px;
    width: 100%;
    margin-bottom: 6px;
}

.skeleton-title-line-short {
    height: 18px;
    width: 70%;
}

.skeleton-excerpt-wrapper {
    margin-bottom: 12px;
}

.skeleton-excerpt-line {
    height: 14px;
    width: 100%;
    margin-bottom: 6px;
}

.skeleton-date {
    height: 14px;
    width: 100px;
}

.skeleton-category-badge {
    height: 22px;
    width: 80px;
    border-radius: 12px;
}

/* Dark theme adjustments */
body.dark-theme .skeleton {
    background: linear-gradient(
        90deg,
        #1e293b 0%,
        #334155 50%,
        #1e293b 100%
    );
    background-size: 200% 100%;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
    .skeleton {
        animation: none;
        background: #d1d5db;
        opacity: 0.5;
    }
    
    body.dark-theme .skeleton {
        background: #334155;
    }
    
    .skeleton-news-item {
        animation: none;
        opacity: 1;
    }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .skeleton-title-line {
        height: 16px;
    }
    
    .skeleton-title-line-short {
        width: 80%;
    }
    
    .skeleton-excerpt-line {
        height: 13px;
    }
}


/* Source filter checkbox with logo */
.source-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.source-checkbox:hover {
    background: var(--bg-secondary);
    border-color: var(--color-primary);
}

.source-checkbox input[type="checkbox"] {
    flex-shrink: 0;
    cursor: pointer;
    width: 18px;
    height: 18px;
    margin: 0;
}

.source-checkbox label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    flex: 1;
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
}

/* Favicon with fallback background */
.source-filter-favicon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    border-radius: 4px;
    object-fit: contain;
    background: var(--bg-secondary);
    padding: 2px;
}

/* Fallback placeholder */
.source-filter-placeholder {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.source-name {
    flex: 1;
}

/* Checked state */
.source-checkbox input[type="checkbox"]:checked + label {
    color: var(--color-primary);
    font-weight: 600;
}

.source-checkbox input[type="checkbox"]:checked + label .source-filter-favicon {
    opacity: 1;
    border: 1px solid var(--color-primary);
}

.source-checkbox input[type="checkbox"]:not(:checked) + label .source-filter-favicon {
    opacity: 0.7;
}

/* Active/selected state */
.source-checkbox:has(input:checked) {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
}

/* Hover effect */
@media (hover: hover) and (pointer: fine) {
    .source-checkbox:hover {
        background: var(--bg-secondary);
    }
    
    .source-checkbox:has(input:checked):hover {
        background: var(--color-primary-light);
    }
}