/* ==================== CSS Variables ==================== */
:root {
    /* Light Theme Colors - Blue, White, Grey */
    --bg-primary: #f5f7fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e8ecf1;
    --text-primary: #1a1a1a;
    --text-secondary: #4a5568;
    --text-tertiary: #a0aec0;
    --accent-primary: #2563eb;
    --accent-secondary: #1d4ed8;
    --accent-color: #2563eb;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --border-color: #d1d5db;
    --success: #2563eb;
    --warning: #2563eb;
    --danger: #2563eb;
    --info: #2563eb;
    
    /* Category Colors - Blue variations */
    --tech: #2563eb;
    --finance: #1e40af;
    --news: #3b82f6;
    --sports: #60a5fa;
    --science: #1d4ed8;
    --business: #1e3a8a;
    --entertainment: #3b82f6;
    --music: #7c3aed;
    --health: #2563eb;
}

[data-theme="dark"] {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2a2a2a;
    --text-primary: #f5f5f5;
    --text-secondary: #a0a0a0;
    --text-tertiary: #6b7280;
    --accent-primary: #3b82f6;
    --accent-secondary: #2563eb;
    --accent-color: #3b82f6;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
    --border-color: #404040;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background 0.3s ease, color 0.3s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* ==================== Header ==================== */
.header {
    background: var(--bg-secondary);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
}

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

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 2rem;
    color: var(--accent-primary);
    animation: pulse 2s ease-in-out infinite;
}

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

.logo {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--accent-primary);
    letter-spacing: -0.5px;
    margin: 0;
}

