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

/* =============================================================================
   Съюз за бойно другарство "Тихина 1970"
   Основен стилов файл — публичен сайт и администраторски панел.

   Съдържание:
     1.  Променливи (дизайн токени)
     2.  Reset и база
     3.  Помощни класове и икони
     4.  Бягащ текст
     5.  Оформление (3 колони)
     6.  Ляв бар: бранд и навигация
     7.  Централна зона и панели
     8.  Бутони
     9.  Карти с обяви
     10. Десен бар
     11. Модален прозорец
     12. Формуляри
     13. Страница „Устав“
     14. Администраторски панел
     15. Отзивчивост (media queries)
   ============================================================================ */

/* --- 1. Променливи -------------------------------------------------------- */
:root {
  /* Фонове */
  --bg-dark: #090D16;
  --bg-card: #111827;
  --bg-card-hover: #1F2937;
  --bg-glass: rgba(17, 24, 39, 0.92);
  --bg-inset: rgba(0, 0, 0, 0.22);

  /* Злато — водещият акцент на марката */
  --gold-primary: #D4AF37;
  --gold-light: #F5E08C;
  --gold-dark: #9A7B1C;
  --gold-glow: rgba(212, 175, 55, 0.4);

  --border-color: rgba(212, 175, 55, 0.25);
  --border-hover: rgba(212, 175, 55, 0.6);
  --border-subtle: rgba(255, 255, 255, 0.08);

  /* Допълнителни цветове */
  --olive-accent: #4A5D3E;
  --olive-bright: #688358;
  --red-accent: #991B1B;
  --green-bright: #A3E635;
  --amber: #EAB308;
  --amber-light: #FDE047;

  /* Текст */
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-soft: #D1D5DB;

  /* Скала за отстояния */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;

  /* Радиуси */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  /* Сенки */
  --shadow-main: 0 10px 30px -10px rgba(0, 0, 0, 0.8);
  --shadow-gold: 0 0 25px rgba(212, 175, 55, 0.3);
  --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.3);

  /* Шрифтове */
  --font-heading: 'Montserrat', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;

  /* Размери на оформлението */
  --sidebar-width: 330px;
  --column-height: 730px;
  --max-width: 1650px;
}

/* --- 2. Reset и база ------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  background-image:
    radial-gradient(circle at 15% 15%, rgba(74, 93, 62, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(212, 175, 55, 0.08) 0%, transparent 40%);
  background-attachment: fixed;
}

body.modal-open {
  overflow: hidden;
}

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

a {
  color: var(--gold-primary);
}

/* Видим фокус за навигация с клавиатура — важно за достъпност. */
:focus-visible {
  outline: 2px solid var(--gold-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection {
  background: rgba(212, 175, 55, 0.3);
  color: #fff;
}

/* --- Скролбар -------------------------------------------------------------
   Показва се само златистият плъзгач: без стрелки в двата края и без тъмна
   писта. Валидно за цялата страница и за всички превъртащи се блокове.        */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--gold-primary) transparent;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track,
::-webkit-scrollbar-corner {
  background: transparent;
  box-shadow: none;
  border: none;
}

::-webkit-scrollbar-thumb {
  background-color: var(--gold-primary);
  border-radius: var(--radius-pill);
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--gold-light);
}

/* Премахва стрелките в горния и долния край на лентата. */
::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

/* --- 3. Помощни класове и икони ------------------------------------------ */
.tihina-icon {
  flex-shrink: 0;
  vertical-align: -0.15em;
}

.icon-gold {
  color: var(--gold-primary);
  filter: drop-shadow(0 0 6px rgba(212, 175, 55, 0.5));
}

.mb-0 { margin-bottom: 0 !important; }

.link-gold {
  color: var(--gold-primary);
  text-decoration: none;
  font-weight: 700;
  word-break: break-word;
}

.link-gold:hover {
  color: var(--gold-light);
  text-decoration: underline;
}

/* Адресът води към Google Карти — в основен цвят, за да не се чете като
   бутон, но с ясен знак, че се отваря външна страница. */
