/* ── Design tokens: navy base + mint accent ───────── */
:root {
  --primary:       #001157;
  --primary-dark:  #000a38;
  --primary-light: #eaeeff;
  --primary-soft:  #3a4480;

  --accent:        #1D9E75;
  --accent-dark:   #0F6E56;
  --accent-light:  #e1f5ee;

  /* Override Bootstrap's built-in theme colors so text-primary, bg-primary,
     badge bg-primary, border-primary, links, etc. use the council palette */
  --bs-primary:          #001157;
  --bs-primary-rgb:      0, 17, 87;
  --bs-link-color:       #001157;
  --bs-link-color-rgb:   0, 17, 87;
  --bs-link-hover-color: #000a38;

  --success:       #16a34a;
  --danger:        #dc2626;
  --text:          #1e293b;
  --text-muted:    #5a6390;
  --border:        #d8def5;
  --surface:       #f7f8fd;
  --radius:        0.625rem;
  --shadow-sm:     0 1px 3px rgba(0,17,87,.06), 0 1px 2px rgba(0,17,87,.05);
  --shadow:        0 4px 6px rgba(0,17,87,.06), 0 2px 4px rgba(0,17,87,.05);
  --shadow-lg:     0 10px 15px rgba(0,17,87,.06), 0 4px 6px rgba(0,17,87,.04);
}

/* ── Base ────────────────────────────────────────────────────── */
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: #fff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main.main { flex: 1; }

h1, h2, h3, h4, h5 { color: var(--primary); }

a { color: var(--primary); }
a:hover { color: var(--primary-dark); }

/* Visible focus for keyboard users */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.nav-link:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ── Main navigation (single white bar) ──────────────────────── */
.navbar-main {
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.navbar-main .navbar-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: var(--primary);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -.3px;
}

.navbar-main .brand-logo { height: 46px; width: auto; }

.navbar-main .nav-link {
  color: var(--primary-soft);
  font-size: .9rem;
  font-weight: 500;
  padding-top: .65rem;
  padding-bottom: .65rem;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}

.navbar-main .nav-link:hover,
.navbar-main .nav-link:focus {
  color: var(--primary);
}

.navbar-main .nav-link.active {
  color: var(--primary);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

.navbar-main .dropdown-menu {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.navbar-main .dropdown-item { font-size: .875rem; }
.navbar-main .dropdown-item:hover { background: var(--primary-light); }
.navbar-main .dropdown-item.active {
  background: var(--accent-light);
  color: var(--accent-dark);
}

.navbar-main .navbar-toggler {
  color: var(--primary);
  border: 1px solid var(--border);
}

/* Mobile: drop the underline, use a left border + soft fill instead */
@media (max-width: 991.98px) {
  .navbar-main .nav-link {
    border-bottom: none;
    border-left: 3px solid transparent;
    padding-left: .75rem;
  }
  .navbar-main .nav-link.active {
    border-left-color: var(--accent);
    background: var(--primary-light);
  }
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn-primary {
  --bs-btn-bg: var(--primary);
  --bs-btn-border-color: var(--primary);
  --bs-btn-hover-bg: var(--primary-dark);
  --bs-btn-hover-border-color: var(--primary-dark);
  --bs-btn-active-bg: var(--primary-dark);
  --bs-btn-active-border-color: var(--primary-dark);
}

.btn-outline-primary {
  --bs-btn-color: var(--primary);
  --bs-btn-border-color: var(--primary);
  --bs-btn-hover-bg: var(--primary);
  --bs-btn-hover-border-color: var(--primary);
  --bs-btn-active-bg: var(--primary-dark);
  --bs-btn-active-border-color: var(--primary-dark);
  --bs-btn-focus-shadow-rgb: 0, 17, 87;
}

/* The energetic accent, reserved for the main calls to action */
.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-dark);
  --bs-btn-hover-border-color: var(--accent-dark);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--accent-dark);
  --bs-btn-active-border-color: var(--accent-dark);
  --bs-btn-focus-shadow-rgb: 29, 158, 117;
  font-weight: 600;
}

