/* RSS Feed Aggregator - Main Styles */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    line-height: 1.6;
    color: #1f2937;
    background: #f9fafb;
    font-size: 15px;
}

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

/* Header */
.header {
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 0;
    background: #ffffff;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

.logo {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
}

.header-nav {
    display: flex;
    gap: 24px;
    align-items: center;
}

.nav-link {
    font-size: 14px;
    color: #4b5563;
    text-decoration: none;
    padding: 8px 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    cursor: pointer;
}

.nav-link:hover {
    color: #1f2937;
}

.nav-link.active {
    color: #1f2937;
    border-bottom-color: #1f2937;
}

.header-meta {
    font-size: 13px;
    color: #6b7280;
}

/* Category Dropdown */
.category-dropdown {
    position: relative;
    display: inline-block;
}

.category-dropdown-toggle {
    font-size: 14px;
    color: #4b5563;
    text-decoration: none;
    padding: 8px 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    cursor: pointer;
    background: none;
    border: none;
    display: flex;
    align-items: center;
    gap: 4px;
}

.category-dropdown-toggle:hover {
    color: #1f2937;
}

.category-dropdown-toggle.active {
    color: #1f2937;
    border-bottom-color: #1f2937;
}

.category-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 240px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    z-index: 1000;
    margin-top: 8px;
}

.category-dropdown.open .category-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.category-dropdown-menu a {
    display: block;
    padding: 10px 16px;
    color: #374151;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.15s ease;
    border-radius: 4px;
    margin: 4px;
}

.category-dropdown-menu a:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.category-dropdown-menu a:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.category-dropdown-menu a:last-child {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.dropdown-arrow {
    width: 12px;
    height: 12px;
    transition: transform 0.2s ease;
}

.category-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

/* Search Bar */
.search-section {
    padding: 20px 0;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

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

.search-input {
    width: 100%;
    padding: 12px 16px 12px 40px;
    font-size: 15px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #ffffff;
    color: #1f2937;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-input::placeholder {
    color: #9ca3af;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    font-size: 16px;
}

.search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    max-height: 300px;
    overflow-y: auto;
    z-index: 50;
    display: none;
}

.search-result {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

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

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

.search-result-title {
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 2px;
}

.search-result-meta {
    font-size: 12px;
    color: #6b7280;
}

/* Main Layout */
.main {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 32px;
    padding: 32px 0;
    max-width: 1400px;
    margin: 0 auto;
}

/* Sidebar */
.sidebar {
    position: sticky;
    top: 140px;
    height: calc(100vh - 160px);
    max-height: calc(100vh - 160px);
    overflow-y: auto;
}

.sidebar-section {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.sidebar-header {
    padding: 16px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
}

.source-groups {
    padding: 16px;
    max-height: calc(100vh - 240px);
    overflow-y: auto;
}

/* Scrollbar styling */
.source-groups::-webkit-scrollbar {
    width: 6px;
}

.source-groups::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.source-groups::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.source-groups::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.source-group {
    margin-bottom: 24px;
}

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

.group-title {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 12px;
}

.source-list {
    list-style: none;
}

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

.source-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    font-size: 13px;
    color: #374151;
    text-decoration: none;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.source-link:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.source-link.active {
    background: #e2e8f0;
    color: #334155;
    font-weight: 500;
}

.source-count {
    color: #6b7280;
    font-size: 11px;
    font-weight: 500;
    background: #f1f5f9;
    padding: 3px 8px;
    border-radius: 12px;
}

.source-link.active .source-count {
    background: #cbd5e1;
    color: #475569;
}

/* Feed Content */
.feed-content {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    min-height: 600px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.feed-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
    border-radius: 12px 12px 0 0;
}

.feed-title {
    font-size: 24px;
    font-weight: 600;
    color: #111827;
}

.feed-meta {
    font-size: 14px;
    color: #6b7280;
}

/* Article List */
.articles {
    list-style: none;
    padding: 0;
}

.article {
    padding: 24px 32px;
    border-bottom: 1px solid #f1f5f9;
}

.article:last-child {
    border-bottom: none;
}

.article:hover {
    background: #fafbfc;
}

.article-header {
    margin-bottom: 12px;
}

.article-title {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 8px;
}

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

.article-title a:hover {
    text-decoration: underline;
}

.article-meta {
    font-size: 13px;
    color: #6b7280;
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.article-source {
    font-weight: 500;
    color: #5b82c4;
    background: #f0f4ff;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 12px;
}

.article-time {
    color: #9ca3af;
    font-size: 12px;
}

.reading-time {
    color: #9ca3af;
    font-size: 12px;
}

.content-badge {
    background: #e2e8f0;
    color: #475569;
    font-size: 10px;
    padding: 3px 6px;
    border-radius: 4px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.article-excerpt {
    font-size: 15px;
    color: #4b5563;
    line-height: 1.6;
    margin-top: 12px;
}

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 48px;
    color: #6b7280;
    font-style: italic;
}

.error {
    color: #dc2626;
    background: #fef2f2;
    padding: 16px 20px;
    border-radius: 8px;
    border: 1px solid #fecaca;
    margin: 16px 0;
    font-size: 14px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    .main {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 20px 0;
    }

    .sidebar {
        position: static;
        order: 2;
    }

    .feed-content {
        order: 1;
    }

    .article {
        padding: 20px;
    }

    .feed-header {
        padding: 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .feed-title {
        font-size: 20px;
    }

    .search-container {
        max-width: 100%;
    }

    .header-nav {
        gap: 16px;
    }

    .category-dropdown-menu {
        min-width: 200px;
        right: 0;
        left: auto;
    }
}