/**
 * Sonoma County News - Default Styles
 * 
 * All elements have clear IDs and classes for easy customization.
 * Override these in your theme's CSS as needed.
 */

/* Container */
#sonoma-news-container,
.sonoma-news-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
}

/* Header */
#sonoma-news-header,
.sonoma-news-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e5e7eb;
}

#sonoma-news-title,
.sonoma-news-title {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: #1f2937;
}

#sonoma-news-controls,
.sonoma-news-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

#sonoma-news-updated,
.sonoma-news-updated {
    font-size: 0.875rem;
    color: #6b7280;
}

#sonoma-news-refresh-btn,
.sonoma-news-refresh-btn {
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

#sonoma-news-refresh-btn:hover,
.sonoma-news-refresh-btn:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

#sonoma-news-refresh-btn:disabled,
.sonoma-news-refresh-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Grid Layout */
#sonoma-news-grid,
.sonoma-news-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Card - without images, more compact */
.sonoma-news-card {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    padding: 0;
}

.sonoma-news-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-color: #d1d5db;
}

/* Card Content */
.sonoma-news-card-content {
    padding: 16px 20px;
    overflow: hidden; /* Contains floated image */
}

/* Card Image - Floated right, 4:3 aspect ratio */
.sonoma-news-card-image-wrap {
    float: right;
    width: 150px;
    margin: 0 0 12px 16px;
    border-radius: 6px;
    overflow: hidden;
    background: #f3f4f6;
}

.sonoma-news-card-image-wrap a {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
}

.sonoma-news-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.2s ease;
}

.sonoma-news-card-image:hover {
    opacity: 0.9;
}

/* Card Headline */
.sonoma-news-card-headline {
    margin: 0 0 8px 0;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.4;
}

.sonoma-news-card-headline a {
    color: #1f2937;
    text-decoration: none;
    transition: color 0.15s ease;
}

.sonoma-news-card-headline a:hover {
    color: #2563eb;
}

/* Card Meta */
.sonoma-news-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 0.8rem;
    color: #6b7280;
}

.sonoma-news-card-source {
    font-weight: 600;
    color: #4b5563;
}

.sonoma-news-card-separator {
    color: #d1d5db;
}

.sonoma-news-card-time {
    color: #9ca3af;
}

/* Card Excerpt */
.sonoma-news-card-excerpt {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.55;
    color: #4b5563;
    flex-grow: 1;
}

/* Grid variant - add class "sonoma-news-grid--cards" to container for 2-column cards */
.sonoma-news-grid--cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

/* Empty State */
#sonoma-news-empty,
.sonoma-news-empty {
    padding: 40px 20px;
    text-align: center;
    background: #f9fafb;
    border-radius: 8px;
    color: #6b7280;
}

/* Loading State */
.sonoma-news-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #6b7280;
}

.sonoma-news-loading p {
    margin: 16px 0 0;
    font-size: 0.95rem;
}

/* Spinner Animation */
.sonoma-news-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: sonoma-news-spin 0.8s linear infinite;
}

@keyframes sonoma-news-spin {
    to { transform: rotate(360deg); }
}

/* Card Fade-in Animation */
.sonoma-news-card--animate {
    opacity: 0;
    transform: translateY(12px);
    animation: sonoma-news-fade-in 0.4s ease-out forwards;
}

@keyframes sonoma-news-fade-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading overlay for refresh */
.sonoma-news-grid--loading {
    position: relative;
    pointer-events: none;
}

.sonoma-news-grid--loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    animation: sonoma-news-pulse 1s ease-in-out infinite;
}

@keyframes sonoma-news-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.8; }
}

/* Responsive */
@media (max-width: 768px) {
    #sonoma-news-header,
    .sonoma-news-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    /* Smaller image on mobile */
    .sonoma-news-card-image-wrap {
        width: 100px;
        margin: 0 0 8px 12px;
    }
}

@media (max-width: 480px) {
    /* Stack image above content on very small screens */
    .sonoma-news-card-image-wrap {
        float: none;
        width: 100%;
        margin: 0 0 12px 0;
    }
    
    .sonoma-news-card-image-wrap a {
        aspect-ratio: 16 / 9;
    }
}

/* Dark Mode Support (optional - uncomment if needed) */
/*
@media (prefers-color-scheme: dark) {
    #sonoma-news-container,
    .sonoma-news-container {
        background: #1f2937;
    }
    
    .sonoma-news-card {
        background: #374151;
        border-color: #4b5563;
    }
    
    .sonoma-news-card-headline a {
        color: #f3f4f6;
    }
    
    .sonoma-news-card-excerpt {
        color: #d1d5db;
    }
}
*/