.btn-outline-accent {
  --bs-btn-color: var(--accent-dark);
  --bs-btn-border-color: var(--accent);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--accent);
  --bs-btn-hover-border-color: var(--accent);
  --bs-btn-active-bg: var(--accent-dark);
  --bs-btn-active-border-color: var(--accent-dark);
}

/* Legacy markup still using btn-warning gets the accent treatment */
.btn-warning {
  --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-dark);
  --bs-btn-hover-border-color: var(--accent-dark);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--accent-dark);
  --bs-btn-active-border-color: var(--accent-dark);
}

.btn-outline-warning {
  --bs-btn-color: var(--accent-dark);
  --bs-btn-border-color: var(--accent);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--accent);
  --bs-btn-hover-border-color: var(--accent);
}

/* ── Hero (homepage) ─────────────────────────────────────────── */
.hero {
  background: var(--primary-light);
  border-radius: var(--radius);
  padding: 3rem 2.5rem 4.25rem;
  color: var(--primary);
  position: relative;
  overflow: hidden;
}

/* Decorative wave hugs the bottom edge; content stays above it */
.hero > .row { position: relative; }

.hero-wave {
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 56px;
  pointer-events: none;
}

.hero h1 {
  font-weight: 700;
  font-size: 2.2rem;
  line-height: 1.2;
  color: var(--primary);
}

.hero .hero-kicker {
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent-dark);
}

.hero p { color: var(--primary-soft); max-width: 46ch; }

@media (max-width: 575.98px) {
  .hero { padding: 2rem 1.25rem 3.25rem; }
  .hero h1 { font-size: 1.7rem; }
  .hero-wave { height: 38px; }
}

/* Hero side stats */
.hero-stat {
  background: #fff;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}

.hero-stat.inverse { background: var(--primary); }

/* "Одобрени": ментовата статистика: одобрено = зелено */
.hero-stat.approved { background: var(--accent); }
.hero-stat.approved .stat-value { color: #fff; }
.hero-stat.approved .stat-label { color: #d7f3e8; }
.hero-stat .stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--primary);
}
.hero-stat .stat-label { font-size: .8rem; color: var(--text-muted); }
.hero-stat.inverse .stat-value { color: #fff; }
.hero-stat.inverse .stat-label { color: #b9c2ee; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .25s, transform .25s, border-color .25s;
}

.card:hover { box-shadow: var(--shadow); }

.card-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  color: var(--primary);
}

/* Entry-point cards (homepage): mint top edge */
.entry-card {
  border-top: 3px solid var(--accent);
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  height: 100%;
}

.entry-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-top-color: var(--accent-dark);
}

.entry-card .entry-icon {
  font-size: 1.5rem;
  color: var(--accent-dark);
  transition: transform .25s ease;
}

.entry-card:hover .entry-icon { transform: scale(1.12) rotate(-6deg); }

.entry-card .card-title { font-size: 1rem; font-weight: 600; }

/* ── Stat cards (generic) ────────────────────────────────────── */
.stat-card {
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 1rem;
  background: #fff;
  transition: box-shadow .2s, transform .2s;
}

.stat-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-icon.blue   { background: var(--primary-light); color: var(--primary); }
.stat-icon.green  { background: var(--accent-light); color: var(--accent-dark); }
.stat-icon.amber  { background: #faeeda; color: #854f0b; }
.stat-icon.purple { background: #ede9fe; color: #534ab7; }

.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

/* ── Tables ──────────────────────────────────────────────────── */
.table { font-size: 0.9rem; }

.table thead th {
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: .5px;
}

.table tbody tr:hover { background: var(--primary-light); }

/* ── Badges ──────────────────────────────────────────────────── */
.badge { font-size: 0.75rem; font-weight: 500; }

.badge.bg-accent {
  background-color: var(--accent-light) !important;
  color: var(--accent-dark);
}

/* ── Forms ───────────────────────────────────────────────────── */
.form-label { font-weight: 500; font-size: 0.875rem; }

.form-control, .form-select { border-color: #c5cdf0; }

.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,17,87,.15);
}

/* Step badge for multi-section forms */
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── Pagination ──────────────────────────────────────────────── */
.page-link { color: var(--primary); }
.page-item.active .page-link {
  background: var(--primary);
  border-color: var(--primary);
}

/* ── Page titles ─────────────────────────────────────────────── */
.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border);
}

