/* --- RESET & BASICS --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f6f8;
    color: #333;
    line-height: 1.6;
}

/* --- HEADER --- */
header {
    background-color: #ffffff;
    padding: 40px 20px;
    text-align: center;
    border-bottom: 1px solid #ddd;
    margin-bottom: 30px;
}

header h1 {
    color: #1a73e8; /* Google Blue */
    font-size: 2.5rem;
    margin-bottom: 10px;
}

header p {
    color: #666;
    font-size: 1.1rem;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- AI SUMMARY BOX (Distinct Style) --- */
.summary-box {
    background-color: #e8f0fe; /* Very light blue */
    border: 1px solid #d2e3fc;
    border-left: 6px solid #1a73e8; /* Bold blue accent line */
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 40px; /* Space between summary and news */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.summary-content h3 {
    margin-top: 0;
    color: #174ea6;
    display: flex;
    align-items: center;
    gap: 10px;
}

.summary-content p {
    margin-bottom: 0;
    font-size: 1.1rem;
    color: #2c3e50;
}

/* --- NEWS GRID --- */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    padding-bottom: 50px;
}

/* --- ARTICLE CARD --- */
.article-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
}

.article-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background-color: #eee;
}

.article-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.source-tag {
    font-size: 0.8rem;
    color: #1a73e8;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.article-title {
    font-size: 1.2rem;
    margin-bottom: 10px;
    line-height: 1.4;
}

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

.article-title a:hover {
    color: #1a73e8;
    text-decoration: underline;
}

.article-description {
    font-size: 0.95rem;
    color: #5f6368;
    margin-bottom: 15px;
    flex-grow: 1; /* Pushes date to bottom */
}

.article-date {
    font-size: 0.85rem;
    color: #999;
    margin-top: auto;
}

/* --- LOADING & ERROR STATES --- */
.loading-state, .error-message {
    grid-column: 1 / -1; /* Span full width */
    text-align: center;
    padding: 50px;
    color: #666;
}

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

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

footer {
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 0.9rem;
    margin-top: auto;
}