/* ==========================================================================
   DOCUMENTS PAGE — Mpohor Fiase District Assembly
   --------------------------------------------------------------------------
   One stylesheet for the whole Documents page (gradient header, search +
   category toolbar, and the document list). Only used by documents.php.

   HOW TO EDIT (for new developers)
   --------------------------------------------------------------------------
   1. Every colour and font on this page lives in the :root variables
      below, pulled from the Assembly crest (forest green + palm-fruit
      gold). Change a value there and the whole page updates.
   2. The gradient header and the document list are separate, clearly
      labelled sections below — jump to the one you need with Ctrl+F.
   3. Every class is prefixed "mfda" (Mpohor Fiase District Assembly) so
      it can't clash with the shared header.php / footer.php styles.
   ========================================================================== */

:root {
    --mfda-green: #145C34;        /* primary green, from the crest ring */
    --mfda-green-dark: #0B3D22;   /* headings, hovers */
    --mfda-green-pale: #E9F2EC;   /* soft section tints */
    --mfda-gold: #C8651C;         /* palm-fruit accent, sparingly */
    --mfda-gold-pale: #F8ECDD;    /* accent tint for docx badge / eyebrow */
    --mfda-cream: #FBF8F1;        /* page background */
    --mfda-ink: #1B2A21;          /* body text */
    --mfda-ink-soft: #57685D;     /* secondary text */
    --mfda-line: #DEE7DF;         /* hairlines / borders */
    --mfda-radius: 14px;
    --mfda-font-display: 'Fraunces', Georgia, serif;
    --mfda-font-body: 'DM Sans', sans-serif;
}

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

/* --------------------------------------------------------------------------
   1. GRADIENT HEADER (replaces the shared image page-header on this page)
   -------------------------------------------------------------------------- */
.mfda-header {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--mfda-green-dark) 0%, var(--mfda-green) 55%, #1E7A46 100%);
    padding: 64px 0 54px;
}

.mfda-header::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(120% 140% at 100% 0%, rgba(200, 101, 28, .25) 0%, rgba(200, 101, 28, 0) 55%);
    pointer-events: none;
}

.mfda-header .mfda-container {
    position: relative;
}

.mfda-header__eyebrow {
    display: inline-block;
    font-family: var(--mfda-font-body);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--mfda-green-dark);
    background: var(--mfda-gold-pale);
    border: 1px solid rgba(255, 255, 255, .4);
    border-radius: 999px;
    padding: 5px 14px;
    margin: 0 0 14px;
}

.mfda-header h1 {
    font-family: var(--mfda-font-display);
    font-weight: 600;
    font-size: clamp(28px, 4vw, 40px);
    color: #fff;
    margin: 0 0 14px;
}

.mfda-header__breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--mfda-font-body);
    font-size: 13px;
    color: rgba(255, 255, 255, .72);
    list-style: none;
    margin: 0;
    padding: 0;
}

.mfda-header__breadcrumb a {
    color: rgba(255, 255, 255, .92);
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, .35);
    transition: border-color .15s ease;
}

.mfda-header__breadcrumb a:hover {
    border-color: var(--mfda-gold);
}

/* --------------------------------------------------------------------------
   2. PAGE BASE
   -------------------------------------------------------------------------- */
.mfda-docs {
    background: var(--mfda-cream);
    font-family: var(--mfda-font-body);
    color: var(--mfda-ink);
    padding: 48px 0 100px;
}

/* ---------- Intro strip ---------- */
.mfda-docs .mfda-intro {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 32px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--mfda-line);
}

.mfda-docs .mfda-intro h2 {
    font-family: var(--mfda-font-display);
    font-weight: 600;
    font-size: 26px;
    color: var(--mfda-green-dark);
    margin: 0 0 6px;
}

.mfda-docs .mfda-intro p {
    margin: 0;
    color: var(--mfda-ink-soft);
    max-width: 46ch;
}

.mfda-docs .mfda-count {
    font-family: var(--mfda-font-display);
    font-size: 15px;
    color: var(--mfda-green);
    background: var(--mfda-green-pale);
    border: 1px solid var(--mfda-line);
    padding: 8px 16px;
    border-radius: 999px;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   3. STICKY TOOLBAR — search + category chips
   -------------------------------------------------------------------------- */
.mfda-docs .mfda-toolbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--mfda-cream);
    padding: 16px 0;
    margin-bottom: 30px;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
    transition: box-shadow .3s ease, background-color .3s ease;
}