.link-address {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  color: var(--text-soft);
  text-decoration: none;
  border-bottom: 1px dashed var(--border-color);
  transition: color 0.25s ease, border-color 0.25s ease;
}

.link-address .tihina-icon {
  color: var(--gold-primary);
  opacity: 0.8;
}

.link-address:hover,
.link-address:focus-visible {
  color: var(--gold-light);
  border-bottom-color: var(--gold-primary);
}

.link-address:hover .tihina-icon { opacity: 1; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-6) var(--sp-4);
  background: var(--bg-dark);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-align: center;
  font-size: 0.9rem;
}

/* Скрито поле-примамка за ботове */
.honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* --- 4. Бягащ текст ------------------------------------------------------- */
.top-ticker-bar {
  width: 100%;
  background: linear-gradient(90deg, #060911 0%, #111827 50%, #060911 100%);
  border-bottom: 1px solid var(--border-color);
  padding: var(--sp-1) 0;
  overflow: hidden;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  position: relative;
  z-index: 101;
}

.top-ticker-content {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  white-space: nowrap;
  animation: tickerScroll 32s linear infinite;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gold-light);
  letter-spacing: 0.4px;
  padding-left: 100%;
}

.top-ticker-bar:hover .top-ticker-content,
.top-ticker-bar:focus-within .top-ticker-content {
  animation-play-state: paused;
}

@keyframes tickerScroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-100%); }
}

/* --- 5. Оформление (3 колони) -------------------------------------------- */
.portal-3column-layout {
  width: 100%;
  max-width: var(--max-width);
  margin: var(--sp-5) auto var(--sp-6);
  padding: 0 var(--sp-5);
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--sidebar-width);
  gap: var(--sp-5);
  align-items: stretch;
}

.side-bar-column {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  height: var(--column-height);
  overflow-y: auto;
  box-shadow: var(--shadow-main);
  position: relative;
}

#board-bar {
  display: flex;
  flex-direction: column;
}


/* Бутон за мобилно меню — скрит на голям екран */
.mobile-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  width: 100%;
  margin: 0 0 var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--gold-light);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
}

/* --- 6. Ляв бар: бранд и навигация --------------------------------------- */
.sidebar-brand-block {
  padding-bottom: var(--sp-4);
  margin-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border-color);
  width: 100%;
}

.sidebar-brand-block .nav-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  text-decoration: none;
  color: var(--text-main);
  width: 100%;
  text-align: center;
}

.nav-title h1 {
  font-family: var(--font-heading);
  font-size: 1.55rem;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #FFFFFF 0%, var(--gold-light) 60%, var(--gold-primary) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
}

.nav-title p {
  font-size: 0.78rem;
  color: var(--gold-light);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-weight: 700;
  line-height: 1.2;
  margin-top: var(--sp-1);
}

.sidebar-full-logo {
  width: 82%;
  max-width: 240px;
  height: auto;
  margin: 0 auto;
  display: block;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.nav-brand:hover .sidebar-full-logo {
  transform: scale(1.02);
}

.sidebar-nav-menu {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  width: 100%;
}

.sidebar-nav-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: 0.55rem 0.9rem;
  background: rgba(17, 24, 39, 0.75);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease, transform 0.25s ease;
  box-shadow: var(--shadow-soft);
}

.sidebar-nav-btn:hover,
.sidebar-nav-btn.active {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.25) 0%, rgba(17, 24, 39, 0.95) 100%);
  border-color: var(--gold-primary);
  color: var(--gold-light);
  transform: translateX(4px);
}

.sidebar-nav-btn .tihina-icon { color: var(--gold-primary); }

