/* ============================================================
   Dainų kaimo bendruomenė — dizaino sistema
   ------------------------------------------------------------
   Vienas šaltinis: spalvos, tipografija, tarpai, komponentai.
   Bootstrap 5 temizuojamas per --bs-* kintamuosius, todėl
   stilius savaime persiduoda kortelėms, mygtukams, forumui ir kt.
   ============================================================ */

/* ---------- 1. Dizaino ženklai (design tokens) ---------- */
:root {
    /* Prekės ženklo žalia – šiltesnė, „miško/šalavijo" atspalvio.
       --brand    : pagrindinė užpildo spalva (navbar, mygtukai)
       --brand-600/700 : tamsesni atspalviai (hover, tekstinės nuorodos) */
    --brand:        #2f7d4f;   /* pagrindinė */
    --brand-600:    #266a43;
    --brand-700:    #1d5535;   /* nuorodų tekstas – ≥4.5:1 ant balto */
    --brand-800:    #15402a;
    --brand-100:    #e7f2ec;   /* labai šviesus fonas (hero, subtle) */
    --brand-050:    #f3f8f5;

    /* Šiltas akcentas – terakota/medus, naudojamas saikingai (CTA, žymos) */
    --accent:       #c8602a;
    --accent-600:   #ad4f20;

    /* Šilti neutralūs tonai */
    --ink:          #20272b;   /* pagrindinis tekstas */
    --ink-soft:     #4b555c;   /* antrinis tekstas */
    --paper:        #fbfaf7;   /* puslapio fonas – šiltas, ne grynai baltas */
    --surface:      #ffffff;   /* kortelės */
    --line:         #e4e1da;   /* rėmeliai/skirtukai */

    /* Būsenų spalvos (einamiesiems klausimams) – atsietos nuo prekės žalios */
    --status-new:        #5b6770;   /* pilka – naujas */
    --status-progress:   #b9791b;   /* gintaras – sprendžiamas */
    --status-resolved:   #2f7d4f;   /* žalia – išspręstas */
    --status-rejected:   #b3402f;   /* plytinė – atmestas */

    /* Tarpai / radiusai / šešėliai */
    --radius:       0.75rem;
    --radius-sm:    0.5rem;
    --shadow-sm:    0 1px 2px rgba(20, 39, 27, .06), 0 1px 3px rgba(20, 39, 27, .08);
    --shadow:       0 4px 12px rgba(20, 39, 27, .08), 0 2px 4px rgba(20, 39, 27, .06);
    --shadow-lg:    0 16px 40px rgba(20, 39, 27, .14);

    /* Tipografija */
    --font-body:    "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-head:    "Fraunces", Georgia, "Times New Roman", serif;

    /* --- Bootstrap temos perrašymai (cascade į visus komponentus) --- */
    --bs-primary:           var(--brand);
    --bs-primary-rgb:       47, 125, 79;
    --bs-success:           var(--brand);
    --bs-success-rgb:       47, 125, 79;
    --bs-body-color:        var(--ink);
    --bs-body-color-rgb:    32, 39, 43;
    --bs-secondary-color:   var(--ink-soft);
    --bs-body-bg:           var(--paper);
    --bs-border-color:      var(--line);
    --bs-link-color:        var(--brand-700);
    --bs-link-color-rgb:    29, 85, 53;
    --bs-link-hover-color:  var(--brand-800);
    --bs-success-bg-subtle: var(--brand-100);
    --bs-emphasis-color:    var(--ink);
    --bs-font-sans-serif:   var(--font-body);
}

/* ---------- 1b. Lokaliai talpinami šriftai ----------
   Talpinami patys, kad išvengtume „šrifto šuolio" (FOUT) ir
   priklausomybės nuo Google Fonts. Variable šriftai – vienas failas
   dengia visą svorių diapazoną. font-display: optional reiškia, kad
   jei šriftas nespėja užsikrauti per ~100 ms, naršyklė lieka su
   atsarginiu ir nebepersijungia (jokio matomo šuolio). */
