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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

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

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

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

.logo i {
    font-size: 2rem;
    color: #10b981;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #10b981, #059669);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-stats {
    display: flex;
    gap: 2rem;
}

.mobile-filter-toggle {
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-filter-toggle:hover {
    background: #059669;
    transform: translateY(-1px);
}

.mobile-filter-toggle i {
    font-size: 1rem;
}

/* Hide mobile sidebar on desktop */
.mobile-sidebar-overlay {
    display: none;
}

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
}

.stat-label {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

/* Main Content */
.main {
    padding: 2rem 0;
}

.content-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    align-items: start;
}

/* Sidebar */
.sidebar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 100px;
}

.filter-section h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
}

.filter-section h3 i {
    color: #10b981;
}

.filter-group {
    margin-bottom: 1.5rem;
}

.filter-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
}

.search-box {
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    background: white;
}

.search-box input:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.search-box i {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.875rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

select:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Dropdown Filter Styles */
.dropdown-filter {
    position: relative;
    width: 100%;
}

.dropdown-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    min-height: 48px;
}

.dropdown-trigger:hover {
    border-color: #10b981;
}

.dropdown-trigger.active {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.dropdown-text {
    flex: 1;
    text-align: left;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-arrow {
    color: #9ca3af;
    transition: transform 0.2s ease;
    margin-left: 0.5rem;
}

.dropdown-trigger.active .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 200px;
    overflow: hidden;
    display: none;
}

.dropdown-menu.active {
    display: block;
}

.dropdown-search {
    padding: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.dropdown-search input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.875rem;
    background: white;
}

.dropdown-search input:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.1);
}

.dropdown-options {
    max-height: 150px;
    overflow-y: auto;
}

.dropdown-option {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 0.875rem;
    color: #374151;
}

.dropdown-option:hover {
    background-color: #f3f4f6;
}

.dropdown-option.selected {
    background-color: #e0f2fe;
    color: #0369a1;
}

.dropdown-option input[type="checkbox"] {
    margin-right: 0.5rem;
    accent-color: #10b981;
}

.dropdown-option label {
    cursor: pointer;
    flex: 1;
    margin: 0;
    font-weight: normal;
}

/* Selected items display */
.dropdown-text.has-selections {
    color: #10b981;
    font-weight: 500;
}

.dropdown-text.has-selections::after {
    content: " selected";
    color: #6b7280;
    font-weight: normal;
    font-size: 0.75rem;
}

.clear-filters-btn {
    width: 100%;
    padding: 0.75rem;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.clear-filters-btn:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* Articles Section */
.articles-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.articles-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.articles-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sort-controls label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #4b5563;
    margin: 0;
    white-space: nowrap;
}

.sort-controls select {
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    background-color: white;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.sort-controls select:hover {
    border-color: #9ca3af;
}

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


/* Loading State */
.loading {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #10b981;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* No Results */
.no-results {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}

.no-results i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #d1d5db;
}

.no-results h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: #374151;
}

/* Articles Grid */
.articles-container.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1rem;
}


/* Article Card */
.article-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 2px solid #e5e7eb;
    transition: all 0.2s ease;
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
}

.card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    width: 100%;
    height: 100%;
}

.article-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: #10b981;
}

.article-card:hover .article-image {
    opacity: 0.50;
}

/* Article Image Background */
.article-image {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    opacity: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 12px;
    transition: opacity 0.3s ease;
    /* Fallback white background for failed images */
    background-color: white;
}

.article-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.6) 100%);
    border-radius: 12px;
    z-index: 2;
}

.article-content {
    position: relative;
    z-index: 3;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}


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

.metadata-and-topics {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f3f4f6;
    gap: 1rem;
}

.company-metadata {
    flex: 1;
    min-width: 0;
}

.company-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.company-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    margin: 0;
}

.ticker {
    font-size: 0.75rem;
    color: #9ca3af;
    font-weight: 400;
    margin: 0;
}

.article-id {
    font-size: 0.7rem;
    color: #d1d5db;
    font-weight: 400;
    margin: 0;
}

.separator {
    color: #e5e7eb;
    font-weight: 300;
}

.sentiment-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sentiment-badge.positive {
    background: #dcfce7;
    color: #166534;
}

.sentiment-badge.negative {
    background: #fee2e2;
    color: #991b1b;
}

.sentiment-badge.neutral {
    background: #fef3c7;
    color: #92400e;
}

.category-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #f3f4f6;
    color: #374151;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    margin: 0;
}

.article-summary {
    color: #1f2937;
    line-height: 1.6;
    margin-bottom: 1rem;
    font-size: 1.25rem;
    font-weight: 600;
    padding: 0.5rem 0;
}

.topics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
    flex-shrink: 0;
}

.topic-tag {
    padding: 0.25rem 0.5rem;
    background: #e0f2fe;
    color: #0369a1;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.article-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid #f3f4f6;
}

.source-link {
    color: #10b981;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.timestamp {
    font-size: 0.75rem;
    color: #9ca3af;
}

.date-label {
    font-weight: 600;
    color: #4a5568;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.page-btn {
    padding: 0.5rem 1rem;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #374151;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-btn:hover:not(:disabled) {
    border-color: #10b981;
    color: #10b981;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    font-weight: 500;
    color: #6b7280;
}


/* Responsive Design */
@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .sidebar {
        display: none;
    }
    
    .articles-section {
        order: 1;
    }
    
    .mobile-filter-toggle {
        display: flex;
    }
    
    .header-content {
        justify-content: space-between;
    }
    
    /* Mobile Modal Overlay */
    .mobile-sidebar-overlay {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        background: rgba(0, 0, 0, 0.5) !important;
        z-index: 1000 !important;
        display: none !important;
    }

    .mobile-sidebar-overlay.active {
        display: block !important;
    }

    .mobile-sidebar {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 90%;
        max-width: 500px;
        max-height: 80vh;
        background: white;
        border-radius: 16px;
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
        overflow: hidden;
        z-index: 1001;
    }

    .mobile-sidebar-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 1.5rem;
        border-bottom: 1px solid #e5e7eb;
        background: #f9fafb;
        border-radius: 16px 16px 0 0;
    }

    .mobile-sidebar-header h3 {
        margin: 0;
        font-size: 1.25rem;
        font-weight: 600;
        color: #1f2937;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .mobile-sidebar-header h3 i {
        color: #10b981;
    }

    .mobile-sidebar-close {
        background: none;
        border: none;
        font-size: 1.5rem;
        color: #6b7280;
        cursor: pointer;
        padding: 0.5rem;
        border-radius: 8px;
        transition: all 0.2s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
    }

    .mobile-sidebar-close:hover {
        background: #e5e7eb;
        color: #374151;
    }

    .mobile-sidebar-content {
        padding: 1.5rem;
        max-height: calc(90vh - 100px);
        overflow-y: auto;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .header-stats {
        gap: 1rem;
    }
    
    .articles-container.grid {
        grid-template-columns: 1fr;
    }
    
    
    .metadata-and-topics {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .topics {
        justify-content: flex-start;
    }
    
    .pagination {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .stat-number {
        font-size: 1.25rem;
    }
    
    .articles-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
}