.sidebar-footer-copyright {
  margin-top: auto;
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.sidebar-footer-copyright strong { color: var(--gold-light); }

.admin-access-dot {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  /* Спира мащабирането при двойно докосване, за да стигне събитието до скрипта,
     и премахва забавянето от 300ms на мобилните браузъри. */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  display: inline-block;
  padding: 0 0.15em;
}

/* --- 7. Централна зона и панели ------------------------------------------ */
.center-hero-showcase {
  background: radial-gradient(circle at 50% 30%, #0F172A 0%, #050810 80%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-main);
  height: var(--column-height);
}

.center-scrollable {
  overflow-y: auto;
}


.content-column {
  width: 100%;
  max-width: 850px;
  margin: 0 auto;
  text-align: left;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  background: rgba(74, 93, 62, 0.4);
  border: 1px solid rgba(163, 230, 53, 0.5);
  padding: 0.4rem 1.2rem;
  border-radius: var(--radius-pill);
  font-weight: 800;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Значката в „За нас“ стои центрирана над заглавието, а не подравнена вляво. */
.hero-badge--inline {
  display: flex;
  margin: 0 auto var(--sp-5);
  width: fit-content;
  max-width: 100%;
}

.hero-value--honour { color: #FFFFFF; }
.hero-value--loyalty { color: #22C55E; }
.hero-value--tradition { color: #EF4444; }

.hero-slideshow-frame {
  position: relative;
  width: 100%;
  max-width: 680px;
  margin: var(--sp-2) auto 0;
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

/* <picture> не бива да влияе на оформлението — позиционира се самият <img>. */
.hero-slideshow-frame picture,
.sidebar-brand-block picture,
.login-card picture {
  display: contents;
}

.slide-emblem {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-height: 100%;
  max-width: 100%;
  width: auto;
  object-fit: contain;
  opacity: 0;
  transition: opacity 1.2s ease-in-out;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.8)) drop-shadow(0 0 25px rgba(212, 175, 55, 0.25));
}

.slide-emblem.active { opacity: 1; }

/* Заглавия на страници */
.page-heading {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-heading);
  font-size: 1.35rem;
  color: var(--gold-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--gold-primary);
  padding-bottom: var(--sp-2);
  margin-bottom: var(--sp-3);
  line-height: 1.3;
}

.page-heading--flush {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.page-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
  border-bottom: 2px solid var(--gold-primary);
  padding-bottom: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.page-subheading {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: var(--sp-5);
}

/* Панели (заместват повтарящите се inline стилове) */
.panel {
  background: rgba(17, 24, 39, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-main);
  margin-bottom: var(--sp-4);
}

.panel--compact { padding: var(--sp-4); }

.panel--highlight {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.1) 0%, rgba(17, 24, 39, 0.9) 100%);
  border: 1.5px solid var(--gold-primary);
  box-shadow: var(--shadow-gold);
  text-align: center;
}

.panel p { margin-bottom: var(--sp-3); color: var(--text-soft); }
.panel p:last-child { margin-bottom: 0; }

.panel-title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-heading);
  font-size: 1.05rem;
  color: var(--gold-light);
  margin-bottom: var(--sp-3);
  line-height: 1.4;
}

.panel--highlight .panel-title { justify-content: center; text-transform: uppercase; }

.panel-lead {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: var(--sp-4);
}

.button-row {
  display: flex;
  gap: var(--sp-3);
  justify-content: center;
  flex-wrap: wrap;
}

.contacts-info-cards {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}

/* --- 8. Бутони ------------------------------------------------------------ */
.btn-admin,
.btn-primary,
.btn-danger,
.btn-outline,
.btn-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease, transform 0.25s ease;
  text-decoration: none;
  border: 1px solid transparent;
  line-height: 1.2;
}

.btn-admin,
.btn-primary {
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-dark));
  color: #000;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.25);
}

.btn-admin:hover,
.btn-primary:hover {
  background: linear-gradient(135deg, var(--gold-light), var(--gold-primary));
  transform: translateY(-2px);
}

.btn-admin--solid {
  background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold-primary) 100%);
  border: 1px solid var(--gold-light);
}

.btn-danger {
  background: rgba(153, 27, 27, 0.2);
  border-color: var(--red-accent);
  color: #FCA5A5;
}

.btn-danger:hover { background: var(--red-accent); color: #FFF; }

.btn-outline {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-muted);
}

