/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr auto 200px;
    align-items: center;
    gap: 2rem;
}

.header-main {
    text-align: left;
}

.header-main h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.header-main p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin: 0;
}

/* Header controls */
.header-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
}

.today-toggle, .detail-toggle {
    display: flex;
    align-items: center;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: white;
    opacity: 0.9;
    user-select: none;
}

.toggle-input {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    transition: background-color 0.3s;
    cursor: pointer;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-input:checked + .toggle-slider {
    background-color: rgba(255, 255, 255, 0.6);
}

.toggle-input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.toggle-label:hover {
    opacity: 1;
}

/* Weather section */
.weather-section {
    text-align: right;
    min-width: 200px;
}

.weather-loading {
    font-size: 0.9rem;
    opacity: 0.8;
}

.weather-display {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.weather-main {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.weather-icon {
    font-size: 2rem;
    line-height: 1;
}

.weather-temp {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.weather-desc {
    font-size: 1rem;
    opacity: 0.9;
    text-transform: capitalize;
}

.weather-location {
    font-size: 0.85rem;
    opacity: 0.8;
}

.weather-error {
    font-size: 0.9rem;
    opacity: 0.8;
    color: #ffcccb;
}

/* Main content */
main {
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Controls section */
.controls {
    display: none;
}

.feed-controls, .filter-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

#rss-input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #e1e1e1;
    border-radius: 5px;
    font-size: 1rem;
}

#rss-input:focus {
    outline: none;
    border-color: #667eea;
}

button {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

button:hover {
    background: #5a6fd8;
}

select {
    padding: 0.75rem;
    border: 2px solid #e1e1e1;
    border-radius: 5px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

/* Dashboard */
.dashboard {
    position: relative;
}

.loading, .error {
    text-align: center;
    padding: 2rem;
    font-size: 1.2rem;
}

.loading {
    color: #667eea;
}

.error {
    color: #e74c3c;
    background: #fdf2f2;
    border: 1px solid #f5c6cb;
    border-radius: 5px;
}

.hidden {
    display: none;
}

/* Header News section - integrated with header */
.header-news-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.header-news-content {
    width: 100%;
    margin: 0;
    padding: 0;
}

.header-news-title {
    color: white;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    opacity: 0.95;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.1);
}

.header-news-iframe {
    width: 100%;
    border: none;
    border-radius: 0;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: none;
    display: block;
}

.news-expand-container {
    text-align: center;
    padding: 0.25rem;
    background: rgba(0, 0, 0, 0.05);
}

.news-expand-button {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.25rem 0.5rem;
    border-radius: 15px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 400;
    transition: all 0.3s ease;
    min-width: 30px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.news-expand-button:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

/* Articles grid - 2 column layout for non-news sections */
.articles-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

/* Category sections */
.category-section {
    margin-bottom: 1rem;
}

.category-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    padding-bottom: 0.3rem;
    border-bottom: 2px solid #667eea;
    display: flex;
    align-items: center;
}

.category-title::before {
    content: "";
    width: 4px;
    height: 1.5rem;
    background: #667eea;
    margin-right: 0.75rem;
    border-radius: 2px;
}

.category-iframe {
    width: 100%;
    /* height set dynamically by JavaScript */
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    background: #f9f9f9;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.article-card {
    background: white;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: box-shadow 0.2s, background-color 0.2s;
    border-left: 3px solid #667eea;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.article-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    background-color: #fafafa;
}

.article-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: #2c3e50;
    text-decoration: none;
    display: block;
    line-height: 1.4;
}

.article-title:hover {
    color: #667eea;
}

.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: #666;
}

.article-source {
    font-weight: 500;
    color: #667eea;
}

.article-date {
    font-style: italic;
}

.article-description {
    color: #555;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag {
    background: #e8f2ff;
    color: #667eea;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: #666;
    border-top: 1px solid #eee;
    margin-top: 3rem;
    background-color: #fafafa;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-links {
    display: flex;
    gap: 1rem;
}

.rss-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border: 2px solid #667eea;
    border-radius: 25px;
    transition: all 0.3s ease;
}

.rss-link:hover {
    background-color: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.rss-icon {
    font-size: 1.1rem;
}

/* Medium screens - single column for better readability */
@media (max-width: 1024px) and (min-width: 769px) {
    .articles-grid {
        gap: 1.5rem;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .controls {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .feed-controls, .filter-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .category-iframe {
        /* height set dynamically by JavaScript - no override needed */
    }
    
    .header-content {
        grid-template-columns: 1fr;
        gap: 1rem;
        text-align: center;
        justify-items: center;
    }
    
    .header-main {
        text-align: center;
    }
    
    .header-main h1 {
        font-size: 2rem;
    }
    
    .weather-section {
        text-align: center;
        min-width: auto;
    }
    
    .weather-display {
        align-items: center;
    }
    
    .weather-main {
        justify-content: center;
    }
    
    .header-news-content {
        padding: 0;
    }
    
    .header-news-title {
        font-size: 1.3rem;
        padding: 0.75rem;
    }
    
    .news-expand-container {
        padding: 0.75rem;
    }
    
    .news-expand-button {
        font-size: 0.8rem;
        padding: 0.4rem 1.2rem;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    
    main {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    header {
        padding: 1.5rem 1rem;
    }
    
    .controls {
        padding: 1rem;
    }
    
    .article-card {
        padding: 1rem;
    }
}