/* RSS Feed Reader Styles */
/* Aggressive override to eliminate all gaps for RSS reader */
body {
    margin: 0 !important;
    padding: 0 !important;
}

/* Override main site container for RSS reader page specifically */
.rss-feed-page .container,
.rss-feed-page ~ .container,
.container .rss-feed-page {
    padding: 0 !important;
    margin: 0 !important;
}

/* Override any main content margins */
.main-content {
    margin-top: 0 !important;
    padding: 0 !important;
}

.rss-feed-page {
    min-height: 100vh;
    padding: 0 !important;
    margin: 0 !important;
    margin-top: 0 !important;
    padding-top: 80px !important; /* Just enough space for the fixed navbar */
    background: var(--background-gradient);
}

.rss-container {
    max-width: 1200px;
    margin: 0 auto !important;
    padding: 5px 1rem 2rem 1rem !important;
    width: 90% !important; /* Make container 90% width */
}

.rss-header {
    text-align: center;
    margin-bottom: 3rem;
}

.rss-title {
    font-size: 3rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

/* ========== PROGRESS INDICATOR ========== */
.progress-container {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease;
}

.progress-header {
    text-align: center;
    margin-bottom: 15px;
}

.progress-header h4 {
    color: var(--text-primary);
    margin: 0 0 8px 0;
    font-size: 1.2em;
}

#progress-status {
    color: var(--text-secondary);
    font-size: 0.9em;
    font-style: italic;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin: 15px 0;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-image: linear-gradient(
        -45deg,
        rgba(255, 255, 255, 0.2) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.2) 75%,
        transparent 75%,
        transparent
    );
    background-size: 50px 50px;
    animation: move 1s linear infinite;
}

@keyframes move {
    0% { background-position: 0 0; }
    100% { background-position: 50px 50px; }
}

.progress-details {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85em;
}

.progress-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.progress-failed {
    color: var(--danger-color);
    font-weight: 500;
}

/* ========== LOADING STATES ========== */
.loading-status {
    text-align: center;
    padding: 40px 20px;
    margin: 20px auto;
    max-width: 400px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-message {
    color: var(--text-primary);
    font-size: 1.1em;
    margin-top: 15px;
}

/* ========== ENHANCED ERROR STATES ========== */
.no-results,
.no-feeds,
.error-message {
    text-align: center;
    padding: 40px 20px;
    margin: 20px auto;
    max-width: 500px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 12px;
}

.no-results-content,
.no-feeds-content,
.error-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.no-results-icon,
.no-feeds-icon,
.error-icon {
    font-size: 3em;
    margin-bottom: 10px;
}

.no-results h3,
.no-feeds h3,
.error-message h3 {
    color: var(--text-primary);
    margin: 0;
    font-size: 1.4em;
}

.no-results p,
.no-feeds p,
.error-message p {
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* ========== SHARE NOTIFICATION ========== */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.share-notification {
    font-family: inherit;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.rss-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Filter Bar Styles */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: end;
    margin-bottom: 2rem;
    margin-top: 0;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-glass);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 180px;
    flex: 1;
}

.filter-select {
    padding: 0.75rem 1rem;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1rem;
    padding-right: 3rem;
}

.filter-select:focus {
    border-color: var(--primary-cyan);
    box-shadow: 0 0 20px rgba(0, 217, 255, 0.2);
    transform: translateY(-1px);
}

.filter-select option {
    background-color: rgba(15, 23, 42, 0.95) !important;
    color: var(--text-primary) !important;
    padding: 0.5rem 1rem;
}

.filter-actions {
    display: flex;
    gap: 0.75rem;
    align-items: end;
    margin-left: auto;
}

.clear-btn {
    padding: 0.75rem;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 8px;
    color: #f87171;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
}

.clear-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.2);
}

.refresh-btn {
    padding: 0.75rem;
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.4);
    border-radius: 8px;
    color: #60a5fa;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
}

.refresh-btn:hover {
    background: rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
}

/* Icons for buttons */
.refresh-btn i,
.clear-btn i {
    font-size: 1.2rem;
    line-height: 1;
    font-style: normal;
}

/* Filter Count Display */
.filter-count {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 1rem 0;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    display: none;
}

