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

body {
    background-color: #1a1a1a;
    color: #e0e0e0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
}

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

.header-summary {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    border-bottom: 1px solid #404040;
    position: relative;
}

.logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    margin-right: 15px;
}

.summary {
    flex: 1;
    text-align: center;
    color: #888;
    font-size: 14px;
    margin: 0;
    padding: 0;
}

.search-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto 30px auto;
}

.search-bar {
    width: 100%;
    padding: 12px 85px 12px 16px;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 16px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.search-bar:focus {
    border-color: #007acc;
}

.search-bar::placeholder {
    color: #888;
}

.search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid #555;
    color: #ddd;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.2s, background-color 0.2s;
    line-height: 1;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    user-select: none;
}

.search-clear:hover {
    color: #e0e0e0;
    background-color: #404040;
}

.search-clear:active {
    background-color: #505050;
}

.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-result {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #404040;
    transition: background-color 0.2s;
}

.search-result:hover {
    background: #404040;
}

.search-result:last-child {
    border-bottom: none;
}

.search-result-logo {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    object-fit: cover;
    background: #404040;
    margin-right: 12px;
    flex-shrink: 0;
}

.search-result-title {
    color: #e0e0e0;
    font-size: 14px;
    line-height: 1.4;
    flex: 1;
}

.search-no-results {
    padding: 12px 16px;
    color: #888;
    font-style: italic;
    text-align: center;
}

/* Filter Toggle Button */
.filter-toggle {
    position: absolute;
    right: 45px;
    top: 50%;
    transform: translateY(-50%);
    background: #2d2d2d;
    border: 1px solid #404040;
    color: #e0e0e0;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
    z-index: 10;
    user-select: none;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-toggle:hover {
    border-color: #007acc;
    background: #3d3d3d;
}

.filter-toggle.active {
    background: #007acc;
    border-color: #007acc;
    color: white;
}

/* Category Filter Styles */
.category-filters {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 0 auto 30px auto;
    max-width: 600px;
    flex-wrap: wrap;
}

.category-btn {
    background: #2d2d2d;
    border: 1px solid #404040;
    color: #e0e0e0;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.category-btn:hover {
    border-color: #007acc;
    background: #3d3d3d;
}

.category-btn.active {
    background: #007acc;
    border-color: #007acc;
    color: white;
}

/* View Selector Styles */
.view-selector {
    display: flex;
    justify-content: flex-end;
    margin: 0 auto 20px auto;
    max-width: 1400px;
    padding: 0 20px;
}

.view-toggle {
    background: #2d2d2d;
    border: 1px solid #404040;
    color: #e0e0e0;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
    user-select: none;
}

.view-toggle:hover {
    border-color: #007acc;
    background: #3d3d3d;
}

.view-toggle.active {
    background: #007acc;
    border-color: #007acc;
    color: white;
}

.articles-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 40px;
    width: 100%;
    grid-auto-rows: max-content;
}

@media (max-width: 1200px) {
    .articles-grid {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .articles-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .container {
        padding: 15px;
    }
    .header-summary {
        flex-direction: column;
        text-align: center;
        padding: 10px;
    }
    .logo {
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    /* Mobile article card adjustments for better title display */
    .article-card {
        height: auto;
        min-height: 200px;
        max-height: 280px;
    }
    
    .article-title {
        -webkit-line-clamp: 4;
        line-clamp: 4;
        margin-bottom: 10px;
        flex-shrink: 0; /* Prevent title from shrinking */
    }
    
    .article-description {
        -webkit-line-clamp: 3;
        line-clamp: 3;
        flex: 1;
        overflow: hidden;
    }
}

.article-card {
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 8px;
    padding: 16px;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    height: 230px;
    position: relative;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.article-card:hover {
    border-color: #007acc;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 122, 204, 0.1);
}

.article-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
}

.article-title a {
    color: #e0e0e0;
    text-decoration: none;
}

.article-title a:hover {
    color: #007acc;
}

.article-description {
    color: #b0b0b0;
    font-size: 14px;
    margin-bottom: 12px;
    line-height: 1.4;
    flex-grow: 1;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
}

.article-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #404040;
    font-size: 12px;
    color: #888;
}

.source-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.source-logo {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    object-fit: cover;
    background: #404040;
    transition: all 0.2s ease;
}

.source-logo:hover {
    transform: scale(1.1);
    opacity: 0.8;
    border: 1px solid #007acc;
}

.source-name {
    font-weight: 500;
    color: #ccc;
}

.publish-date {
    color: #888;
    font-size: 11px;
}

/* List View Styles */
.articles-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 40px;
    width: 100%;
    max-width: calc(1400px - 40px); /* Match 3-column grid max width */
    margin-left: auto;
    margin-right: auto;
    overflow: hidden;
    box-sizing: border-box;
}

