/* Общински съвет – Пазарджик · Документи — цветове по obspazardzhik.com */
:root {
  --green: #0b5e35;
  --green-dark: #062f1c;
  --green-hover: #08482a;
  --ink: #18221d;
  --ink-2: #47564e;
  --muted: #6b7a72;
  --line: #c7d8ce;
  --line-2: #dbe7e0;
  --soft: #f1f6f3;
  --soft-2: #e8f2ec;
  --gold: #a8822a;
  --gold-soft: #f6efdc;
  --danger: #a3271f;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(6, 47, 28, .06), 0 4px 16px rgba(6, 47, 28, .06);
  --sans: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "PT Serif", Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.6 var(--sans);
  color: var(--ink);
  background: #fff;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
a { color: var(--green); }
a:hover { color: var(--green-hover); }
img, svg { max-width: 100%; }
.wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { position: fixed !important; top: 8px; left: 8px; width: auto; height: auto; clip: auto; z-index: 100; background: #fff; padding: 8px 14px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.nowrap { white-space: nowrap; }

/* ---------- шапка */
.masthead { background: #fff; border-bottom: 1px solid var(--line-2); }
.masthead-in { display: flex; align-items: center; gap: 24px; padding-top: 16px; padding-bottom: 16px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); margin-right: auto; }
.brand-crest { width: 48px; height: auto; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 22px; color: var(--green-dark); }
.brand-tag { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-top: 3px; }
.masthead-search { display: flex; flex: 0 1 380px; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--soft); }
.masthead-search input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 10px 16px; font: inherit; font-size: 15px; color: var(--ink); outline: none; }
.masthead-search button { border: 0; background: var(--green); color: #fff; padding: 0 16px; cursor: pointer; display: grid; place-items: center; }
.masthead-search button:hover { background: var(--green-hover); }
.masthead-search:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(11, 94, 53, .15); }