.btn-outline:hover {
  border-color: var(--gold-primary);
  color: var(--gold-light);
  background: rgba(212, 175, 55, 0.05);
}

.btn-edit {
  background: rgba(74, 93, 62, 0.2);
  border-color: var(--olive-bright);
  color: var(--green-bright);
}

.btn-edit:hover { background: var(--olive-accent); color: #FFF; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  background: var(--bg-inset);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--gold-light);
  cursor: pointer;
  transition: border-color 0.25s ease, background 0.25s ease;
}

.btn-icon:hover {
  border-color: var(--gold-primary);
  background: rgba(212, 175, 55, 0.12);
}

.btn-readmore {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  color: var(--gold-primary);
  font-size: 0.82rem;
  font-weight: 700;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: var(--font-body);
}

.btn-readmore:hover { color: var(--gold-light); }

.zoom-controls {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
}

/* --- 9. Карти с обяви ----------------------------------------------------- */
.announcements-stack,
.news-feed-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.announcement-card {
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.25s ease, transform 0.25s ease;
  display: flex;
  flex-direction: column;
}

.announcement-card.pinned { border-color: var(--gold-primary); }

.announcement-card.compact { cursor: pointer; }

.announcement-card.compact:hover,
.announcement-card.compact:focus-visible {
  border-color: var(--border-hover);
  transform: translateX(3px);
}

.announcement-card.compact .card-body { padding: var(--sp-3) var(--sp-4); }
.announcement-card.compact .card-title { margin-bottom: 0; font-size: 1rem; }

.card-body {
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.card-meta-tags {
  display: flex;
  gap: var(--sp-1);
  align-items: center;
  flex-wrap: wrap;
}

.category-tag {
  background: rgba(212, 175, 55, 0.15);
  color: var(--gold-light);
  border: 1px solid rgba(212, 175, 55, 0.3);
  padding: 0.12rem 0.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.72rem;
  white-space: nowrap;
}

.pinned-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-dark));
  color: #000;
  font-weight: 800;
  font-size: 0.65rem;
  padding: 0.12rem 0.45rem;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.expired-pin {
  color: var(--gold-dark);
  display: inline-flex;
  filter: drop-shadow(0 0 5px rgba(212, 175, 55, 0.5));
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.02rem;
  font-weight: 700;
  margin-bottom: var(--sp-2);
  line-height: 1.35;
  color: var(--gold-light);
}

.card-excerpt {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: var(--sp-3);
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-2);
  padding-top: var(--sp-2);
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
  flex-wrap: wrap;
}

.author-info { font-size: 0.74rem; color: var(--text-muted); }

/* --- 10. Десен бар -------------------------------------------------------- */
.sidebar-header {
  position: sticky;
  top: calc(-1 * var(--sp-5));
  z-index: 10;
  background: var(--bg-card);
  padding: var(--sp-1) 0 var(--sp-3);
  margin-bottom: var(--sp-4);
  border-bottom: 2px solid var(--gold-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.sidebar-header-title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.sidebar-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--gold-light);
  letter-spacing: 0.4px;
}


.archive-link-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: 0.74rem;
  color: var(--gold-light);
  text-decoration: none;
  border: 1px solid var(--border-color);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: border-color 0.25s ease, background 0.25s ease;
}

.archive-link-btn:hover {
  border-color: var(--gold-primary);
  background: rgba(212, 175, 55, 0.1);
}

