/* Enhanced News Section Styling */

#news-section {
    padding: 30px; /* Increased padding for wider layout */
    background: linear-gradient(135deg, 
        rgba(240, 248, 255, 0.95) 0%, 
        rgba(232, 245, 233, 0.9) 50%, 
        rgba(255, 249, 235, 0.95) 100%);
    border-radius: 20px;
    margin: 20px 0;
    box-shadow: 
        0 15px 40px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    position: relative;
    overflow: hidden;
}

#news-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, 
        transparent 40%, 
        rgba(106, 156, 137, 0.02) 50%, 
        transparent 60%);
    animation: newsShimmer 10s infinite linear;
    pointer-events: none;
}

@keyframes newsShimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(30deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(30deg); }
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Always 2 columns */
    gap: 25px;
    margin-top: 20px;
    max-width: 1200px; /* Wider layout for better content display */
    margin-left: auto;
    margin-right: auto;
}

.news-card {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.95) 0%, 
        rgba(248, 250, 252, 0.9) 100%);
    border: 2px solid rgba(106, 156, 137, 0.15);
    border-radius: 18px;
    padding: 20px; /* Reduced padding for smaller height */
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    animation: newsCardFadeIn 0.6s ease-out forwards;
    opacity: 0;
    transform: translateY(20px);
    height: 280px; /* Fixed smaller height instead of square */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

@keyframes newsCardFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.news-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(106, 156, 137, 0.08), 
        transparent);
    transition: left 0.6s ease;
}

.news-card:hover::before {
    left: 100%;
}

.news-card:hover {
    transform: translateY(-8px);
    border-color: rgba(106, 156, 137, 0.3);
    box-shadow: 
        0 20px 50px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.urgency-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: linear-gradient(135deg, #ff4757, #ff3838);
    color: white;
    padding: 4px 8px;
    border-radius: 10px;
    font-size: 0.7em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.4);
    animation: urgencyPulse 2s infinite;
}

@keyframes urgencyPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.news-source {
    display: inline-flex;
    align-items: center;
    gap: 6px; /* Reduced gap */
    padding: 6px 10px; /* Smaller padding for narrower width */
    border-radius: 20px; /* Smaller border radius */
    font-size: 0.75em; /* Slightly smaller font */
    font-weight: 600;
    letter-spacing: 0.3px; /* Reduced letter spacing */
    margin-bottom: 12px; /* Reduced margin */
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(106, 156, 137, 0.15), rgba(134, 176, 161, 0.1));
    color: rgba(22, 66, 60, 0.9);
    border: 1px solid rgba(106, 156, 137, 0.3);
    width: fit-content; /* Make container fit the text size */
}

/* Remove old category-specific styling - now using unified source styling */

.news-source i {
    font-size: 1.1em;
    animation: sourceIconBounce 3s infinite;
}

