/* ==================== ROOT VARIABLES - Easy to modify colors ==================== */
:root {
    --primary-color: #00b4d8;
    --secondary-color: #caf0f8;
    --dark-bg: #023e8a;
    --light-bg: #f8f9fa;
    --text-dark: #03045e;
    --text-light: #ffffff;
    --accent-color: #ff6b6b;
    --accent-secondary: #ffd60a;
    --border-color: #dee2e6;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 8px 24px rgba(0, 180, 216, 0.3);
}

/* ==================== GLOBAL RESET & BASE STYLES ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-dark);
    line-height: 1.6;
}

/* ==================== CONTAINER - Centers content with max width ==================== */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==================== HEADER SECTION ==================== */
.header {
    background: linear-gradient(135deg, #00b4d8 0%, #0096c7 100%);
    color: var(--text-light);
    padding: 20px 0;
    box-shadow: 0 4px 12px rgba(0, 180, 216, 0.3);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 3px solid var(--accent-color);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

/* Logo Styles */
.logo h1 {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 5px;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.2);
    background: linear-gradient(45deg, #ffffff, #caf0f8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    font-size: 0.9rem;
    opacity: 0.9;
    font-style: italic;
}

/* Navigation Styles */
.nav {
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
}

.nav-link {
    color: var(--text-light);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 5px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
    background-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 107, 107, 0.3);
}

/* ==================== MAIN CONTENT AREA ==================== */
.main-content {
    min-height: 100vh;
    padding: 40px 0;
}

/* Hero Section */
.hero-section {
    margin-bottom: 40px;
    text-align: center;
}

.section-title {
    font-size: 2.5rem;
    color: var(--dark-bg);
    position: relative;
    display: inline-block;
    padding-bottom: 15px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    border-radius: 2px;
    box-shadow: 0 2px 8px rgba(0, 180, 216, 0.5);
}

/* ==================== NEWS FEED - Grid layout for news items ==================== */
.news-feed {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

/* ==================== PINNED NEWS SECTION ==================== */
.pinned-section {
    margin-bottom: 50px;
    padding: 30px;
    background: linear-gradient(135deg, #caf0f8 0%, #ade8f4 100%);
    border-radius: 15px;
    border: 2px solid var(--primary-color);
    box-shadow: 0 4px 16px rgba(0, 180, 216, 0.2);
}

.pinned-feed {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* ==================== NEWS CARD - YouTube-style card design ==================== */
.news-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    animation: fadeIn 0.5s ease;
    cursor: pointer;
}

.news-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
}

/* Fade in animation for new cards */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* News Card Image Container - YouTube style with 16:9 ratio */
.news-image {
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
    position: relative;
    background: linear-gradient(135deg, #00b4d8 0%, #0077b6 100%);
}

.news-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.news-card:hover .news-image img {
    transform: scale(1.1);
}

/* Category Badge on Image - Pinned indicator */
.category-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: linear-gradient(135deg, var(--accent-color), #ff8787);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Special styling for pinned badge */
.category-badge.pinned {
    background: linear-gradient(135deg, var(--accent-secondary), #ffc300);
    color: var(--text-dark);
}

.category-badge.pinned::before {
    content: '📌 ';
}

/* News Card Content - YouTube style with compact layout */
.news-content {
    padding: 15px;
}

.news-title {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--dark-bg);
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-excerpt {
    color: #6c757d;
    margin-bottom: 10px;
    line-height: 1.5;
    font-size: 0.88rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* News Card Footer - YouTube style compact footer */
.news-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.news-date {
    color: #6c757d;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.read-more {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
}

.read-more:hover {
    gap: 10px;
    color: var(--accent-color);
}

/* ==================== LOADING SPINNER - Shows when fetching content ==================== */
.loading-spinner {
    text-align: center;
    padding: 40px 0;
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
    box-shadow: 0 2px 8px rgba(0, 180, 216, 0.3);
}

/* Spinner rotation animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner p {
    color: #6c757d;
    font-size: 1.1rem;
}

/* ==================== END OF CONTENT MESSAGE ==================== */
.end-message {
    text-align: center;
    padding: 40px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin: 40px 0;
}

.end-message p {
    font-size: 1.2rem;
    color: #6c757d;
}

/* ==================== FOOTER SECTION ==================== */
.footer {
    background-color: var(--dark-bg);
    color: var(--text-light);
    padding: 30px 0;
    margin-top: 60px;
    text-align: center;
}

.footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.social-links {
    display: flex;
    gap: 20px;
}

.social-links a {
    color: var(--text-light);
    text-decoration: none;
    transition: all 0.3s ease;
}

.social-links a:hover {
    color: var(--primary-color);
    transform: translateY(-3px);
}

/* ==================== RESPONSIVE DESIGN - Mobile devices ==================== */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        gap: 20px;
    }
    
    .logo {
        text-align: center;
    }
    
    .nav {
        justify-content: center;
    }
    
    .news-feed {
        grid-template-columns: 1fr;
    }
    
    .pinned-feed {
        grid-template-columns: 1fr;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .footer .container {
        flex-direction: column;
    }
}

/* ==================== MEDIUM SCREENS - Tablets ==================== */
@media (min-width: 769px) and (max-width: 1200px) {
    .news-feed {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }
    
    .pinned-feed {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }
}