/* --- 11. Модален прозорец ------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: var(--sp-4);
}

.modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--gold-primary);
  border-radius: var(--radius-lg);
  max-width: 750px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: var(--sp-6);
  position: relative;
  box-shadow: var(--shadow-gold);
  transform: scale(0.96);
  transition: transform 0.25s ease;
}

.modal-overlay.active .modal-content { transform: scale(1); }

.modal-close {
  position: absolute;
  top: var(--sp-3);
  right: var(--sp-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
}

.modal-close:hover { color: var(--gold-primary); border-color: var(--border-color); }

.modal-meta {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  margin-bottom: var(--sp-3);
  padding-right: 2.5rem;
  flex-wrap: wrap;
}

.modal-date { color: var(--text-muted); font-size: 0.85rem; }

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  color: var(--gold-light);
  margin-bottom: var(--sp-4);
  line-height: 1.3;
}

.modal-image {
  width: 100%;
  max-height: 350px;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin-bottom: var(--sp-4);
}

.modal-text {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-main);
  white-space: pre-line;
  margin-bottom: var(--sp-5);
}

.modal-footer {
  border-top: 1px solid var(--border-color);
  padding-top: var(--sp-3);
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* --- 12. Формуляри -------------------------------------------------------- */
.form-group,
.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  margin-bottom: var(--sp-4);
}

.form-group label,
.form-field label {
  font-size: 0.8rem;
  color: var(--gold-light);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
textarea,
select {
  width: 100%;
  background: rgba(9, 13, 22, 0.7);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: border-color 0.25s ease, background 0.25s ease;
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.2);
  background: rgba(17, 24, 39, 0.9);
}

textarea { resize: vertical; min-height: 90px; }

.contact-form { display: flex; flex-direction: column; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}

.form-status {
  display: none;
  padding: var(--sp-3);
  border-radius: var(--radius-sm);
  margin-bottom: var(--sp-4);
  font-size: 0.9rem;
}

.form-status.is-visible { display: block; }

.form-status--success {
  background: rgba(74, 93, 62, 0.4);
  border: 1px solid var(--olive-bright);
  color: var(--green-bright);
}

.form-status--error {
  background: rgba(153, 27, 27, 0.4);
  border: 1px solid var(--red-accent);
  color: #FCA5A5;
}

/* Съобщения (админ и публична част) */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  padding: var(--sp-4);
  border-radius: var(--radius-sm);
  margin-bottom: var(--sp-4);
  font-size: 0.92rem;
}

.alert--success { background: rgba(74, 93, 62, 0.4); border: 1px solid var(--olive-bright); color: var(--green-bright); }
.alert--error   { background: rgba(153, 27, 27, 0.4); border: 1px solid var(--red-accent); color: #FCA5A5; }
.alert--warning { background: rgba(234, 179, 8, 0.18); border: 1px solid var(--amber); color: var(--amber-light); }
.alert a { color: inherit; text-decoration: underline; font-weight: 700; }

/* --- 13. Страница „Устав“ ------------------------------------------------- */
.ustav-viewport {
  background: rgba(17, 24, 39, 0.95);
  border: 2px solid var(--gold-primary);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-gold);
  width: 100%;
  height: 600px;
  overflow-y: auto;
}


/* Мащабирането е незабавно, без плавен преход. Уставът е блок с над 200
   елемента; анимирането на font-size предизвиква пълно преизчисляване на
   оформлението при всеки кадър, което на по-слаби устройства се вижда като
   накъсване. За бутон за увеличаване моменталната реакция е и по-удобна. */
.ustav-text { font-size: 100%; }

/* --- 14. Администраторски панел ------------------------------------------ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
  padding: var(--sp-3) var(--sp-6);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 2px solid var(--border-color);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
}

.admin-nav-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  text-decoration: none;
  color: var(--gold-primary);
}

/* Иконата за опресняване се завърта при посочване с мишката —
   визуален знак, че връзката презарежда панела. */
.admin-nav-brand .tihina-icon {
  filter: drop-shadow(0 0 5px rgba(212, 175, 55, 0.4));
  transition: transform 0.4s ease;
}

.admin-nav-brand:hover .tihina-icon,
.admin-nav-brand:focus-visible .tihina-icon {
  transform: rotate(180deg);
}

/* При кликване иконата довършва пълния оборот. */
.admin-nav-brand:active .tihina-icon {
  transform: rotate(360deg);
}

.admin-nav-title h1 {
  font-size: 1.1rem;
  color: var(--gold-primary);
  line-height: 1.2;
  font-family: var(--font-heading);
}

