/* ==========================================================================
   Template 2 — Research Funding & Grants Styles
   Matches reference image: 2-column card layout, icon thumbnail left,
   grant details right, clean typography, right-aligned search bar,
   and 1-column mobile responsiveness with zero overflow.
   ========================================================================== */

:root {
    --navy-darkest: #03142a;
    --navy-dark: #06234b;
    --navy-title: #0f294a;
    --teal-bright: #00d2d3;
    --teal-primary: #0d9488;
    --gold-soft: #fbbf24;
    --white: #ffffff;
    --bg-page: #f0f4f9;
    --card-bg: #ffffff;
    --card-border: #e5eaf2;
    --text-body: #334155;
    --text-muted: #64748b;
    --radius-card: 14px;
}

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

html {
    overflow-x: clip;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container {
    width: 100%;
    max-width: 1260px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==========================================================================
   HERO BANNER (Symmetrically aligned with Publications / Awards)
   ========================================================================== */
.fg-hero-banner {
    position: relative;
    min-height: 230px;
    background-color: var(--navy-dark);
    background-image:
        linear-gradient(to right, rgba(3, 20, 42, 0.95) 0%, rgba(6, 35, 75, 0.88) 50%, rgba(6, 35, 75, 0.35) 100%),
        url('../images/funding_banner.jpg');
    background-size: cover;
    background-position: center right;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    padding: 42px 0 48px;
    overflow: hidden;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.1);
}

.fg-hero-content {
    position: relative;
    z-index: 2;

}

.fg-breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--teal-bright);
    margin-bottom: 12px;
}

.fg-breadcrumb a {
    color: var(--teal-bright);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: opacity 0.2s ease;
}

.fg-breadcrumb a:hover {
    opacity: 0.8;
}

.fg-bc-sep {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
}

.fg-breadcrumb span:last-child {
    color: rgba(255, 255, 255, 0.8);
}

.fg-hero-title {
    font-family: 'Outfit', sans-serif;
    font-size: 2.6rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.fg-hero-subtitle {
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.88);
    font-weight: 300;
    line-height: 1.55;
    margin-bottom: 22px;
}

.fg-stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.fg-stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 210, 211, 0.15);
    border: 1px solid rgba(0, 210, 211, 0.32);
    border-radius: 999px;
    padding: 7px 18px;
    font-size: 13.5px;
    color: var(--white);
    font-weight: 500;
    backdrop-filter: blur(6px);
    white-space: nowrap;
}

.fg-stat-pill i {
    color: var(--teal-bright);
    font-size: 14px;
}

.fg-stat-pill strong {
    color: var(--teal-bright);
    font-weight: 700;
}

/* ==========================================================================
   MAIN CONTENT & TOPBAR SEARCH
   ========================================================================== */
.fg-main {
    padding: 36px 0 76px;
}

/* Right-aligned search bar (matches reference image) */
.fg-search-wrap {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 24px;
}

.fg-search-box {
    position: relative;
    width: 100%;
    max-width: 420px;
}

.fg-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.92rem;
    pointer-events: none;
}

.fg-search-input {
    width: 100%;
    height: 44px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    padding: 0 40px 0 44px;
    font-size: 0.88rem;
    color: var(--navy-title);
    font-family: inherit;
    transition: all 0.2s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.fg-search-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.fg-search-input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

.fg-search-clear {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 1rem;
    cursor: pointer;
    display: none;
    padding: 4px;
    border-radius: 50%;
    line-height: 1;
    transition: color 0.2s;
}

.fg-search-clear:hover {
    color: #4b5563;
}

.fg-search-clear.visible {
    display: block;
}

/* ==========================================================================
   2-COLUMN CARD GRID
   ========================================================================== */
.fg-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 22px;
}

/* ==========================================================================
   GRANT CARD
   ========================================================================== */
.fg-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-card);
    padding: 20px 22px;
    display: flex;
    gap: 20px;
    align-items: center;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    animation: fgFadeUp 0.35s ease both;
}

.fg-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    border-color: #cbd5e1;
}

@keyframes fgFadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

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

/* Stagger cards animation */
.fg-card:nth-child(1) {
    animation-delay: 0.03s;
}

.fg-card:nth-child(2) {
    animation-delay: 0.06s;
}

.fg-card:nth-child(3) {
    animation-delay: 0.09s;
}

.fg-card:nth-child(4) {
    animation-delay: 0.12s;
}

.fg-card:nth-child(5) {
    animation-delay: 0.15s;
}

.fg-card:nth-child(6) {
    animation-delay: 0.18s;
}

/* ==========================================================================
   THUMBNAIL ICON
   ========================================================================== */
.fg-icon-thumb {
    width: 135px;
    height: 98px;
    flex-shrink: 0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.fg-card:hover .fg-icon-thumb {
    transform: scale(1.03);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.fg-icon-thumb i {
    font-size: 2.3rem;
    color: #ffffff;
    opacity: 0.95;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.35));
    transition: transform 0.25s ease;
}

.fg-card:hover .fg-icon-thumb i {
    transform: scale(1.1);
}