#title {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 1.5rem;
}

/* ── Typeahead / autocomplete ────────────────────────────────── */
.autocomplete, .tt-query, .tt-hint {
  width: 100%;
  max-width: 500px;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  height: 38px;
  border: 1px solid #c5cdf0;
  border-radius: var(--radius);
  color: #495057;
  background-color: #fff;
}

.twitter-typeahead { width: 100%; }

/* ── File list ───────────────────────────────────────────────── */
.files-field { list-style: none; padding: 0; }

.files-field li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.files-field li input { flex: 1; }

/* ── Footer ──────────────────────────────────────────────────── */
.site-footer {
  background: var(--primary);
  color: #b9c2ee;
  font-size: 0.875rem;
}

.site-footer a { color: #fff; }
.site-footer .footer-heading { color: #fff; font-weight: 600; }

.footer-social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #3a4a9e;
  color: #b9c2ee;
  text-decoration: none;
  transition: border-color .15s, color .15s, background .15s;
}

.footer-social:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Budget bar ──────────────────────────────────────────────── */
.budget-bar { height: 10px; border-radius: 999px; background: var(--border); overflow: hidden; }
.budget-bar-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width 1.1s cubic-bezier(.2,.7,.3,1); }
.budget-bar-fill.danger { background: var(--danger); }
.budget-bar-fill.warning { background: #ef9f27; }

/* ── Misc ────────────────────────────────────────────────────── */
.big-icon { font-size: 1.25rem; }
.margin-top { margin-top: 0.75rem; }

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 2.2rem;
  opacity: .3;
  display: block;
  margin-bottom: .75rem;
}

/* ── Animations ──────────────────────────────────────────────── */

/* Buttons: arrow nudges forward on hover, light press on click */
.btn .fa-arrow-right { transition: transform .25s ease; }
.btn:hover .fa-arrow-right,
.btn:focus-visible .fa-arrow-right { transform: translateX(4px); }
.btn:active { transform: scale(.97); }

/* Footer socials pop up slightly */
.footer-social { transition: border-color .15s, color .15s, background .15s, transform .2s; }
.footer-social:hover { transform: translateY(-2px) scale(1.06); }

/* Table rows ease into their hover color */
.table tbody tr { transition: background-color .15s ease; }

@media (prefers-reduced-motion: no-preference) {

  /* Dropdown menus slide open */
  .dropdown-menu.show { animation: dropdown-in .18s ease; }

  @keyframes dropdown-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: none; }
  }

  /* Hero entrance: elements rise in one after another */
  .anim-rise {
    opacity: 0;
    animation: rise-in .65s ease forwards;
  }
  .anim-rise.d1 { animation-delay: .05s; }
  .anim-rise.d2 { animation-delay: .18s; }
  .anim-rise.d3 { animation-delay: .31s; }
  .anim-rise.d4 { animation-delay: .44s; }
  .anim-rise.d5 { animation-delay: .57s; }
  .anim-rise.d6 { animation-delay: .70s; }

  @keyframes rise-in {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: none; }
  }

  /* Scroll reveal: JS marks below-fold elements, then releases them */
  .reveal-pending {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity .6s ease, transform .6s ease;
  }

  .reveal-pending.reveal-in {
    opacity: 1;
    transform: none;
  }

  /* Desktop nav: underline slides in from the left */
  @media (min-width: 992px) {
    .navbar-main .nav-link { position: relative; }
    .navbar-main .nav-link.active { border-bottom-color: transparent; }
    .navbar-main .nav-link::after {
      content: "";
      position: absolute;
      left: .5rem;
      right: .5rem;
      bottom: 0;
      height: 2px;
      background: var(--accent);
      transform: scaleX(0);
      transform-origin: left;
      transition: transform .25s ease;
    }
    .navbar-main .nav-link:hover::after,
    .navbar-main .nav-link.active::after { transform: scaleX(1); }
  }
}