.admin-nav-actions {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  flex-wrap: wrap;
}

.admin-greeting { color: var(--gold-light); font-weight: 600; font-size: 0.9rem; }

.admin-nav-actions .btn-outline,
.admin-nav-actions .btn-danger {
  padding: 0.45rem 0.8rem;
  font-size: 0.82rem;
}

.admin-container {
  max-width: 1200px;
  margin: var(--sp-6) auto;
  padding: 0 var(--sp-5);
}

.admin-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--sp-6);
  box-shadow: var(--shadow-gold);
  margin-bottom: var(--sp-6);
}

.admin-section-title {
  font-family: var(--font-heading);
  color: var(--gold-light);
  margin-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: var(--sp-3);
  font-size: 1.15rem;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-main);
  border: 1px solid var(--border-color);
}

.admin-table thead {
  background: rgba(212, 175, 55, 0.06);
  border-bottom: 2px solid var(--border-color);
}

.admin-table th {
  text-align: left;
  padding: var(--sp-3);
  color: var(--gold-light);
  font-family: var(--font-heading);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.admin-table td {
  padding: var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.88rem;
  vertical-align: middle;
}

.admin-table tbody tr:hover { background: rgba(255, 255, 255, 0.02); }

.table-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.table-actions .btn-edit,
.table-actions .btn-danger { padding: 0.35rem 0.7rem; font-size: 0.78rem; }

.msg-unread { background: rgba(212, 175, 55, 0.05); font-weight: 600; }
.msg-read { opacity: 0.75; }

.msg-preview {
  line-height: 1.5;
  font-weight: 400;
  color: var(--text-main);
}

/* Модален прозорец за пълния текст на съобщението */
.msg-modal-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--sp-3);
  padding: var(--sp-4);
  margin-bottom: var(--sp-4);
  background: var(--bg-inset);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.msg-modal-label {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--gold-light);
  margin-bottom: 0.15rem;
}

.msg-modal-body {
  white-space: pre-line;   /* запазва редовете, въведени от подателя */
  word-break: break-word;
  line-height: 1.75;
  color: var(--text-main);
  background: var(--bg-dark);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--sp-4);
  max-height: 50vh;
  overflow-y: auto;
}

.btn-msg-preview { white-space: nowrap; }

/* Форма за вход */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--sp-5);
}

.login-card {
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--gold-primary);
  border-radius: var(--radius-lg);
  padding: var(--sp-7) var(--sp-6);
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-gold), 0 20px 40px rgba(0, 0, 0, 0.6);
  text-align: center;
  animation: fadeInDown 0.5s ease forwards;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.login-logo {
  width: 130px;
  margin: 0 auto var(--sp-5);
  display: block;
  filter: drop-shadow(0 0 15px rgba(212, 175, 55, 0.4));
}

.login-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  color: var(--gold-light);
  margin-bottom: var(--sp-2);
  text-transform: uppercase;
}

.login-subtitle { color: var(--text-muted); font-size: 0.88rem; margin-bottom: var(--sp-5); }

.login-back {
  margin-top: var(--sp-5);
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--sp-4);
}

.login-back a { color: var(--text-muted); text-decoration: none; font-size: 0.85rem; }
.login-back a:hover { color: var(--gold-light); }

.password-wrapper { position: relative; display: flex; align-items: center; }
.password-wrapper input { padding-right: 44px; }

.toggle-password {
  position: absolute;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
}

.toggle-password:hover { color: var(--gold-light); }

.requirements-box {
  margin-bottom: var(--sp-5);
  background: var(--bg-inset);
  border: 1px dashed var(--border-color);
  padding: var(--sp-4);
  border-radius: var(--radius-sm);
}

.requirements-box p { color: var(--gold-light); margin-bottom: var(--sp-2); font-weight: 600; font-size: 0.9rem; }
.requirements-box ul { color: var(--text-soft); font-size: 0.88rem; margin-left: var(--sp-5); line-height: 1.6; }