@keyframes sourceIconBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.news-card h3 {
    color: rgba(22, 66, 60, 1);
    font-size: 1.3em; /* Increased font size for better readability */
    font-weight: 700;
    margin-bottom: 10px; /* Reduced margin for compact layout */
    line-height: 1.3;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.news-card p {
    color: rgba(22, 66, 60, 0.8);
    line-height: 1.4; /* Slightly tighter line height */
    margin-bottom: 12px; /* Reduced margin */
    font-size: 0.95em; /* Increased font size for better readability */
    flex-grow: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3; /* Limit to 3 lines */
    line-clamp: 3; /* Standard property for compatibility */
    -webkit-box-orient: vertical;
}

.news-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.news-time {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(108, 117, 125, 0.8);
    font-size: 0.85em;
    font-weight: 500;
}

.news-time i {
    color: rgba(106, 156, 137, 1);
}

.read-more-btn {
    background: linear-gradient(135deg, 
        rgba(106, 156, 137, 0.9) 0%, 
        rgba(106, 156, 137, 1) 100%);
    color: #ffffff !important;
    text-decoration: none !important;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 
        0 4px 12px rgba(106, 156, 137, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.read-more-btn:hover {
    background: linear-gradient(135deg, 
        rgba(106, 156, 137, 1) 0%, 
        rgba(91, 141, 122, 1) 100%);
    color: #ffffff !important;
    text-decoration: none !important;
    transform: translateY(-2px);
    box-shadow: 
        0 6px 20px rgba(106, 156, 137, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.read-more-btn i {
    transition: transform 0.3s ease;
    color: #ffffff !important;
}

.read-more-btn:hover i {
    transform: translateX(3px);
    color: #ffffff !important;
}

.read-more-btn * {
    color: #ffffff !important;
    text-decoration: none !important;
}

/* Loading state */
.news-loading {
    text-align: center;
    padding: 60px 20px;
    color: rgba(22, 66, 60, 0.8);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(106, 156, 137, 0.2);
    border-top: 4px solid rgba(106, 156, 137, 1);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.news-loading h3 {
    color: rgba(22, 66, 60, 1);
    font-size: 1.5em;
    margin-bottom: 10px;
}

.news-loading p {
    color: rgba(108, 117, 125, 0.8);
    font-size: 1em;
}

/* Error state */
.news-error {
    text-align: center;
    padding: 60px 20px;
    color: rgba(22, 66, 60, 0.8);
}

.error-icon {
    font-size: 3em;
    margin-bottom: 20px;
    animation: errorWiggle 2s infinite;
}

@keyframes errorWiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

.news-error h3 {
    color: rgba(22, 66, 60, 1);
    font-size: 1.4em;
    margin-bottom: 15px;
}

.news-error p {
    color: rgba(108, 117, 125, 0.8);
    margin-bottom: 25px;
}

.read-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  background: linear-gradient(135deg, #6a9c89, #5b8d7a);
  color: #fff !important;
  font-family: 'Segoe UI', sans-serif !important;
  font-size: 0.9em;
  font-weight: 600;

  padding: 10px 18px;
  border: none;
  border-radius: 999px;
  cursor: pointer;

  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.read-more-btn i {
  font-size: 1em;
  color: #fff !important;
  transition: transform 0.3s ease;
}

.read-more-btn:hover {
  background: linear-gradient(135deg, #5b8d7a, #4e7c6c);
  transform: translateY(-2px);
}

.read-more-btn:hover i {
  transform: translateX(4px);
}

.retry-btn:hover {
    background: linear-gradient(135deg, 
        rgba(106, 156, 137, 1) 0%, 
        rgba(91, 141, 122, 1) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(106, 156, 137, 0.4);
}

/* Modern Pagination styling */
.news-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 40px;
    padding: 15px;
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 8px 14px;
  min-width: 44px;
  height: 38px;

  font-size: 0.85em;
  font-weight: 600;
  color: rgba(22, 66, 60, 0.85);

  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(106, 156, 137, 0.3);
  border-radius: 10px;

  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: 6px;
}

.pagination-btn:hover:not(.disabled) {
    background: rgba(106, 156, 137, 0.1);
    border-color: rgba(106, 156, 137, 0.5);
    color: rgba(22, 66, 60, 1);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(106, 156, 137, 0.15);
}

.pagination-btn.active {
    background: rgba(106, 156, 137, 1);
    color: white;
    border-color: rgba(106, 156, 137, 1);
    box-shadow: 0 4px 12px rgba(106, 156, 137, 0.3);
    font-weight: 600;
}

.pagination-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.5);
}

.pagination-ellipsis {
    color: rgba(106, 156, 137, 0.6);
    font-weight: 500;
    padding: 0 4px;
    font-size: 0.9em;
}

/* Arrow buttons special styling */
.pagination-btn i {
    font-size: 0.8em;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .news-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .news-card {
        padding: 20px;
    }
    
    .news-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .read-more-btn {
        align-self: flex-end;
    }
    
    .urgency-badge {
        position: relative;
        top: 0;
        right: 0;
        margin-bottom: 10px;
        align-self: flex-start;
    }
}

/* Dark mode support */
body[style*="rgba(17, 34, 29, 0.7)"] #news-section {
    background: linear-gradient(135deg, rgba(17, 34, 29, 0.9), rgba(22, 66, 60, 0.8));
}

body[style*="rgba(17, 34, 29, 0.7)"] .news-card {
    background: linear-gradient(135deg, rgba(22, 66, 60, 0.6), rgba(17, 34, 29, 0.8));
    border-color: rgba(233, 239, 236, 0.2);
}

body[style*="rgba(17, 34, 29, 0.7)"] .news-card h3 {
    color: rgb(233, 239, 236);
}

body[style*="rgba(17, 34, 29, 0.7)"] .news-card p {
    color: rgba(233, 239, 236, 0.8);
}

body[style*="rgba(17, 34, 29, 0.7)"] .news-loading,
body[style*="rgba(17, 34, 29, 0.7)"] .news-error {
    color: rgba(233, 239, 236, 0.8);
}

body[style*="rgba(17, 34, 29, 0.7)"] .news-loading h3,
body[style*="rgba(17, 34, 29, 0.7)"] .news-error h3 {
    color: rgb(233, 239, 236);
}

body[style*="rgba(17, 34, 29, 0.7)"] .news-source {
    background: linear-gradient(135deg, rgba(233, 239, 236, 0.15), rgba(233, 239, 236, 0.1));
    color: rgba(233, 239, 236, 0.9);
    border: 1px solid rgba(233, 239, 236, 0.3);
}

body[style*="rgba(17, 34, 29, 0.7)"] .news-time {
    color: rgba(233, 239, 236, 0.7);
}

body[style*="rgba(17, 34, 29, 0.7)"] .news-time i {
    color: rgba(233, 239, 236, 0.8);
}