/* Users who opt out of motion get an entirely calm site */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* --- Известия ------------------------------------------------------------ */
/* Едно определение за двете места, където се показват известия: падащото меню
   в навигацията (пълни се с готов HTML от notification_views) и отделната
   страница projects/notifications.html. */
.notifications-bell-link { position: relative; }
.notification-badge {
  position: absolute;
  top: .1rem;
  right: -.35rem;
  min-width: 1.15em;
  padding: .15em .35em;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
}
.notifications-dropdown-menu {
  width: 340px;
  max-width: 90vw;
  max-height: 70vh;
  overflow-y: auto;
  padding: 0;
}
.notifications-dropdown-menu .dropdown-divider { margin: 0; }
/* Общ вид на реда: и в падащото меню (<a class="dropdown-item notification-row">),
   и на цялата страница (<a class="notification-row">). */
.notification-row {
  display: block;
  padding: .65rem 1rem .65rem 1.65rem;
  position: relative;
  white-space: normal;
  background: #fff;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.notification-row:last-child { border-bottom: none; }
.notification-row:hover, .notification-row:focus { background: var(--primary-light); }
.notification-row .notification-text { display: block; color: var(--text); }
.notification-row.is-read .notification-text { color: var(--text-muted); }
.notification-row.is-unread { background: var(--surface); }
.notification-row.is-unread:hover, .notification-row.is-unread:focus { background: var(--accent-light); }
/* Точката на непрочетено: диаметър 7px, подравнена към първия ред текст,
   не само получер шрифт, за да се различава и без цвят. */
.notification-row.is-unread::before {
  content: "";
  position: absolute;
  left: .7rem;
  top: .95rem;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.notification-row .notification-time {
  display: block;
  margin-top: .2rem;
  font-size: 12px;
  color: var(--text-muted);
}
.notifications-empty, .notifications-loading { text-align: center; }

/* Под lg навигацията се свива в хамбургер и камбанката застава на свой
   ред в разгънатото меню, между „Обратна връзка" и профила. Падащото й
   меню там вече не е позиционирано плаващо, а просто заема цялата
   ширина, за да не изскача извън екрана. */
@media (max-width: 991.98px) {
  .notifications-dropdown-menu {
    width: 100%;
    max-width: none;
    position: static;
    float: none;
    box-shadow: none;
    border-color: var(--border);
  }
}

/* --- Пътуващи лица -------------------------------------------------------- */
/* Компактни редове с обща заглавка. Заглавката работи само докато полетата
   стоят едно до друго; под sm те падат едно под друго, тя се скрива и всяко
   поле носи собствен етикет. Формулярът се попълва от телефон, докато човекът
   гледа паспорт, и там четимостта тежи повече от стегнатостта. */
.travellers-head,
.travellers-row {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
}

.travellers-head {
  font-size: .8125rem;
  color: var(--text-muted);
  margin-bottom: .25rem;
}

.travellers-row { margin-bottom: .5rem; }

.travellers-cell { flex: 1 1 0; min-width: 0; }

/* Държи заглавката подравнена с полетата: колоната на бутона за премахване
   отнема място и без този разделител колоните се разминават с един бутон. */
.travellers-remove-space { flex: 0 0 2.25rem; }
.travellers-remove { flex: 0 0 2.25rem; }

@media (max-width: 575.98px) {
  .travellers-row {
    flex-direction: column;
    gap: .35rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .6rem;
    margin-bottom: .6rem;
  }
  .travellers-cell { width: 100%; }
  .travellers-remove { align-self: flex-end; }
}

/* Когато колоните са много (втората стъпка стига до седем), общата заглавка
   спира да работи: при 1280px всяко поле остава 101px, а в него трябва да се
   побере „IVAN PETROV GEORGIEV". Тогава редът се пренася и всяко поле носи
   собствен етикет. Измерено в браузър, не по усет. */
.travellers-row.is-labelled {
  flex-wrap: wrap;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .6rem;
  margin-bottom: .6rem;
}

.travellers-row.is-labelled .travellers-cell { flex: 1 1 12rem; }