.mainnav { background: var(--green); }
.nav-list { list-style: none; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 2px; padding-top: 0; padding-bottom: 0; }
.nav-list a { display: block; color: #fff; text-decoration: none; padding: 12px 14px; font-weight: 500; font-size: 15px; border-bottom: 3px solid transparent; }
.nav-list a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.nav-list a[aria-current="page"] { border-bottom-color: var(--gold); background: rgba(0, 0, 0, .12); }

/* ---------- съдържание */
.main { flex: 1; padding-top: 32px; padding-bottom: 56px; }
h1, h2, h3 { font-family: var(--serif); color: var(--green-dark); line-height: 1.25; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-bottom: 2px solid var(--green); padding-bottom: 12px; margin-bottom: 8px; }
.page-head h1 { margin: 0; font-size: 30px; }
.page-head p { margin: 0; }

/* ---------- списък документи */
.doc-list { list-style: none; margin: 0; padding: 0; }
.month-sep { display: flex; align-items: center; gap: 12px; margin: 28px 0 12px; color: var(--gold); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .1em; }
.month-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.doc-list > li + li:not(.month-sep) { margin-top: 16px; }

.doc-card {
  display: grid; grid-template-columns: 76px 1fr; gap: 20px;
  background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--green);
  border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.doc-card:hover { border-color: var(--green); box-shadow: 0 6px 24px rgba(6, 47, 28, .12); }
.doc-card.is-latest { border-left-color: var(--gold); background: linear-gradient(180deg, var(--gold-soft) 0, #fff 120px); }
.doc-date {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--soft-2); border-radius: 8px; padding: 10px 4px; height: max-content; text-align: center; line-height: 1.1;
}
.doc-date .d { font-family: var(--serif); font-size: 30px; font-weight: 700; color: var(--green); }
.doc-date .m { font-size: 13px; text-transform: uppercase; font-weight: 600; color: var(--green-dark); margin-top: 2px; }
.doc-date .y { font-size: 12px; color: var(--muted); margin-top: 2px; }
.doc-body { min-width: 0; }
.doc-body h2 { margin: 6px 0 8px; font-size: 21px; }
.doc-body h2 a { color: var(--green-dark); text-decoration: none; }
.doc-body h2 a:hover { color: var(--green); text-decoration: underline; text-underline-offset: 3px; }
.doc-summary { margin: 0 0 14px; color: var(--ink-2); }

.doc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--soft-2); color: var(--green); font-weight: 600; font-size: 12px; text-decoration: none; border: 1px solid var(--line); }
a.badge:hover { background: var(--green); color: #fff; border-color: var(--green); }
.badge-new { background: var(--gold); color: #fff; border-color: var(--gold); }
.badge-file { background: #fff; color: var(--ink-2); font-weight: 500; }

.doc-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- бутони */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 10px 18px; border-radius: 8px; border: 1px solid var(--green);
  background: var(--green); color: #fff; font: inherit; font-weight: 600; font-size: 15px;
  text-decoration: none; cursor: pointer; line-height: 1.2;
}
.btn:hover { background: var(--green-hover); border-color: var(--green-hover); color: #fff; }
.btn-ghost { background: #fff; color: var(--green); }
.btn-ghost:hover { background: var(--soft-2); color: var(--green-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #7f1d17; border-color: #7f1d17; }
.btn-sm { padding: 6px 12px; font-size: 14px; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(168, 130, 42, .55); outline-offset: 2px; }

.pager { display: flex; justify-content: center; align-items: center; gap: 20px; margin-top: 32px; color: var(--muted); }
.pager a { font-weight: 600; text-decoration: none; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; }
.pager a:hover { background: var(--soft-2); }

.empty { text-align: center; padding: 48px 20px; background: var(--soft); border: 1px dashed var(--line); border-radius: var(--radius); margin-top: 24px; color: var(--ink-2); }

/* ---------- единичен документ */
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 16px; }
.crumbs a { text-decoration: none; }
.doc-full { max-width: 900px; }
.doc-full-head h1 { font-size: 32px; margin: 10px 0 20px; }
.download-box {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--soft); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 28px;
}
.file-ico { width: 52px; height: 60px; border-radius: 6px; background: var(--green); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; position: relative; }
.file-ico::after { content: ""; position: absolute; top: 0; right: 0; border-style: solid; border-width: 0 14px 14px 0; border-color: transparent var(--soft) rgba(255, 255, 255, .35) transparent; }
.file-info { display: flex; flex-direction: column; min-width: 0; flex: 1 1 200px; }
.file-info strong { overflow-wrap: anywhere; }
.file-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.doc-text {
  background: #fff; border: 1px solid var(--line-2); border-radius: var(--radius);
  padding: 32px 36px; font-family: var(--serif); font-size: 17px; line-height: 1.7; color: var(--ink);
  box-shadow: var(--shadow);
}
.doc-text p { margin: 0 0 1em; white-space: pre-line; overflow-wrap: anywhere; }
.doc-text p:last-child { margin-bottom: 0; }
.back { margin-top: 28px; }

/* ---------- футър */
.site-footer { background: var(--green-dark); color: #cfe0d6; font-size: 14px; border-top: 4px solid var(--gold); }
.footer-in { padding-top: 22px; padding-bottom: 22px; text-align: center; }
.footer-in p { margin: 0; }

/* ---------- админ */
.admin .main { max-width: 1160px; }
.admin-user { display: flex; align-items: center; gap: 12px; }
.admin-user form { margin: 0; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 26px; box-shadow: var(--shadow); margin-bottom: 24px; }
.card h1 { margin-top: 0; font-size: 26px; }
.card.narrow, .card.login { max-width: 460px; margin-left: auto; margin-right: auto; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.card-head h1 { margin: 0; }
.card label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 16px; color: var(--green-dark); }
.card label .muted { font-weight: 400; }
.card input:not([type=checkbox]):not([type=file]), .card select, .card textarea {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px; font: inherit; font-weight: 400;
  color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 8px;
}
.card textarea { resize: vertical; line-height: 1.5; }
.card textarea.mono { font-family: ui-monospace, Consolas, "Courier New", monospace; font-size: 14px; }
.card input:focus, .card select:focus, .card textarea:focus { border-color: var(--green); outline: none; box-shadow: 0 0 0 3px rgba(11, 94, 53, .15); }
.card label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; color: var(--ink); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 26px; text-align: center; background: var(--soft); cursor: pointer; }
.drop:hover { border-color: var(--green); }
.drop input { margin: 0 auto 8px; display: block; max-width: 100%; }
.drop span { font-weight: 400; color: var(--muted); }
.form-actions { display: flex; gap: 12px; }
.danger-zone { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--soft); }
.danger-zone form { margin: 0; }
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; border: 1px solid; }
.alert-ok { background: var(--soft-2); border-color: var(--line); color: var(--green-dark); }
.alert-warn { background: var(--gold-soft); border-color: #e3d2a3; color: #6b5317; }
.alert-err { background: #fbeceb; border-color: #efc4c0; color: var(--danger); }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th, .tbl td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl th { background: var(--soft); color: var(--green-dark); font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--soft); }
.tbl a { text-decoration: none; }
.tag-warn { color: #6b5317; background: var(--gold-soft); padding: 2px 8px; border-radius: 999px; font-size: 13px; }

/* ---------- мобилни */
@media (max-width: 760px) {
  .wrap { padding: 0 16px; }
  .masthead-in { flex-wrap: wrap; gap: 14px; }
  .masthead-search { flex: 1 1 100%; }
  .brand-name { font-size: 18px; }
  .brand-crest { width: 40px; }
  .nav-list { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .nav-list a { white-space: nowrap; padding: 11px 12px; }
  .page-head h1 { font-size: 24px; }
  .doc-card { grid-template-columns: 1fr; gap: 12px; padding: 16px; }
  .doc-date { flex-direction: row; gap: 6px; justify-content: flex-start; padding: 6px 12px; width: max-content; }
  .doc-date .d { font-size: 18px; }
  .doc-date .m, .doc-date .y { margin: 0; font-size: 13px; }
  .doc-body h2 { font-size: 19px; }
  .doc-actions .btn { flex: 1 1 auto; }
  .doc-full-head h1 { font-size: 25px; }
  .doc-text { padding: 20px 18px; font-size: 16px; }
  .row { grid-template-columns: 1fr; }
  .card { padding: 18px; }
}

/* ---------- зона за влачене */
.drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 34px 20px; transition: background .15s, border-color .15s; }
.drop input[type=file] { order: 4; margin: 8px auto 0; font-size: 14px; }
.drop .drop-title { color: var(--green-dark); font-size: 17px; }
.drop .drop-hint { color: var(--muted); font-weight: 400; font-size: 14px; }
.drop .drop-file { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.drop.drag { border-color: var(--green); background: var(--soft-2); border-style: solid; }
.drop.has-file { border-color: var(--green); border-style: solid; background: var(--soft-2); }
.drop.has-file .drop-file { color: var(--green); }
.drop.bad-file { border-color: var(--danger); background: #fbeceb; }
.drop.bad-file .drop-file { color: var(--danger); }
.btn:disabled { opacity: .7; cursor: wait; }

/* ---------- цялата карта е кликаема (линкът на заглавието се разпъва върху картата) */
.doc-card { position: relative; cursor: pointer; }
.doc-body h2 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: 0; }
.doc-card .doc-actions, .doc-card a.badge { position: relative; z-index: 1; }
.doc-card:hover h2 a { color: var(--green); text-decoration: underline; text-underline-offset: 3px; }
.doc-card:hover { transform: translateY(-1px); }
.doc-body h2 a:focus-visible { outline: none; }
.doc-card:has(h2 a:focus-visible) { outline: 3px solid rgba(168, 130, 42, .55); outline-offset: 2px; }
.doc-list > .month-sep:first-child { margin-top: 0; }