/* Added by JS once the page has scrolled a little, so the sticky bar
   visibly lifts off the content instead of blending flat into it. */
.mfda-docs .mfda-toolbar.is-scrolled {
    background: rgba(251, 248, 241, .92);
    backdrop-filter: blur(8px);
    box-shadow: 0 12px 22px -18px rgba(11, 61, 34, .45);
}

.mfda-docs .mfda-search {
    position: relative;
    flex: 1 1 260px;
    max-width: 360px;
}

.mfda-docs .mfda-search input {
    width: 100%;
    padding: 11px 16px 11px 40px;
    border-radius: 999px;
    border: 1px solid var(--mfda-line);
    background: #fff;
    font-family: var(--mfda-font-body);
    font-size: 14px;
    color: var(--mfda-ink);
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.mfda-docs .mfda-search input:focus {
    border-color: var(--mfda-green);
    box-shadow: 0 0 0 3px var(--mfda-green-pale);
}

.mfda-docs .mfda-search i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--mfda-ink-soft);
    font-size: 13px;
}

.mfda-docs .mfda-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.mfda-docs .mfda-chip {
    font-family: var(--mfda-font-body);
    font-size: 13px;
    font-weight: 500;
    padding: 8px 15px;
    border-radius: 999px;
    border: 1px solid var(--mfda-line);
    background: #fff;
    color: var(--mfda-ink-soft);
    cursor: pointer;
    transition: background-color .2s cubic-bezier(.22, 1, .36, 1),
                border-color .2s cubic-bezier(.22, 1, .36, 1),
                color .2s cubic-bezier(.22, 1, .36, 1),
                transform .15s ease;
}

.mfda-docs .mfda-chip:hover {
    border-color: var(--mfda-green);
    color: var(--mfda-green-dark);
}

.mfda-docs .mfda-chip:active {
    transform: scale(.96);
}

.mfda-docs .mfda-chip.is-active {
    background: var(--mfda-green);
    border-color: var(--mfda-green);
    color: #fff;
}

/* --------------------------------------------------------------------------
   4. SECTIONS — each category renders inside its own bordered container
   -------------------------------------------------------------------------- */
.mfda-docs .mfda-section {
    margin-bottom: 28px;
    background: #fff;
    border: 1px solid var(--mfda-line);
    border-radius: var(--mfda-radius);
    padding: 26px 26px 28px;
    box-shadow: 0 1px 2px rgba(11, 61, 34, .04);
    /* Each freshly-rendered section (after a search/filter change) fades
       and lifts into place — see --s (set in JS) for the per-section
       stagger, capped with min() so it never drags on the page. */
    animation: mfdaFadeUp .5s cubic-bezier(.22, 1, .36, 1) both;
    animation-delay: calc(min(var(--s, 0) * 70ms, 280ms));
}

.mfda-docs .mfda-section__head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--mfda-line);
}

.mfda-docs .mfda-section__head .mfda-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--mfda-gold);
    flex: none;
}

.mfda-docs .mfda-section__head h2 {
    font-family: var(--mfda-font-display);
    font-weight: 600;
    font-size: 21px;
    color: var(--mfda-green-dark);
    margin: 0;
}

.mfda-docs .mfda-section__head span {
    font-size: 13px;
    color: var(--mfda-ink-soft);
}

/* --------------------------------------------------------------------------
   5. DOCUMENT LIST — one full-width horizontal row per document
   -------------------------------------------------------------------------- */
.mfda-docs .mfda-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mfda-docs .mfda-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff;
    border: 1px solid var(--mfda-line);
    border-left: 4px solid var(--mfda-green);
    border-radius: 10px;
    padding: 12px 18px;
    text-decoration: none;
    color: var(--mfda-ink);
    transition: transform .2s cubic-bezier(.22, 1, .36, 1),
                box-shadow .2s cubic-bezier(.22, 1, .36, 1),
                border-color .2s ease;
    /* Rows fade + settle in too, staggered slightly behind their section
       (--c is the row's index within its section, set in JS). */
    animation: mfdaFadeUp .4s cubic-bezier(.22, 1, .36, 1) both;
    animation-delay: calc(min(var(--s, 0) * 70ms, 280ms) + min(var(--c, 0) * 25ms, 320ms) + 60ms);
}