.pin-controls {
  display: flex;
  gap: var(--sp-5);
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  padding: var(--sp-4);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-color);
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
}

.pin-toggle { display: flex; align-items: center; gap: var(--sp-2); }
.pin-toggle input[type="checkbox"] { width: auto; transform: scale(1.15); }
.pin-toggle label { margin: 0; cursor: pointer; color: var(--gold-light); font-weight: 600; }

.pin-until { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.pin-until label { margin: 0; color: var(--text-muted); text-transform: none; }
.pin-until input[type="date"] { width: auto; padding: 0.4rem 0.6rem; }

.form-grid-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--sp-5);
}

/* =============================================================================
   15. Отзивчивост
   Точки на пречупване: 1400 / 1150 / 900 / 600 / 400
   ============================================================================ */

/* Голям лаптоп — стесняваме страничните колони */
@media (max-width: 1400px) {
  :root { --sidebar-width: 290px; --column-height: 680px; }
}

/* Таблет в хоризонтален режим — две колони, десният бар минава долу */
@media (max-width: 1150px) {
  :root { --column-height: auto; }

  .portal-3column-layout {
    grid-template-columns: 280px minmax(0, 1fr);
    gap: var(--sp-4);
  }

  #board-bar { height: auto; }

  #about-bar {
    grid-column: 1 / -1;
    height: auto;
    max-height: none;
  }

  .center-hero-showcase {
    height: auto;
    min-height: 420px;
  }

  .center-scrollable { overflow-y: visible; }

  .hero-slideshow-frame { height: 380px; }

  .announcements-stack {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--sp-4);
  }

  .sidebar-header { position: static; }
}

/* Таблет вертикално / голям телефон — една колона + мобилно меню */
@media (max-width: 900px) {
  .portal-3column-layout {
    grid-template-columns: minmax(0, 1fr);
    padding: 0 var(--sp-4);
    margin-top: var(--sp-3);
  }

  .mobile-nav-toggle { display: flex; }

  /* Лявият бар остава видим — брандът работи като бутон „Начало“.
     Сгъва се само менюто с връзките и надписът за авторски права. */
  #board-bar {
    order: -1;
    height: auto;
    padding: var(--sp-4);
  }

  /* Сгъва се само менюто с връзките. Надписът за авторски права остава видим,
     защото знакът © в него дава достъп до администраторския панел. */
  #board-bar .sidebar-nav-menu { display: none; }
  #board-bar.is-open .sidebar-nav-menu { display: flex; }

  #board-bar .sidebar-footer-copyright {
    margin-top: var(--sp-3);
    font-size: 0.8rem;
  }

  /* Лого и надпис на един ред, вертикално центрирани един спрямо друг,
     а двойката — центрирана в картата. */
  .sidebar-brand-block {
    padding-bottom: var(--sp-3);
    margin-bottom: var(--sp-3);
  }

  .sidebar-brand-block .nav-brand {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: var(--sp-4);
  }

  .sidebar-brand-block .nav-title {
    width: auto;
    text-align: left;
  }

  .sidebar-full-logo {
    width: 84px;
    max-width: 84px;
    margin: 0;
    flex-shrink: 0;
  }

  .center-hero-showcase { padding: var(--sp-4); min-height: 340px; }
  .hero-slideshow-frame { height: 300px; }

  .contacts-info-cards { grid-template-columns: 1fr; }
  .form-grid-2 { grid-template-columns: 1fr; }

  .ustav-viewport { height: 460px; padding: var(--sp-4); }

  /* Админ навигация */
  .navbar { padding: var(--sp-3) var(--sp-4); }
  .admin-nav-title h1 { font-size: 0.95rem; }
  .admin-container { padding: 0 var(--sp-4); margin-top: var(--sp-4); }
  .admin-card { padding: var(--sp-4); }

  /* Административните таблици стават карти — иначе преливат хоризонтално */
  .admin-table,
  .admin-table thead,
  .admin-table tbody,
  .admin-table th,
  .admin-table td,
  .admin-table tr {
    display: block;
    width: 100%;
  }

  .admin-table thead { display: none; }

  /* На телефон и таблет всеки ред е самостоятелна карта със собствен фон и
     рамка. Обвивката на таблицата затова остава без фон, рамка и сянка —
     иначе се получава "рамка в рамката". На десктоп остава непроменена. */
  .admin-table {
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
  }

  .admin-table tr {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: var(--sp-3);
    padding: var(--sp-3);
    background: var(--bg-card);
  }

  .admin-table td {
    border-bottom: 1px solid var(--border-subtle);
    padding: var(--sp-2) 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--sp-3);
    text-align: right;
  }

  .admin-table td:last-child { border-bottom: none; }

  /* Етикет на колоната отляво, стойността отдясно */
  .admin-table td::before {
    content: attr(data-label);
    font-family: var(--font-heading);
    font-size: 0.72rem;
    text-transform: uppercase;
    color: var(--gold-light);
    letter-spacing: 0.4px;
    text-align: left;
    flex-shrink: 0;
  }

  .msg-preview { text-align: left; }
}

