/* News Page Responsive Styles */

/* Loading Animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner {
    animation: spin 1s linear infinite;
}

/* Mobile First Responsive Design */
@media (max-width: 768px) {
    .news-page { 
        padding: 40px 0; 
    }
    
    .page-title { 
        font-size: 2rem; 
    }
    
    .news-grid { 
        grid-template-columns: 1fr; 
        gap: 20px; 
    }
    
    .news-controls { 
        flex-direction: column; 
        align-items: stretch; 
    }
    
    .news-filters { 
        flex-direction: column; 
        align-items: center; 
        gap: 10px; 
    }
    
    .filter-button { 
        padding: 10px 15px; 
        font-size: 0.85rem; 
    }
    
    .pagination { 
        gap: 5px; 
    }
    
    .page-link { 
        width: 40px; 
        height: 40px; 
        font-size: 0.9rem; 
    }
    
    .news-content { 
        padding: 20px; 
    }
    
    /* Grid layout image - mobile */
    .news-grid .news-image {
        height: 200px !important;
        min-height: 200px !important;
    }
    
    .news-grid .news-image img {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center center !important;
    }
    
    /* Row layout responsive - stack vertically on mobile */
    .news-rows .news-item {
        flex-direction: column;
        min-height: auto;
    }
    
    .news-rows .news-image {
        flex: none;
        width: 100% !important;
        height: 200px !important;
        min-height: 200px !important;
    }
    
    .news-rows .news-image img {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center center !important;
    }
    
    .news-rows .news-content {
        flex: none;
    }
    
    .news-rows .news-title {
        font-size: 1.3rem;
    }
    
    .news-rows .news-excerpt {
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .layout-controls {
        order: -1;
        width: 100%;
        justify-content: center;
    }
    
    .layout-toggle {
        width: 200px;
    }
}

/* Tablet responsive */
@media (min-width: 769px) and (max-width: 1024px) {
    .news-grid { 
        grid-template-columns: repeat(2, 1fr); 
    }
    
    .news-grid .news-image {
        height: 200px !important;
        min-height: 200px !important;
    }
    
    .news-grid .news-image img {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center center !important;
    }
    
    .news-rows .news-image {
        flex: 0 0 280px;
        width: 280px !important;
        min-height: 220px !important;
    }
    
    .news-rows .news-image img {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center center !important;
    }
    
    .page-title { 
        font-size: 2.5rem; 
    }
}

/* Large screens */
@media (min-width: 1200px) {
    .news-grid { 
        grid-template-columns: repeat(3, 1fr); 
        gap: 40px;
    }
    
    .news-grid .news-image {
        height: 250px !important;
        min-height: 250px !important;
    }
    
    .news-grid .news-image img {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center center !important;
    }
    
    .news-rows .news-image {
        flex: 0 0 400px;
        width: 400px !important;
        min-height: 280px !important;
    }
    
    .news-rows .news-image img {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center center !important;
    }
}

/* Print styles */
@media print {
    .news-controls,
    .pagination-wrapper,
    .layout-controls {
        display: none;
    }
    
    .news-item {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
        margin-bottom: 20px;
    }
    
    .news-page {
        background: none;
    }
    
    .news-image img {
        object-fit: cover !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .news-item {
        border: 2px solid #000;
    }
    
    .filter-button {
        border: 2px solid #000;
    }
    
    .layout-btn {
        border: 1px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .news-item,
    .filter-button,
    .layout-btn,
    .page-link,
    .read-more {
        transition: none;
    }
    
    .news-image img {
        transition: none;
    }
    
    .loading-spinner {
        animation: none;
    }
}

/* Dark mode support (if needed in the future) */
@media (prefers-color-scheme: dark) {
    .news-page {
        background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
        color: #fff;
    }
    
    .page-header {
        background: #2d2d2d;
        border: 1px solid #444;
    }
    
    .news-item {
        background: #2d2d2d;
        border: 1px solid #444;
    }
    
    .filter-button {
        background: #2d2d2d;
        border-color: #444;
        color: #fff;
    }
    
    .layout-toggle {
        background: #2d2d2d;
        border-color: #444;
    }
    
    .layout-btn {
        color: #fff;
    }
    
    .news-image {
        background: linear-gradient(135deg, #333 0%, #444 100%);
    }
}