.mfda-docs .mfda-row:hover {
    transform: translateX(4px);
    box-shadow: 0 10px 22px -16px rgba(11, 61, 34, .35);
    border-color: var(--mfda-green);
    color: var(--mfda-ink);
    text-decoration: none;
}

.mfda-docs .mfda-row.type-docx { border-left-color: var(--mfda-gold); }
.mfda-docs .mfda-row.type-xls  { border-left-color: #2E7D5B; }

.mfda-docs .mfda-badge {
    flex: none;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--mfda-green-pale);
    color: var(--mfda-green);
    font-size: 15px;
    transition: transform .2s cubic-bezier(.22, 1, .36, 1);
}

.mfda-docs .mfda-row:hover .mfda-badge {
    transform: scale(1.08);
}

.mfda-docs .mfda-row.type-docx .mfda-badge {
    background: var(--mfda-gold-pale);
    color: var(--mfda-gold);
}

.mfda-docs .mfda-row.type-xls .mfda-badge {
    background: #E7F3ED;
    color: #2E7D5B;
}

.mfda-docs .mfda-row__title {
    flex: 1 1 auto;
    min-width: 0;
    font-family: var(--mfda-font-body);
    font-weight: 500;
    font-size: 14.5px;
    line-height: 1.4;
}

.mfda-docs .mfda-row__meta {
    flex: none;
    display: flex;
    align-items: center;
    gap: 12px;
}

.mfda-docs .mfda-filetype {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--mfda-ink-soft);
}

/* Ribbon-style date tag, echoing the banner under the crest */
.mfda-docs .mfda-ribbon {
    position: relative;
    font-size: 11px;
    color: #fff;
    background: var(--mfda-green);
    padding: 3px 10px 3px 8px;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 6px 100%, 0 70%);
    flex: none;
}

/* --------------------------------------------------------------------------
   6. EMPTY STATE
   -------------------------------------------------------------------------- */
.mfda-docs .mfda-empty {
    display: block;
    text-align: center;
    color: var(--mfda-ink-soft);
    border: 1px dashed transparent;
    border-radius: var(--mfda-radius);
    opacity: 0;
    transform: translateY(6px);
    max-height: 0;
    padding: 0 20px;
    overflow: hidden;
    pointer-events: none;
    /* Fades and grows open instead of an instant display:none/block snap,
       so clearing a search feels smooth rather than jumpy. */
    transition: opacity .3s ease, transform .3s ease,
                max-height .35s ease, padding .35s ease,
                border-color .35s ease;
}

.mfda-docs .mfda-empty.is-visible {
    opacity: 1;
    transform: translateY(0);
    max-height: 300px;
    padding: 60px 20px;
    border-color: var(--mfda-line);
    pointer-events: auto;
}

@keyframes mfdaFadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Respect people who've asked their OS for less motion */
@media (prefers-reduced-motion: reduce) {
    .mfda-docs .mfda-section,
    .mfda-docs .mfda-row {
        animation: none;
    }
    .mfda-docs .mfda-row,
    .mfda-docs .mfda-badge,
    .mfda-docs .mfda-chip,
    .mfda-docs .mfda-toolbar,
    .mfda-docs .mfda-empty,
    .mfda-docs .mfda-search input {
        transition: none;
    }
}

/* --------------------------------------------------------------------------
   7. RESPONSIVE
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
    .mfda-docs .mfda-row {
        flex-wrap: wrap;
    }
    .mfda-docs .mfda-row__meta {
        margin-left: 52px; /* lines up under the title, past the badge */
    }
}

@media (max-width: 600px) {
    .mfda-docs .mfda-section { padding: 20px 18px 22px; }
}

@media (max-width: 576px) {
    .mfda-docs .mfda-toolbar { position: static; }
    .mfda-header { padding: 48px 0 40px; }
    .mfda-header h1 { font-size: 26px; }
}