.tagline {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.header-controls {
    display: flex;
    gap: 12px;
}

.theme-toggle,
.refresh-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.theme-toggle:hover,
.refresh-btn:hover {
    background: var(--accent-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.refresh-btn:active {
    animation: spin 0.6s ease;
}

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

/* ==================== Breaking News Ticker ==================== */
.ticker-bar {
    display: flex;
    align-items: center;
    background: #2563eb;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 500;
    height: 34px;
    overflow: hidden;
    z-index: 999;
}

.ticker-label {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px 0 16px;
    background: rgba(0,0,0,0.25);
    height: 100%;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.75rem;
}

.ticker-track-wrap {
    flex: 1;
    overflow: hidden;
    height: 100%;
    position: relative;
}

.ticker-track {
    display: flex;
    align-items: center;
    gap: 0;
    height: 100%;
    white-space: nowrap;
    animation: ticker-scroll 40s linear infinite;
    will-change: transform;
}

.ticker-track:hover {
    animation-play-state: paused;
}

.ticker-item {
    display: inline-flex;
    align-items: center;
    padding: 0 28px;
    cursor: pointer;
    opacity: 0.92;
    transition: opacity 0.15s;
}

.ticker-item:hover {
    opacity: 1;
    text-decoration: underline;
}

.ticker-sep {
    color: rgba(255,255,255,0.6);
    padding: 0 4px;
    user-select: none;
}

@keyframes ticker-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* dark mode */
[data-theme="dark"] .ticker-bar {
    background: #1a3a8f;
}

/* ==================== Main Content ==================== */
.main-content {
    flex: 1;
    padding: 2rem 0;
}

.container-with-sidebar {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2rem;
}

.main-area {
    min-width: 0;
}

/* ==================== Control Bar ==================== */
.control-bar {
    margin-bottom: 2rem;
}

.search-box {
    position: relative;
    margin-bottom: 1.5rem;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 1.1rem;
}

.search-input {
    width: 100%;
    padding: 14px 50px 14px 48px;
    border: 2px solid var(--border-color);
    border-radius: 16px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.clear-search {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    display: none;
    transition: all 0.2s ease;
}

.clear-search:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.clear-search.visible {
    display: block;
}

/* ==================== Category Filters ==================== */
.category-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
}

.category-btn {
    padding: 10px 20px;
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

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

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

.category-btn i {
    font-size: 1rem;
}

/* ==================== Stats Bar ==================== */
.stats-bar {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.stat-item i {
    color: var(--accent-primary);
}

.stat-item span {
    font-weight: 600;
    color: var(--text-primary);
}

/* ==================== Trending Sidebar ==================== */
.trending-sidebar {
    position: sticky;
    top: 80px;
    height: fit-content;
    max-height: calc(100vh - 100px);
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white;
    padding: 1.25rem;
    border-radius: 12px 12px 0 0;
}

.sidebar-header h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-header h2 i {
    color: #fbbf24;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.1); }
}

.sidebar-header .trending-period {
    font-size: 0.75rem;
    opacity: 0.9;
    font-weight: 400;
}

.sidebar-loading {
    text-align: center;
    padding: 2rem 1rem;
}

.spinner-small {
    width: 30px;
    height: 30px;
    margin: 0 auto 0.75rem;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.trending-list {
    overflow-y: auto;
    flex: 1;
    padding: 0.75rem;
}

.trending-list::-webkit-scrollbar {
    width: 6px;
}

.trending-list::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

.trending-list::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 3px;
}

.trending-item {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 0.875rem;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    cursor: pointer;
}

.trending-item:hover {
    border-color: var(--accent-primary);
    transform: translateX(4px);
}

.trending-item-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.trending-item-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    flex: 1;
}

.trending-item-count {
    background: var(--accent-primary);
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.trending-item-articles {
    margin-top: 0.5rem;
}

.trending-item-article {
    padding: 0.375rem 0;
    border-top: 1px solid var(--border-color);
}

.trending-item-article:first-child {
    border-top: none;
    padding-top: 0;
}

.trending-item-article a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    display: block;
    line-height: 1.4;
    transition: color 0.2s ease;
}

.trending-item-article a:hover {
    color: var(--accent-primary);
}

.trending-item-meta {
    display: flex;
    gap: 0.375rem;
    margin-top: 0.25rem;
    font-size: 0.7rem;
    color: var(--text-tertiary);
    flex-wrap: wrap;
}

.trending-item-site {
    font-weight: 500;
}

.trending-item-category {
    padding: 0.0625rem 0.375rem;
    background: var(--accent-primary);
    color: white;
    border-radius: 3px;
}

/* ==================== Favorites Sidebar ==================== */
.favorites-sidebar {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    display: flex;
    flex-direction: column;
}

/* ==================== Loading ==================== */
.loading {
    text-align: center;
    padding: 4rem 2rem;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 1rem;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* ==================== Articles Grid ==================== */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    animation: fadeIn 0.6s ease;
}

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

/* ==================== Article Card ==================== */
.article-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: slideUp 0.4s ease;
}

.article-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.article-title {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 8px;
}

.article-summary {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.article-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

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

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

.article-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.add-to-collection-btn {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.article-card:hover .add-to-collection-btn {
    opacity: 1;
}

.category-badge {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.category-badge.Technology { background: #2563eb; color: white; }
.category-badge.Finance { background: #1e40af; color: white; }
.category-badge.General.News,
.category-badge[class*="General"] { background: #3b82f6; color: white; }
.category-badge.Sports { background: #60a5fa; color: white; }
.category-badge.Science { background: #1d4ed8; color: white; }
.category-badge.Business { background: #1e3a8a; color: white; }
.category-badge.Entertainment { background: #3b82f6; color: white; }
.category-badge.Health { background: #2563eb; color: white; }

.article-time {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: 4px;
}

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

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

.article-source {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.article-source i {
    color: var(--accent-primary);
}

.article-link {
    padding: 8px 16px;
    background: var(--accent-primary);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.article-link:hover {
    background: var(--accent-secondary);
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
}

/* ==================== No Results ==================== */
.no-results {
    text-align: center;
    padding: 4rem 2rem;
}

.no-results i {
    font-size: 4rem;
    color: var(--text-tertiary);
    margin-bottom: 1rem;
}

.no-results h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.no-results p {
    color: var(--text-secondary);
}

/* ==================== Footer ==================== */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: 4rem;
    text-align: center;
}

.footer p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.footer-note {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.footer-note i {
    color: var(--accent-primary);
}

/* ==================== Responsive Design ==================== */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    
    .header-content {
        padding: 1rem 0;
    }
    
    .logo {
        font-size: 1.5rem;
    }
    
    .logo-icon {
        font-size: 1.6rem;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .category-filters {
        padding: 8px;
        gap: 8px;
    }
    
    .category-btn {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
    
    .stats-bar {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .main-content {
        padding: 1.5rem 0;
    }
    
    .article-card {
        padding: 1.25rem;
    }
    
    .article-title {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .header-controls {
        gap: 8px;
    }
    
    .theme-toggle,
    .refresh-btn {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }
    
    .search-input {
        padding: 12px 45px 12px 42px;
        font-size: 0.95rem;
    }
    
    .category-filters {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    .category-filters::-webkit-scrollbar {
        height: 4px;
    }
    
    .category-filters::-webkit-scrollbar-thumb {
        background: var(--accent-primary);
        border-radius: 2px;
    }
    
    .container-with-sidebar {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .trending-sidebar {
        position: relative;
        top: 0;
        max-height: 500px;
        order: -1;
    }
    
    .trending-list {
        max-height: 400px;
    }
}

/* ==================== Print Styles ==================== */
@media print {
    .header-controls,
    .control-bar,
    .stats-bar,
    .footer {
        display: none;
    }
    
    .article-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ==================== Collections ====================  */
.collection-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.collection-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.collection-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
    border-color: var(--accent-primary);
}

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

.collection-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.collection-card-title {
    margin: 0;
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    line-height: 1.3;
}

.collection-card-actions {
    display: flex;
    gap: 0.5rem;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.collection-card:hover .collection-card-actions {
    opacity: 1;
}

.collection-card-description {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.6;
    margin-bottom: 1.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 60px;
}

.collection-card-meta {
    display: flex;
    gap: 1.25rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
}

.collection-card-count,
.collection-card-visibility {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-weight: 500;
}

.collection-card-footer {
    display: flex;
    gap: 0.75rem;
    margin-top: auto;
}

.button-sm {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 8px;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.25rem;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

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

/* ==================== Header – New Controls ==================== */
.manage-feeds-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.manage-feeds-btn:hover {
    background: var(--accent-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.view-toggle {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.view-toggle:hover {
    background: var(--accent-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
}

.user-menu:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.user-email {
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 640px) {
    .user-email { display: none; }
    .user-menu { width: 44px; padding: 0; justify-content: center; }
}

/* ==================== Bookmark Button on Cards ==================== */
.bookmark-btn {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.bookmark-btn:hover {
    color: var(--accent-primary);
    background: rgba(37, 99, 235, 0.1);
}

.bookmark-btn.bookmarked {
    color: var(--accent-primary);
}

/* ==================== Suggestions Strip ==================== */
.suggestions-strip {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    animation: fadeInDown 0.3s ease;
}

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

.suggestions-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.suggestions-header i {
    color: var(--accent-primary);
}

.suggestions-dismiss {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.2s;
}

.suggestions-dismiss:hover { color: var(--text-primary); }

.suggestions-cards {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.suggestion-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    padding: 10px 14px;
    flex: 1;
    min-width: 220px;
}

.suggestion-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.suggestion-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-url {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-add-btn {
    padding: 6px 14px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.suggestion-add-btn:hover { background: var(--accent-secondary); }
.suggestion-add-btn:disabled { opacity: 0.7; cursor: not-allowed; }

/* ==================== Top Stories ==================== */
.top-stories {
    margin-bottom: 1.5rem;
    animation: fadeInDown 0.3s ease;
}

.top-stories-header {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.top-stories-header i { color: #f59e0b; }

.top-stories-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.featured-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.1rem;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.featured-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-primary);
}

.featured-category {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent-primary);
}

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

.featured-meta {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: auto;
}

/* ==================== List View ==================== */
.articles-list {
    display: flex !important;
    flex-direction: column;
    gap: 0.5rem;
}

.article-row {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.9rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all 0.2s ease;
    animation: slideUp 0.3s ease;
}

.article-row:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-sm);
}

.article-row .category-badge {
    flex-shrink: 0;
    font-size: 0.7rem;
}

.article-row-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.article-row-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s;
}

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

.article-row-meta {
    font-size: 0.78rem;
    color: var(--text-tertiary);
}

/* ==================== Auth Pages ==================== */
.auth-page {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    min-height: calc(100vh - 80px);
}

.auth-card {
    background: var(--bg-secondary);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--border-color);
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo i {
    font-size: 2.5rem;
    color: var(--accent-primary);
}

.auth-logo h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--accent-primary);
    margin: 0.5rem 0 0.25rem;
}

.auth-logo p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.auth-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    text-align: center;
}

.auth-alert {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: #ef4444;
}

.auth-alert.success {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.auth-field {
    margin-bottom: 1.1rem;
}

.auth-field label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.auth-input-wrap {
    position: relative;
}

.auth-input-wrap i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 0.95rem;
}

.auth-input {
    width: 100%;
    padding: 12px 14px 12px 40px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.auth-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.auth-btn {
    width: 100%;
    padding: 13px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 0.5rem;
}

.auth-btn:hover {
    background: var(--accent-secondary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.auth-switch {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.auth-switch a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-switch a:hover { text-decoration: underline; }