/* Dynamic theme gradients for thumbnails */
.thumb-neuro {
    background: linear-gradient(135deg, #091e38 0%, #0a4d79 55%, #0ea5e9 100%);
}

.thumb-cancer {
    background: linear-gradient(135deg, #0f1d38 0%, #1e3a8a 60%, #3b82f6 100%);
}

.thumb-plant {
    background: linear-gradient(135deg, #052e23 0%, #065f46 60%, #10b981 100%);
}

.thumb-crispr {
    background: linear-gradient(135deg, #042436 0%, #0f766e 60%, #14b8a6 100%);
}

.thumb-marine {
    background: linear-gradient(135deg, #031e3b 0%, #0284c7 60%, #38bdf8 100%);
}

.thumb-nano {
    background: linear-gradient(135deg, #17183e 0%, #3730a3 60%, #6366f1 100%);
}

.thumb-academic {
    background: linear-gradient(135deg, #1e1b4b 0%, #4338ca 60%, #818cf8 100%);
}

.thumb-intl {
    background: linear-gradient(135deg, #062338 0%, #0284c7 60%, #06b6d4 100%);
}

.thumb-govt {
    background: linear-gradient(135deg, #0a1b2a 0%, #1e3a5f 60%, #0284c7 100%);
}

.thumb-default {
    background: linear-gradient(135deg, #03142a 0%, #0f4c75 60%, #00d2d3 100%);
}

/* ==========================================================================
   CARD BODY & CONTENT
   ========================================================================== */
.fg-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.fg-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.fg-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--navy-title);
    line-height: 1.35;
    flex: 1;
}

/* Category Badges */
.fg-badge {
    flex-shrink: 0;
    font-size: 11.5px;
    font-weight: 600;
    padding: 3px 12px;
    border-radius: 999px;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.badge-govt {
    background: #d4f7ed;
    color: #0d7a68;
}

.badge-intl {
    background: #e0f2fe;
    color: #0284c7;
}

.badge-academic {
    background: #ede9fe;
    color: #7c3aed;
}

/* Metadata Rows */
.fg-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.fg-meta-row {
    font-size: 0.83rem;
    line-height: 1.55;
    color: #475569;
}

.fg-meta-label {
    font-weight: 500;
    color: #475569;
    margin-right: 5px;
}

.fg-val-investigator {
    font-style: italic;
    color: #475569;
}

.fg-meta-val {
    color: #334155;
}

.fg-val-amount {
    font-weight: 600;
    color: var(--navy-title);
}

/* Attachments */
.fg-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed #e2e8f0;
}

.fg-attach-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #dc2626;
    text-decoration: none;
    transition: color 0.2s, gap 0.2s;
}

.fg-attach-btn i {
    font-size: 12px;
}

.fg-attach-btn:hover {
    color: #991b1b;
    gap: 8px;
}

/* ==========================================================================
   EMPTY & NO RESULTS
   ========================================================================== */
.fg-empty,
.fg-no-results {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 70px 20px;
    color: #94a3b8;
    gap: 12px;
    grid-column: 1 / -1;
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-card);
}

.fg-empty {
    display: flex;
}

.fg-no-results.visible {
    display: flex;
}

.fg-empty i,
.fg-no-results i {
    font-size: 42px;
    opacity: 0.35;
}

.fg-empty h3,
.fg-no-results h3 {
    font-size: 1.15rem;
    color: #334155;
    font-weight: 600;
}

.fg-empty p,
.fg-no-results p {
    font-size: 0.9rem;
}

.fg-no-results button {
    background: none;
    border: none;
    color: #2563eb;
    font-weight: 600;
    cursor: pointer;
    font-size: inherit;
    text-decoration: underline;
    padding: 0;
}

/* ==========================================================================
   RESPONSIVE DESIGN (Zero horizontal overflow)
   ========================================================================== */
@media (max-width: 992px) {
    .fg-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .fg-hero-title {
        font-size: 2.1rem;
    }

    .fg-hero-banner {
        padding: 36px 0 42px;
        background-image:
            linear-gradient(to bottom, rgba(3, 20, 42, 0.96) 0%, rgba(6, 35, 75, 0.92) 100%),
            url('../images/funding_banner.jpg');
    }

    .fg-search-wrap {
        justify-content: stretch;
    }

    .fg-search-box {
        max-width: 100%;
    }
}

@media (max-width: 580px) {
    .fg-hero-title {
        font-size: 1.75rem;
    }

    .fg-hero-subtitle {
        font-size: 0.95rem;
        margin-bottom: 18px;
    }

    .fg-card {
        padding: 16px;
        gap: 14px;
        align-items: flex-start;
    }

    .fg-icon-thumb {
        width: 80px;
        height: 72px;
        border-radius: 10px;
    }

    .fg-icon-thumb i {
        font-size: 1.7rem;
    }

    .fg-title {
        font-size: 0.95rem;
    }

    .fg-meta-row {
        font-size: 0.8rem;
    }

    .fg-main {
        padding: 24px 0 60px;
    }
}

@media (max-width: 400px) {
    .fg-card {
        flex-direction: column;
        align-items: stretch;
    }

    .fg-icon-thumb {
        width: 100%;
        height: 75px;
    }

    .fg-stat-pill {
        font-size: 12px;
        padding: 6px 14px;
    }
}