@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');

:root {
    --primary-blue: #002855;
    --accent-yellow: #F9D71C;
    --background-gray: #F8FAFC;
    --white: #FFFFFF;
    --text-dark: #1E293B;
    --text-muted: #64748B;
    --border-color: #E2E8F0;
    --shadow-soft: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--background-gray);
    color: var(--text-dark);
    line-height: 1.6;
}

/* Header Styles */
.main-header {
    background-color: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 1rem 5%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo-container img {
    height: 45px;
    width: auto;
    display: block;
}

.logo-text {
    display: none;
    /* Hide old text logo */
}

.logo-xd {
    background: var(--accent-yellow);
    color: var(--primary-blue);
    padding: 0.2rem 0.6rem;
    border-radius: 8px;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.search-bar {
    flex: 0 1 500px;
    position: relative;
    margin: 0 2rem;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    z-index: 1;
}

.search-bar input {
    width: 100%;
    padding: 0.8rem 3rem 0.8rem 3rem;
    border: 2px solid var(--border-color);
    border-radius: 50px;
    outline: none;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.search-bar input:focus {
    border-color: var(--primary-blue);
}

.search-clear {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    transition: color 0.2s ease;
    text-decoration: none;
}

.search-clear:hover {
    color: var(--primary-blue);
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.mobile-header-actions {
    display: none;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--primary-blue);
    font-size: 1.25rem;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.icon-btn:hover {
    transform: scale(1.1);
}

/* Filter Popover Styles */
.filter-dropdown-container {
    position: relative;
    display: inline-block;
}

.filter-popover {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: var(--white);
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    padding: 1.5rem;
    min-width: 250px;
    z-index: 2000;
    border: 1px solid var(--border-color);
    animation: slideIn 0.3s ease-out;
}

.filter-popover.show {
    display: block;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

.filter-popover-content label {
    display: block;
    margin-bottom: 0.8rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary-blue);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-popover-content select {
    width: 100%;
    padding: 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--background-gray);
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    outline: none;
}

.filter-popover-content select:focus {
    border-color: var(--primary-blue);
}

.filter-popover::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 15px;
    width: 12px;
    height: 12px;
    background: var(--white);
    transform: rotate(45deg);
    border-top: 1px solid var(--border-color);
    border-left: 1px solid var(--border-color);
}


/* News Feed Grid */
.news-container {
    max-width: 1500px;
    margin: 3rem auto;
    padding: 0 5%;
}

.news-grid {
    margin: -0.75rem;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.news-grid.ready {
    opacity: 1;
}

/* Spinner Loader */
.loader-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 100px 0;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(0, 40, 85, 0.1);
    border-top: 5px solid var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

.news-item {
    width: 25%;
    /* 4 columns on desktop */
    padding: 0.75rem;
    float: left;
}

/* Card Styles */
.card-link {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 20px;
}

.card-link:hover {
    transform: translateY(-8px);
}

.news-card {
    background: var(--white);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    transition: box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.card-link:hover .news-card {
    box-shadow: var(--shadow-hover);
}

/* Responsive Layouts */
@media (max-width: 1400px) {
    .news-item {
        width: 33.333%;
    }
}

@media (max-width: 900px) {
    .news-item {
        width: 50%;
    }
}

@media (max-width: 600px) {
    .news-item {
        width: 100%;
    }
}



.card-image-wrapper {
    position: relative;
    padding-top: 56.25%;
    /* 16:9 Aspect Ratio */
    overflow: hidden;
}

.card-image-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.news-card:hover .card-image-wrapper img {
    transform: scale(1.05);
}

.card-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 0.8rem;
    line-height: 1.3;
}

.card-excerpt {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    line-clamp: 3;
    overflow: hidden;
}

.card-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
}

.author-info {
    font-weight: 600;
    color: var(--text-dark);
}

/* Pinterest Style Tweaks */
.news-card {
    height: auto;
    display: block;
}

.news-card.featured {
    border: 2px solid var(--accent-yellow);
}

.news-card.featured .card-content {
    background: rgba(249, 215, 28, 0.03);
}

.card-image-wrapper {
    padding-top: 0;
    /* Let image define height */
    height: auto;
}

.card-image-wrapper img {
    position: relative;
    display: block;
}

/* Mobile Menu Button - Hidden on Desktop */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--primary-blue);
    cursor: pointer;
}

/* Mobile Styles */
@media (max-width: 768px) {
    .main-header {
        flex-direction: row;
        padding: 0.75rem 5%;
        gap: 0;
    }

    .logo-container img {
        height: 35px;
    }

    .search-bar {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        margin: 0;
        padding: 1rem 5%;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    }

    .search-bar input {
        padding-left: 2.5rem;
        padding-right: 2.5rem;
    }

    .search-icon {
        left: 1rem;
    }

    .search-clear {
        right: 1rem;
    }

    .search-bar.show {
        display: block;
    }

    .user-actions {
        display: none;
        position: absolute;
        top: 100%;
        right: 0;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        padding: 1rem;
        border-radius: 0 0 15px 15px;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        flex-direction: column;
        gap: 0.5rem;
    }

    .user-actions.show {
        display: flex;
    }

    .mobile-menu-btn {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .mobile-header-actions {
        display: flex;
        align-items: center;
        gap: 1rem;
        margin-left: auto;
    }

    .news-container {
        margin-top: 1rem;
        padding: 0 5%;
    }
}