.article-list-item {
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 8px;
    padding: 12px 16px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.article-list-item:hover {
    border-color: #007acc;
    background: #353535;
}

.article-list-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.article-list-logo:hover {
    transform: scale(1.1);
    opacity: 0.8;
}

.article-list-title {
    flex: 1;
    margin: 0;
    min-width: 0;
}

.article-list-title a {
    color: #e0e0e0;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.article-list-title a:hover {
    color: #007acc;
}

@media (max-width: 768px) {
    .articles-list {
        max-width: 100%;
    }
    
    .article-list-item {
        padding: 10px 12px;
        gap: 10px;
        min-height: auto;
        align-items: flex-start;
    }
    
    .article-list-logo {
        width: 20px;
        height: 20px;
        margin-top: 2px;
    }
    
    .article-list-title a {
        font-size: 13px;
        white-space: normal;
        overflow: visible;
        text-overflow: initial;
        line-height: 1.3;
    }
}

.loading {
    text-align: center;
    padding: 40px;
    color: #888;
}

.lazy-loading {
    text-align: center;
    padding: 20px;
    color: #888;
    margin-top: 20px;
}

.lazy-loading .spinner {
    width: 30px;
    height: 30px;
    margin: 0 auto 10px;
}

.spinner {
    border: 3px solid #404040;
    border-top: 3px solid #007acc;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    background: #441a1a;
    border: 1px solid #664040;
    color: #ff9999;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.no-articles {
    text-align: center;
    padding: 60px 20px;
    color: #888;
    font-size: 16px;
}

.stats {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    background: #2d2d2d;
    border-radius: 8px;
    border: 1px solid #404040;
    color: #888;
    font-size: 14px;
}

.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: #007acc;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 122, 204, 0.3);
}

.scroll-to-top:hover {
    background: #005c99;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 122, 204, 0.4);
}

.scroll-to-top svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* Logo link styling */
.logo-link {
    display: inline-block;
    text-decoration: none;
    transition: opacity 0.2s;
}

.logo-link:hover {
    opacity: 0.8;
}

/* Feeds list styling */
.feeds-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 40px;
}

.feed-item {
    display: flex;
    align-items: center;
    padding: 20px;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 8px;
    transition: all 0.2s;
    cursor: pointer;
}

.feed-item:hover {
    background: #353535;
    border-color: #007acc;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 204, 0.2);
}

.feed-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    margin-right: 20px;
    border-radius: 4px;
    background: #404040;
    padding: 4px;
}

.feed-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.feed-name {
    font-size: 18px;
    font-weight: 600;
    color: #e0e0e0;
    margin: 0;
}