@font-face {
    font-family: "Source Sans 3";
    font-style: normal;
    font-weight: 400 700;
    font-display: optional;
    src: url("../fonts/sourcesans3-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Source Sans 3";
    font-style: normal;
    font-weight: 400 700;
    font-display: optional;
    src: url("../fonts/sourcesans3-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Fraunces";
    font-style: normal;
    font-weight: 500 700;
    font-display: optional;
    src: url("../fonts/fraunces-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Fraunces";
    font-style: normal;
    font-weight: 500 700;
    font-display: optional;
    src: url("../fonts/fraunces-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- 2. Bazė ---------- */
html {
    /* Visada rezervuoti vietą slinkties juostai, kad trumpi puslapiai
       (pvz. „Einamieji klausimai") nešokinėtų horizontaliai pereinant
       iš ilgesnių puslapių, kurie juostą turi. */
    scrollbar-gutter: stable;
}

body {
    font-family: var(--font-body);
    color: var(--ink);
    background-color: var(--paper);
    font-size: 1.0625rem;          /* 17px – patogiau vyresniems skaitytojams */
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--font-head);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--ink);
    line-height: 1.2;
}
h1, .h1 { font-weight: 600; }

main img { max-width: 100%; height: auto; }

/* Nuorodos: aiškus pabraukimas tik užvedus, matomas fokusas */
a { text-underline-offset: 0.18em; }
main a:not(.btn):not(.nav-link):not(.page-link):not(.dropdown-item):hover {
    text-decoration: underline;
}

/* Vieningas, matomas fokuso žiedas visur */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.form-control:focus-visible,
.page-link:focus-visible,
.nav-link:focus-visible {
    outline: 3px solid rgba(47, 125, 79, .45);
    outline-offset: 2px;
    box-shadow: none;
}

/* „Atgal" nuorodos detalių puslapiuose */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-weight: 600;
    color: var(--brand-700);
    text-decoration: none;
}
.back-link:hover { color: var(--brand-800); text-decoration: underline; }

/* ---------- 3. Navbar ---------- */
.site-nav {
    background: linear-gradient(180deg, var(--brand) 0%, var(--brand-600) 100%);
    box-shadow: var(--shadow-sm);
}
.site-nav .navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    font-family: var(--font-head);
    font-weight: 600;
    letter-spacing: -.01em;
    font-size: 1.2rem;
}
/* Mažuose telefonuose sutrumpinam prekės ženklo šriftą, kad netilptų į dvi eilutes */
@media (max-width: 400px) {
    .site-nav .navbar-brand { font-size: 1rem; }
    .site-nav .navbar-brand .brand-mark { width: 1.7rem; height: 1.7rem; }
}
.site-nav .navbar-brand .brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, .18);
    flex: 0 0 auto;
}
.site-nav .nav-link {
    font-weight: 500;
    border-radius: var(--radius-sm);
    padding-inline: .8rem;
    color: rgba(255, 255, 255, .88);
    transition: background-color .15s ease, color .15s ease;
}
.site-nav .nav-link:hover { color: #fff; background: rgba(255, 255, 255, .12); }
.site-nav .nav-link.active { color: #fff; background: rgba(255, 255, 255, .2); font-weight: 600; }
/* „Atsijungti" mygtukas atrodo kaip nav-link */
.site-nav .nav-logout {
    color: rgba(255, 255, 255, .88);
    border: 0;
    background: transparent;
    font-weight: 500;
    line-height: inherit;
}
.site-nav .nav-logout:hover { color: #fff; }
.site-nav .navbar-text { color: rgba(255, 255, 255, .8); }

/* ---------- 4. Hero (pradžios puslapis) ---------- */
.hero {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    background:
        linear-gradient(120deg, rgba(21, 64, 42, .82) 0%, rgba(47, 125, 79, .68) 60%, rgba(47, 125, 79, .45) 100%),
        radial-gradient(120% 120% at 80% 10%, var(--brand-600), var(--brand-800));
    color: #fff;
    box-shadow: var(--shadow);
}
.hero::after {                       /* subtilus šviesos atspindys (geometrinis, ne „kaimietiškas") */
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, transparent 40%, rgba(255,255,255,.07) 50%, transparent 60%);
    pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; padding: 3.5rem 2rem; }
.hero h1 {
    color: #fff;
    font-size: clamp(2rem, 4.5vw, 3.1rem);
    margin-bottom: .75rem;
}
.hero p { color: rgba(255, 255, 255, .92); max-width: 46ch; }
.hero .btn-light { font-weight: 600; }
.hero .btn-outline-light { font-weight: 600; }

/* ---------- 5. Mygtukai ---------- */
.btn {
    --bs-btn-font-weight: 600;
    border-radius: var(--radius-sm);
}
.btn-success, .btn-primary {
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-600);
    --bs-btn-hover-border-color: var(--brand-600);
    --bs-btn-active-bg: var(--brand-700);
    --bs-btn-active-border-color: var(--brand-700);
}
.btn-outline-success, .btn-outline-primary {
    --bs-btn-color: var(--brand-700);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand);
    --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-bg: var(--brand-600);
}
.btn-accent {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--accent);
    --bs-btn-border-color: var(--accent);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--accent-600);
    --bs-btn-hover-border-color: var(--accent-600);
    --bs-btn-active-bg: var(--accent-600);
    color: #fff;
}