/* Телефон */
@media (max-width: 600px) {
  body { font-size: 15px; }

  .portal-3column-layout { padding: 0 var(--sp-3); gap: var(--sp-3); }
  .side-bar-column { padding: var(--sp-4); }
  .center-hero-showcase { padding: var(--sp-3); min-height: 280px; }

  .nav-title h1 { font-size: 1.25rem; }
  .nav-title p { font-size: 0.68rem; }

  .hero-badge { font-size: 0.7rem; padding: 0.35rem 0.8rem; gap: var(--sp-1); letter-spacing: 0.6px; }
  .hero-slideshow-frame { height: 220px; }

  .page-heading { font-size: 1.1rem; }
  .page-heading-row { gap: var(--sp-2); }

  .panel { padding: var(--sp-4); }
  .modal-content { padding: var(--sp-5) var(--sp-4); max-height: 92vh; }
  .modal-title { font-size: 1.25rem; }

  /* Двуколонните полета стават едноколонни */
  .form-row { grid-template-columns: 1fr; gap: var(--sp-3); }

  .ustav-viewport { height: 400px; padding: var(--sp-3); }

  .button-row { flex-direction: column; }
  .button-row .btn-admin { width: 100%; }

  .admin-nav-actions { width: 100%; justify-content: flex-start; }
  .admin-greeting { width: 100%; }

  .top-ticker-content { font-size: 0.72rem; animation-duration: 26s; }
}

/* Малък телефон */
@media (max-width: 400px) {
  /* Логото остава до надписа (не под него), само се смалява. */
  .sidebar-brand-block .nav-brand { gap: var(--sp-3); }
  .sidebar-full-logo { width: 64px; max-width: 64px; }
  .nav-title h1 { font-size: 1.1rem; }
  .nav-title p { font-size: 0.62rem; }
  .hero-slideshow-frame { height: 180px; }
  .card-footer { flex-direction: column; align-items: flex-start; gap: var(--sp-2); }
  .admin-table td { flex-direction: column; align-items: flex-start; text-align: left; gap: var(--sp-1); }
}

/* Много широки екрани */
@media (min-width: 1900px) {
  :root { --sidebar-width: 360px; --column-height: 780px; }
}

/* Потребители, предпочитащи по-малко движение */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .top-ticker-content { animation: none; padding-left: 0; }
}

/* Печат — само съдържанието, без навигация */
@media print {
  body { background: #fff; color: #000; }
  .top-ticker-bar,
  .mobile-nav-toggle,
  #board-bar,
  #about-bar,
  .zoom-controls,
  .modal-overlay,
  .navbar { display: none !important; }

  .portal-3column-layout { display: block; padding: 0; }
  .center-hero-showcase { height: auto; border: none; box-shadow: none; background: #fff; }
  .ustav-viewport { height: auto; overflow: visible; border: none; box-shadow: none; background: #fff; }
  .ustav-text, .ustav-text * { color: #000 !important; }
}