/* No Results Display */
.no-results {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.2rem;
    padding: 3rem 2rem;
    background: var(--glass-background);
    backdrop-filter: var(--glass-backdrop-filter);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    margin: 2rem 0;
}

.no-results::before {
    content: "🔍";
    display: block;
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Loading Indicator */
.loading-indicator {
    display: none;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    margin: 2rem 0;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid var(--primary-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    margin-left: 1rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Articles Container */
.rss-articles-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Changed from 3 to 2 columns for wider tiles */
    gap: 2rem;
    transition: opacity 0.3s ease;
    width: 100%;
}

.rss-article {
    background: var(--glass-background);
    backdrop-filter: var(--glass-backdrop-filter);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.25rem;
    transition: all 0.3s ease;
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
    position: relative; /* Add relative positioning for absolute children */
    display: flex;
    flex-direction: column;
    min-height: 200px; /* Ensure consistent card height */
}

.rss-article:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border-color: rgba(0, 217, 255, 0.3);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.article-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    position: relative;
}

.article-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.article-category {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
}

.category-icon {
    font-size: 1rem;
}

.category-name {
    color: var(--text-primary);
    font-weight: 500;
    text-transform: capitalize;
}

.article-meta,
.article-meta-top,
.article-meta-bottom {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.article-meta-top {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    text-align: right;
    z-index: 1; /* Ensure it's above other content */
}

.article-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: auto;
    padding-top: 1rem;
}

.article-meta-bottom {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.article-source {
    font-weight: 500;
    color: var(--primary-cyan);
}

.article-time {
    opacity: 0.7;
}

.article-content {
    margin-bottom: 1.5rem;
    flex-grow: 1; /* Allow content to grow and push footer down */
}

.article-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-description {
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-start;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* No Feeds / Error States */
.no-feeds, .error-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    background: var(--glass-background);
    backdrop-filter: var(--glass-backdrop-filter);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    margin: 2rem 0;
}

.no-feeds-content, .error-content {
    max-width: 400px;
    margin: 0 auto;
}

.no-feeds-icon, .error-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.no-feeds h3, .error-message h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.no-feeds p, .error-message p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.link {
    color: var(--primary-cyan);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.link:hover {
    color: var(--primary-purple);
    text-decoration: underline;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .rss-container {
        padding: 0 1rem;
        width: 95% !important; /* Use 95% width on mobile for better readability */
    }
    
    .rss-title {
        font-size: 2.5rem;
    }
    
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .filter-group {
        min-width: unset;
        flex: none;
    }
    
    .filter-actions {
        margin-left: unset;
        justify-content: center;
        margin-top: 0.5rem;
    }
    
    .filter-actions .refresh-btn,
    .filter-actions .clear-btn {
        flex: 1;
        justify-content: center;
    }
    
    .rss-articles-container {
        grid-template-columns: 1fr; /* Single column on mobile */
        gap: 1.5rem;
    }
    
    .rss-article {
        padding: 1.25rem;
    }
    
    /* Adjust meta positioning for mobile */
    .article-meta-top {
        position: static; /* Switch to normal flow on mobile */
        margin-top: 0.5rem;
        text-align: left;
        align-items: flex-start;
    }
    
    .article-meta-bottom {
        justify-content: flex-start; /* Left align on mobile */
        gap: 0.25rem;
        flex-direction: column; /* Stack vertically on mobile */
        align-items: flex-start;
    }
    
    .article-footer {
        justify-content: flex-start; /* Left align footer on mobile */
        margin-top: 1rem;
    }
    
    .article-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }
    
    .article-header-left {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }
    
    .article-header-left .btn {
        order: 2; /* Move button below category on mobile */
        width: 100%;
        justify-content: center;
    }
}

/* Tablet Responsive - Keep 2 columns on medium screens for wider tiles */
@media (max-width: 1200px) and (min-width: 769px) {
    .rss-articles-container {
        grid-template-columns: repeat(2, 1fr); /* Keep 2 columns */
        gap: 1.5rem;
    }
    
    .rss-container {
        width: 95% !important; /* Slightly wider on tablets */
        padding: 5px 1.5rem 2rem 1.5rem !important;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .rss-title {
        font-size: 2rem;
    }
    
    .rss-subtitle {
        font-size: 1rem;
    }
    
    .article-title {
        font-size: 1.1rem;
    }
}