.feed-category {
    font-size: 12px;
    color: #007acc;
    background: rgba(0, 122, 204, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
    width: fit-content;
    font-weight: 500;
}

.feed-url {
    font-size: 14px;
    color: #888;
    text-decoration: none;
    word-break: break-all;
}

.feed-url:hover {
    color: #007acc;
}

.feed-last-update {
    font-size: 14px;
    color: #aaa;
    margin-left: auto;
    text-align: right;
    min-width: 200px;
}

.feed-status {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    margin-top: 4px;
}

.feed-status.active {
    background: #1a441a;
    color: #99ff99;
}

.feed-status.error {
    background: #441a1a;
    color: #ff9999;
}

.feed-status.unknown {
    background: #444;
    color: #aaa;
}

@media (max-width: 768px) {
    .feed-item {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }
    
    .feed-logo {
        margin-right: 0;
        margin-bottom: 15px;
    }
    
    .feed-last-update {
        margin-left: 0;
        text-align: center;
        min-width: auto;
        margin-top: 10px;
    }
}

/* Category breakdown styles for feeds page */
.feeds-breakdown {
    display: flex;
    flex-direction: column;
    gap: 25px;
    margin-bottom: 40px;
}

.category-section {
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s ease;
    margin-bottom: 8px;
}

.category-section:hover {
    border-color: #007acc;
    box-shadow: 0 4px 12px rgba(0, 122, 204, 0.1);
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: linear-gradient(135deg, #353535 0%, #2d2d2d 100%);
    border-bottom: 1px solid #404040;
    transition: background-color 0.2s ease;
}

.category-header:hover {
    background: linear-gradient(135deg, #3d3d3d 0%, #353535 100%);
}

.category-title-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-title {
    font-size: 24px;
    font-weight: 600;
    color: #e0e0e0;
    margin: 0;
    /* Keep original case from environment.json */
}

.category-details {
    display: flex;
    gap: 15px;
    align-items: center;
}

.category-stats {
    font-size: 14px;
    color: #007acc;
    background: rgba(0, 122, 204, 0.1);
    padding: 6px 12px;
    border-radius: 16px;
    font-weight: 500;
}

.category-sources {
    font-size: 14px;
    color: #888;
    font-weight: 400;
}

.collapse-indicator {
    font-size: 18px;
    color: #888;
    transition: transform 0.2s ease, color 0.2s ease;
    user-select: none;
    min-width: 20px;
    text-align: center;
}

.category-header:hover .collapse-indicator {
    color: #007acc;
}

.category-section.collapsed .collapse-indicator {
    transform: rotate(-90deg);
}

.sources-table {
    display: flex;
    flex-direction: column;
}

.table-header {
    display: grid;
    grid-template-columns: 1fr 100px 180px;
    gap: 15px;
    padding: 15px 25px;
    background: #242424;
    border-bottom: 1px solid #404040;
    font-size: 12px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-row {
    display: grid;
    grid-template-columns: 1fr 100px 180px;
    gap: 15px;
    padding: 15px 25px;
    align-items: center;
    border-bottom: 1px solid #333;
    transition: background-color 0.2s ease;
}

.table-row:hover {
    background: #353535;
}

.table-row:last-child {
    border-bottom: none;
}

.col-source {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0; /* Allow text to truncate */
}

.source-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 4px;
    background: #404040;
    padding: 2px;
    flex-shrink: 0; /* Prevent logo from shrinking */
}

.source-name {
    font-size: 16px;
    font-weight: 500;
    color: #e0e0e0;
    word-break: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
}

.col-articles {
    display: flex;
    justify-content: center;
    align-items: center;
}

.article-count {
    font-size: 16px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    min-width: 40px;
    text-align: center;
}

.col-last-update {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.last-update {
    font-size: 14px;
    text-align: right;
}

/* Status color classes */
.status-active {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
}

.status-warning {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.1);
}

.status-error {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}

/* Responsive design for category breakdown */
@media (max-width: 1024px) {
    .table-header,
    .table-row {
        grid-template-columns: 1fr 80px 140px;
        gap: 12px;
        padding: 12px 20px;
    }
    
    .category-header {
        padding: 15px 20px;
    }
    
    .category-title {
        font-size: 20px;
    }
    
    .source-name {
        font-size: 15px;
    }
    
    .source-logo {
        width: 28px;
        height: 28px;
    }
    
    .col-source {
        gap: 10px;
    }
}

@media (max-width: 768px) {
    .category-section {
        border-radius: 8px;
    }
    
    .category-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        padding: 15px;
    }
    
    .category-title-container {
        align-items: center;
        text-align: center;
    }
    
    .category-details {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .category-title {
        font-size: 18px;
    }
    
    .collapse-indicator {
        align-self: center;
        margin-top: 5px;
    }
    
    .table-header {
        display: none; /* Hide header on mobile */
    }
    
    .table-row {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 15px;
        border-bottom: 1px solid #333;
    }
    
    .col-source {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        width: 100%;
        gap: 12px;
    }
    
    .col-source::before {
        content: "Source:";
        font-size: 12px;
        color: #888;
        font-weight: 600;
        text-transform: uppercase;
        min-width: 60px;
    }
    
    .col-articles,
    .col-last-update {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }
    
    .col-articles::before {
        content: "Articles:";
        font-size: 12px;
        color: #888;
        font-weight: 600;
        text-transform: uppercase;
    }
    
    .col-last-update::before {
        content: "Last Article:";
        font-size: 12px;
        color: #888;
        font-weight: 600;
        text-transform: uppercase;
    }
    
    .source-name {
        font-size: 16px;
        flex: 1;
    }
    
    .source-logo {
        width: 28px;
        height: 28px;
    }
    
    .article-count,
    .last-update {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .feeds-breakdown {
        gap: 20px;
    }
    
    .category-header {
        padding: 12px;
    }
    
    .table-row {
        padding: 12px;
    }
}