/* ---------- 6. Kortelės ---------- */
.card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: box-shadow .18s ease, transform .18s ease;
}
.card-hover:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

/* Naujienų / turinio kortelė su nuoroda visu plotu */
.entry-card .stretched-link::after { border-radius: var(--radius); }
.entry-meta { color: var(--ink-soft); font-size: .9rem; }

/* ---------- 7. Skiltis / antraštės ---------- */
.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.1rem;
}
.section-head h2 { margin: 0; font-size: 1.5rem; }
.section-head .section-link { font-weight: 600; white-space: nowrap; }

.eyebrow {
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: .78rem;
    font-weight: 700;
    color: var(--brand-700);
    font-family: var(--font-body);
}

/* ---------- 8. Tuščios būsenos ---------- */
.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--ink-soft);
    background: var(--brand-050);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
}
.empty-state .empty-icon {
    font-size: 1.75rem;
    opacity: .55;
    display: block;
    margin-bottom: .5rem;
}

/* ---------- 9. Footer (kompaktiškas, viena juosta) ---------- */
.site-footer {
    background: var(--brand-800);
    color: rgba(255, 255, 255, .8);
    margin-top: auto;
    font-size: .9rem;
}
.site-footer a { color: rgba(255, 255, 255, .9); text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.site-footer .footer-copy { color: rgba(255, 255, 255, .7); }

/* ---------- 10. Būsenų žymos (badge) ---------- */
.badge-status {
    font-weight: 600;
    font-size: .82rem;
    padding: .4em .7em;
    border-radius: 999px;
    border: 1px solid transparent;
}
.badge-status.s-new        { background: #eef0f1; color: #3a444b; border-color: #dde1e3; }
.badge-status.s-progress   { background: #fbf0d8; color: #8a5a08; border-color: #f0dcae; }
.badge-status.s-resolved   { background: var(--brand-100); color: var(--brand-700); border-color: #c9e3d4; }
.badge-status.s-rejected   { background: #fbe3df; color: #9c3526; border-color: #f3c9c1; }

/* ---------- 11. Einamųjų klausimų „timeline" (eiga) ---------- */
.timeline {
    list-style: none;
    position: relative;
    padding-left: 1.75rem;
    margin: 0;
}
.timeline::before {
    content: "";
    position: absolute;
    left: 0.5rem;
    top: 0.25rem;
    bottom: 0.25rem;
    width: 2px;
    background: var(--line);
}
.timeline > li { position: relative; padding: 0 0 1.25rem 0; }
.timeline > li::before {
    content: "";
    position: absolute;
    left: -1.4rem;
    top: 0.35rem;
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 50%;
    background: var(--brand);
    border: 2px solid var(--surface);
    box-shadow: 0 0 0 1px var(--line);
}
/* taško spalva pagal būseną (jei nurodyta li klasė) */
.timeline > li.dot-resolved::before { background: var(--status-resolved); }
.timeline > li.dot-progress::before { background: var(--status-progress); }
.timeline > li.dot-rejected::before { background: var(--status-rejected); }
.timeline > li.dot-new::before      { background: var(--status-new); }
.timeline > li:last-child { padding-bottom: 0; }
.timeline-date {
    font-size: 0.8rem;
    color: var(--ink-soft);
}
.timeline-title { font-weight: 600; }
.timeline-body { color: var(--ink); margin-top: 0.25rem; }
.timeline-compact > li { padding-bottom: 0.5rem; font-size: 0.9rem; }
.timeline-compact .timeline-date { margin-right: 0.4rem; }

/* „Didelis" biudžeto timeline variantas – erdvesnis, su sumomis ir likučiu */
.timeline-lg { padding-left: 2.25rem; }
.timeline-lg::before { left: 0.7rem; width: 3px; }
.timeline-lg > li { padding-bottom: 1.75rem; }
.timeline-lg > li::before {
    left: -1.72rem;
    top: 0.3rem;
    width: 1rem;
    height: 1rem;
    border-width: 3px;
}
.timeline-lg .timeline-title { font-size: 1.05rem; }
/* biudžeto įvykių taškų spalvos */
.timeline > li.dot-income::before  { background: var(--status-resolved); }
.timeline > li.dot-expense::before { background: var(--status-rejected); }
.timeline > li.dot-start::before   { background: var(--status-new); }
/* sumos „lustas" timeline įvykio dešinėje */
.budget-amount {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    white-space: nowrap;
}
.budget-amount.is-income  { color: var(--status-resolved); }
.budget-amount.is-expense { color: var(--status-rejected); }
.budget-running {
    font-size: 0.8rem;
    color: var(--ink-soft);
    font-variant-numeric: tabular-nums;
}
/* santraukos kortelės virš timeline */
.budget-stat { text-align: center; }
.budget-stat .budget-stat-value {
    font-family: var(--font-head);
    font-size: 1.6rem;
    font-weight: 600;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.budget-stat .budget-stat-label {
    font-size: 0.8rem;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
/* suskleidimo rodyklė – pasisuka, kai sekcija atidaryta */
.budget-caret { transition: transform 0.18s ease; display: inline-block; }
[aria-expanded="false"] .budget-caret { transform: rotate(-90deg); }

/* ---------- 12. Renginių kalendorius (FullCalendar) ---------- */
.fc { --fc-border-color: var(--line); }
.fc .fc-toolbar-title { font-family: var(--font-head); font-size: 1.4rem; }
.fc .fc-button-primary {
    background: var(--brand);
    border-color: var(--brand);
    font-weight: 600;
    text-transform: none;
}
.fc .fc-button-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
    background: var(--brand-700);
    border-color: var(--brand-700);
}
.fc .fc-daygrid-day.fc-weekend { background-color: var(--brand-050); }
.fc .holiday-event { opacity: 1; }
.fc-daygrid-day.fc-day-has-holiday { background-color: rgba(179, 64, 47, .07); }
.fc .fc-daygrid-day.fc-day-today { background-color: var(--brand-100); }
.fc a { text-decoration: none !important; }
.fc .fc-list-event-title a,
.fc .fc-list-event-title a:hover {
    color: var(--brand-700) !important;
    text-decoration: none !important;
}
.fc .fc-list-day-text,
.fc .fc-list-day-side-text {
    color: var(--ink) !important;
    text-decoration: none !important;
}
.fc a.fc-daygrid-day-number,
.fc a.fc-col-header-cell-cushion,
.fc .fc-daygrid-day-number,
.fc .fc-col-header-cell-cushion {
    color: var(--ink) !important;
    text-decoration: none !important;
    cursor: default !important;
}
.fc a.fc-daygrid-day-number:hover,
.fc a.fc-col-header-cell-cushion:hover {
    color: var(--ink) !important;
    text-decoration: none !important;
}
.fc a.fc-col-header-cell-cushion,
.fc .fc-col-header-cell-cushion {
    color: var(--ink-soft) !important;
}

/* ---------- 13. Forumas (django-machina) ---------- */
/* --- Bootstrap 4 -> 5 tarpų/padėties klasės (machina markup'ui) --- */
.mr-1 { margin-right: .25rem !important; }
.mr-2 { margin-right: .5rem !important; }
.mr-3 { margin-right: 1rem !important; }
.mr-sm-2 { margin-right: .5rem !important; }
.ml-1 { margin-left: .25rem !important; }
.ml-2 { margin-left: .5rem !important; }
.ml-3 { margin-left: 1rem !important; }
.pl-0 { padding-left: 0 !important; }
.pr-0 { padding-right: 0 !important; }
.pr-3 { padding-right: 1rem !important; }
.float-right { float: right !important; }
.float-left { float: left !important; }
.text-nowrap { white-space: nowrap !important; }

.card.forumlist {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
.card.forumlist .card-header {
    background-color: var(--brand);
    color: #fff;
    font-weight: 600;
}
.card.forumlist .card-header .card-title,
.card.forumlist .card-header .card-title a { color: #fff !important; }
.card.forumlist .card-header .forum-count-col,
.card.forumlist .card-header .forum-last-post-col {
    color: rgba(255, 255, 255, .85);
    font-size: .85rem;
    align-self: center;
}
.forum-data-table { width: 100%; }
.forum-name-link {
    font-weight: 600;
    color: var(--brand-700);
    text-decoration: none;
}
.forum-name-link:hover { text-decoration: underline; }
.forum-description { color: var(--ink-soft); font-size: .9rem; }
.forum-icon i { color: var(--brand); }
.row.border-bottom:last-child { border-bottom: 0 !important; }
.topic-name a, .topiclist .topic-name { color: var(--brand-700); text-decoration: none; font-weight: 600; }
.post .card-header, .topic .card-header { background-color: var(--brand-100); }
.post-content, .content { line-height: 1.6; }
.page-header {
    border-bottom: 2px solid var(--brand);
    padding-bottom: .35rem;
    margin-top: 1.5rem;
    color: var(--brand-700);
    font-family: var(--font-head);
}
.statistics { color: var(--ink-soft); }
#main_container .btn-primary {
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-600);
    --bs-btn-hover-border-color: var(--brand-600);
    --bs-btn-active-bg: var(--brand-700);
}
.breadcrumb { background: transparent; padding-left: 0; }
.breadcrumb a { color: var(--brand-700); text-decoration: none; }
.forum-toolbar { min-height: 3rem; }
.forum-toolbar-breadcrumb { margin-bottom: 0; }
.forum-toolbar-breadcrumb .breadcrumb {
    margin-bottom: 0;
    align-items: center;
    flex-wrap: wrap;
    line-height: 1.5;
}
.forum-toolbar-breadcrumb .breadcrumb-item,
.forum-toolbar-breadcrumb .breadcrumb-item a {
    display: inline-flex;
    align-items: center;
}
.forum-toolbar-breadcrumb .breadcrumb-item.active { color: var(--ink-soft); }
