/* News Feed Page - Using Design System Tokens */

.news-feed-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-4) var(--space-6);
    font-family: var(--font-body);
}

/* Compact Header */
.feed-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
}

.feed-title-group {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.feed-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
    margin: 0;
}

.freshness-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    background: var(--color-surface-alt);
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
}

.freshness-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-signal-success);
    animation: pulse 2s ease-in-out infinite;
}

.freshness-indicator.stale .freshness-dot {
    background: var(--color-signal-warning);
    animation: none;
}

.freshness-indicator.offline .freshness-dot {
    background: var(--color-text-tertiary);
    animation: none;
}

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

.freshness-text {
    white-space: nowrap;
}

.feed-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* Search Input */
.feed-search {
    flex: 1;
    max-width: 400px;
    margin: 0 var(--space-4);
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: var(--space-3);
    width: 16px;
    height: 16px;
    color: var(--color-text-tertiary);
    pointer-events: none;
}

.news-search-input {
    width: 100%;
    padding: var(--space-2) var(--space-3) var(--space-2) var(--space-8);
    font-family: var(--font-body);
    font-size: var(--font-size-sm);
    color: var(--color-text);
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    outline: none;
    transition: all 0.2s;
}

.news-search-input::placeholder {
    color: var(--color-text-tertiary);
}

.news-search-input:focus {
    border-color: var(--color-accent);
    background: var(--color-surface);
    box-shadow: 0 0 0 3px var(--color-interactive-primary-subtle);
}

.clear-search-btn {
    position: absolute;
    right: var(--space-2);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--color-text-tertiary);
    cursor: pointer;
    transition: all 0.2s;
}

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

.clear-search-btn svg {
    width: 14px;
    height: 14px;
}

/* No Results State */
.no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-12);
    text-align: center;
    color: var(--color-text-tertiary);
}

.no-results-icon {
    width: 48px;
    height: 48px;
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.no-results p {
    margin: 0 0 var(--space-4) 0;
    font-family: var(--font-body);
    font-size: var(--font-size-sm);
}

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

.clear-filter-btn {
    padding: var(--space-2) var(--space-3);
    font-family: var(--font-body);
    font-size: var(--font-size-sm);
    color: var(--color-accent);
    background: transparent;
    border: 1px solid var(--color-accent);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.clear-filter-btn:hover {
    background: var(--color-interactive-primary-subtle);
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--color-surface-alt);
    color: var(--color-text);
    border-color: var(--color-accent);
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

/* Category Tabs */
.category-tabs {
    display: flex;
    gap: var(--space-1);
    margin-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-border);
    padding-bottom: var(--space-3);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-btn {
    padding: var(--space-2) var(--space-3);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    font-family: var(--font-body);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: var(--color-surface-alt);
    color: var(--color-text);
}

.tab-btn.active {
    background: var(--color-interactive-primary-subtle);
    color: var(--color-accent);
}

/* News List */
.news-list {
    display: flex;
    flex-direction: column;
}

/* News Row */
.news-row {
    display: grid;
    grid-template-columns: 70px auto 1fr auto;
    align-items: baseline;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--color-border);
    transition: background 0.2s;
}

.news-row:hover {
    background: var(--color-surface-alt);
    margin: 0 calc(-1 * var(--space-3));
    padding-left: var(--space-3);
    padding-right: var(--space-3);
}

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

/* Timestamp */
.news-time {
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    color: var(--color-text-tertiary);
    white-space: nowrap;
}

/* Ticker Badge */
.news-ticker {
    font-family: var(--font-mono);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    padding: var(--space-1) var(--space-2);
    background: var(--color-surface-tertiary);
    color: var(--color-text-muted);
    border-radius: var(--radius-sm);
    text-decoration: none;
    white-space: nowrap;
    min-width: 48px;
    text-align: center;
    transition: all 0.2s;
}

.news-ticker:hover {
    background: var(--color-accent);
    color: var(--color-accent-contrast);
}

.news-ticker.empty {
    visibility: hidden;
}

/* Headline */
.news-headline {
    font-family: var(--font-body);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-normal);
    color: var(--color-text);
    line-height: var(--lh-body);
    overflow: hidden;
    text-overflow: ellipsis;
}

.news-headline a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

.news-headline a:hover {
    color: var(--color-accent);
}

.news-headline .link-icon {
    display: inline-block;
    margin-left: var(--space-1);
    opacity: 0;
    transition: opacity 0.2s;
}

.news-row:hover .news-headline .link-icon {
    opacity: 1;
}

.news-headline .link-icon svg {
    width: 14px;
    height: 14px;
    vertical-align: middle;
    color: var(--color-text-tertiary);
}

/* Source Label */
.news-source {
    font-family: var(--font-body);
    font-size: var(--font-size-sm);
    color: var(--color-text-tertiary);
    white-space: nowrap;
    text-align: right;
}

/* Loading State */
.news-loading {
    display: flex;
    justify-content: center;
    padding: var(--space-8);
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
}

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

/* Load More */
.load-more {
    display: flex;
    justify-content: center;
    padding: var(--space-6) 0;
}

.load-more-btn {
    padding: var(--space-2) var(--space-4);
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    font-family: var(--font-body);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.load-more-btn:hover {
    background: var(--color-surface-alt);
    color: var(--color-text);
    border-color: var(--color-accent);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-12);
    color: var(--color-text-tertiary);
    font-family: var(--font-body);
    font-size: var(--font-size-sm);
}

.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .news-feed-page {
        padding: var(--space-3);
    }

    .feed-header {
        flex-wrap: wrap;
        gap: var(--space-3);
    }
    
    .feed-title-group {
        flex: 0 0 auto;
    }
    
    .feed-search {
        order: 3;
        flex: 1 1 100%;
        max-width: none;
        margin: 0;
    }

    .feed-actions {
        flex: 1;
        justify-content: flex-end;
    }

    .news-row {
        grid-template-columns: 60px 1fr;
        grid-template-rows: auto auto;
        gap: var(--space-1) var(--space-2);
    }

    .news-time {
        grid-column: 1;
        grid-row: 1;
    }

    .news-ticker {
        grid-column: 1;
        grid-row: 2;
        justify-self: start;
    }

    .news-ticker.empty {
        display: none;
    }

    .news-headline {
        grid-column: 2;
        grid-row: 1 / 3;
    }

    .news-source {
        display: none;
    }
}

@media (max-width: 480px) {
    .category-tabs {
        gap: 0;
    }

    .tab-btn {
        padding: var(--space-2);
        font-size: var(--font-size-xs);
    }
}
