/* =====================================================================
 * UNIFIED HEADER — same top-bar + header across the entire site.
 *
 * Loaded LAST in <head> so it wins over every per-page inline <style>
 * block (homepage, /properties/, /property-detail/, /odhad/, legal
 * pages). Specificity-anchored on `html body` and `!important` on every
 * property so no @media @important in page-level CSS can drift away.
 *
 * Source of truth: the homepage top-bar + header markup. Other pages
 * already use the same HTML — this file just normalizes the styling.
 * ===================================================================== */

/* ============ TOP-BAR ============ */
html body .top-bar {
  background: linear-gradient(90deg, #0e2847 0%, #12365f 100%) !important;
  color: #ffffff !important;
  padding: 10px 0 !important;
  font-size: 14px !important;
  line-height: 1.3 !important;
  border-bottom: 1px solid rgba(255,255,255,0.04) !important;
}
html body .top-bar .container,
html body .top-bar .top-bar-content {
  max-width: 1200px !important;
  margin: 0 auto !important;
  padding: 0 16px !important;
}
html body .top-bar .top-bar-content {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 20px !important;
  flex-wrap: wrap !important;
}
html body .top-bar .top-bar-left {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 3px !important;
}
html body .top-bar .top-bar-left a {
  color: #ffffff !important;
  text-decoration: none !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  line-height: 1.3 !important;
  transition: opacity 0.2s ease !important;
}
html body .top-bar .top-bar-left a:hover { opacity: 0.8 !important; }
html body .top-bar .top-bar-left a i {
  font-size: 12px !important;
  color: rgba(255,255,255,0.85) !important;
}
html body .top-bar .top-bar-right {
  display: flex !important;
  align-items: center !important;
  gap: 20px !important;
  flex-wrap: wrap !important;
  justify-content: flex-end !important;
}
html body .top-bar .rating-box {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  white-space: nowrap !important;
}
html body .top-bar .rating-firmy-icon,
html body .top-bar .rating-google-icon {
  width: 16px !important;
  height: 16px !important;
  object-fit: contain !important;
  flex-shrink: 0 !important;
}
html body .top-bar .stars {
  color: #f6c334 !important;
  display: inline-flex !important;
  gap: 2px !important;
  font-size: 12px !important;
}
html body .top-bar .stars i {
  font-size: 12px !important;
  color: #f6c334 !important;
}
html body .top-bar .rating-text {
  font-size: 12px !important;
  font-weight: 500 !important;
  color: #ffffff !important;
}

/* Gold CTA pill — always visible across all viewports */
html body .top-bar .free-estimate-box,
html body .free-estimate-box {
  display: inline-flex !important;
  align-items: center !important;
  background: linear-gradient(180deg, #e8c980, #d5a953) !important;
  color: #182234 !important;
  padding: 6px 14px !important;
  border-radius: 999px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  /* Explicitně, ne děděně. Bez toho si každá stránka spočítala `normal` z
     jiného rodiče (14,3 px vs 13,2 px), tlačítko bylo o pixel jinak vysoké
     a s ním celá lišta — 65 / 66 / 67 px podle stránky. */
  line-height: 1.2 !important;
  text-align: center !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  border: 0 !important;
  font-family: inherit !important;
  cursor: pointer !important;
  box-shadow: 0 4px 15px rgba(224, 185, 115, 0.3) !important;
  position: relative !important;
  overflow: hidden !important;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  flex-shrink: 0 !important;
}
html body .top-bar .free-estimate-box:hover {
  transform: translateY(-2px) scale(1.03) !important;
  box-shadow: 0 8px 25px rgba(224, 185, 115, 0.5) !important;
}

/* ============ HEADER (white sticky bar with logo + nav) ============ */
html body header {
  background-color: #ffffff !important;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08) !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 1000 !important;
  width: 100% !important;
  padding: 0 !important;
  min-height: 0 !important;
  height: auto !important;
}
html body header .container,
html body header .header-inner {
  max-width: 1200px !important;
  margin: 0 auto !important;
  padding: 0 16px !important;
}
html body header .header-inner {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 18px 16px !important;
  gap: 15px !important;
  width: 100% !important;
  max-width: 1200px !important;
}

/* Logo — same look everywhere */
html body header .logo {
  font-size: 17px !important;
  font-weight: 600 !important;
  color: #0d1b2a !important;
  text-decoration: none !important;
  flex-shrink: 0 !important;
  line-height: 1.3 !important;
  white-space: nowrap !important;
  max-width: 350px !important;
  display: block !important;
  transition: opacity 0.15s ease !important;
}
html body header .logo:hover { opacity: 0.8 !important; }
html body header .logo .logo-location {
  font-size: 13px !important;
  font-weight: 400 !important;
  color: #7e7e7e !important;
  font-style: normal !important;
  margin-left: 4px !important;
  display: inline !important;
}

/* Desktop navigation */
html body header nav {
  margin-left: auto !important;
  flex-shrink: 0 !important;
}
html body header nav ul {
  list-style: none !important;
  display: flex !important;
  gap: 12px !important;
  align-items: center !important;
  margin: 0 !important;
  padding: 0 !important;
}
html body header nav ul li a {
  color: #0d1b2a !important;
  text-decoration: none !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  padding: 8px 12px !important;
  border-radius: 8px !important;
  transition: background 0.2s ease, color 0.2s ease !important;
  display: inline-block !important;
}
html body header nav ul li a:hover {
  background: rgba(15, 47, 79, 0.06) !important;
  color: #0f2f4f !important;
}

/* Mobile menu toggle hidden by default (desktop) */
html body header .mobile-menu-toggle {
  display: none !important;
  background: transparent !important;
  border: 0 !important;
  font-size: 22px !important;
  color: #0d1b2a !important;
  cursor: pointer !important;
  padding: 6px 10px !important;
}

/* ============ MOBILE (≤ 768px) ============ */
@media (max-width: 768px) {
  html body .top-bar {
    padding: 8px 0 !important;
    font-size: 12px !important;
  }
  html body .top-bar .container,
  html body .top-bar .top-bar-content {
    padding: 0 14px !important;
  }
  /* Two rows, not one overcrowded one.
   *
   * Measured at 390px while this was still `flex-direction: row`: the right
   * side (2 logos + 5 stars + "5/5 (37 recenzí)" + the gold CTA, all
   * white-space: nowrap) needed 292 of the 375 available pixels, so the left
   * side was handed 47px for content that needs 96px. Because page-level CSS
   * also sets `min-width: 0` on .top-bar-left, it was allowed to shrink below
   * its own content instead of stopping at min-content — and nowrap text does
   * not clip, it spills. The phone number ran to x=101 and the e-mail to
   * x=110, straight across the rating logos which start at x=69. That is the
   * overlap; the elements were never actually on top of each other, their
   * text just escaped its box.
   *
   * Previous attempts fixed it by shrinking: 7px stars, 8px icons, the same
   * selectors redeclared up to three times with !important. Four items do not
   * fit side by side in 375px, and shrinking only pushed them below legible
   * size. Contacts get row one, rating + CTA get row two.
   *
   * min-width is forced back to auto here so no page-level `min-width: 0`
   * can reintroduce the sub-min-content collapse. */
  html body .top-bar .top-bar-content {
    flex-direction: column !important;
    align-items: stretch !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
  }
  html body .top-bar .top-bar-left {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    column-gap: 16px !important;
    row-gap: 3px !important;
    gap: 3px 16px !important;
    min-width: auto !important;
  }
  html body .top-bar .top-bar-left a {
    font-size: 12px !important;
    line-height: 1.3 !important;
    gap: 6px !important;
    min-width: auto !important;
  }
  /* line-height: 1 na ikonách. Font Awesome jinak přispívá vlastní metrikou
     a řádek vyšel na každé stránce o pixel jinak — lišta pak měla 65 / 66 /
     67 px podle toho, kde jsi zrovna byl. */
  html body .top-bar .top-bar-left a i {
    font-size: 11px !important;
    line-height: 1 !important;
  }
  html body .top-bar .top-bar-right {
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
    gap: 10px !important;
    min-width: auto !important;
  }
  /* The one thing allowed to give when space runs out is the review count,
     and it truncates rather than overflowing. */
  html body .top-bar .rating-box {
    gap: 5px !important;
    font-size: 11px !important;
    flex-shrink: 1 !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }
  html body .top-bar .rating-firmy-icon,
  html body .top-bar .rating-google-icon {
    width: 14px !important; height: 14px !important;
  }
  html body .top-bar .stars,
  html body .top-bar .stars i {
    font-size: 11px !important;
    line-height: 1 !important;
  }
  html body .top-bar .stars { flex-shrink: 0 !important; align-items: center !important; }
  html body .top-bar .rating-box { line-height: 1.2 !important; }
  /* Obě řádky mají pevnou výšku, takže lišta měří všude přesně stejně. */
  html body .top-bar .top-bar-left,
  html body .top-bar .top-bar-right { min-height: 22px !important; }
  html body .top-bar .rating-text {
    display: inline !important;
    font-size: 11px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    min-width: 0 !important;
  }
  html body .top-bar .free-estimate-box,
  html body .free-estimate-box {
    font-size: 11px !important;
    padding: 6px 12px !important;
    flex-shrink: 0 !important;
    box-shadow: 0 2px 6px rgba(224, 185, 115, 0.35) !important;
  }

  /* Header on mobile — logo wraps to two lines */
  html body header .header-inner {
    padding: 14px 16px !important;
    gap: 12px !important;
  }
  html body header .logo {
    font-size: 15px !important;
    line-height: 1.2 !important;
    white-space: normal !important;
    max-width: calc(100% - 56px) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 2px !important;
  }
  html body header .logo .logo-location {
    display: block !important;
    font-size: 11px !important;
    margin-left: 0 !important;
    color: #7e7e7e !important;
    font-weight: 400 !important;
    line-height: 1.25 !important;
  }

  /* Hide desktop nav, show hamburger */
  html body header nav:not(.active) {
    display: none !important;
  }
  html body header .mobile-menu-toggle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* Active mobile nav (slide-out) */
  html body header nav.active {
    display: block !important;
    position: fixed !important;
    top: 0 !important; right: 0 !important;
    width: 280px !important; height: 100vh !important;
    background: #ffffff !important;
    z-index: 2000 !important;
    padding: 70px 20px 20px !important;
    box-shadow: -8px 0 24px rgba(0,0,0,0.15) !important;
    overflow-y: auto !important;
  }
  html body header nav.active ul {
    flex-direction: column !important;
    gap: 4px !important;
    width: 100% !important;
  }
  html body header nav.active ul li a {
    display: block !important;
    width: 100% !important;
    padding: 12px 14px !important;
    font-size: 16px !important;
  }
}

/* ============ NARROW MOBILE (≤ 380px) ============
 * The rating now has a row to itself, so the review count fits and no longer
 * has to be hidden. Only the star gap tightens. */
@media (max-width: 380px) {
  html body .top-bar .stars { gap: 1px !important; }
  html body .top-bar .rating-text { font-size: 10px !important; }
  html body .top-bar .top-bar-left a { font-size: 11px !important; }
}

/* =====================================================================
 * VÝKON NA MOBILU — žádné rozostření pod lepivou hlavičkou
 *
 * .top-bar i header měly backdrop-filter: blur(10–14px) a header ho měl
 * navíc v transition. Rozostření se musí přepočítat z toho, co je pod
 * prvkem, tedy při každém snímku scrollu, a animovaný backdrop-filter
 * nutí kompozitor blur znovu vytvořit místo aby vrstvu jen posunul.
 * Na telefonu se to sčítalo do sekání a zatuhnutí.
 *
 * Na 768px a méně je hlavička neprůhledná. Vizuálně to na té ploše nikdo
 * nepozná, scroll je plynulý. Na desktopu zůstává sklo beze změny.
 * ===================================================================== */
@media (max-width: 768px) {
  html body .top-bar,
  html body header,
  html body.is-scrolled header {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  html body .top-bar { background: #12365f !important; }
  html body.is-scrolled header { background: #ffffff !important; }
  /* Přechod jen na box-shadow. backdrop-filter se tu už nemění, takže by
     jeho animace jen držela kompozitor zbytečně vzhůru. */
  html body header,
  html body .header-inner {
    transition: box-shadow 240ms cubic-bezier(.2,.8,.2,1) !important;
  }
}

/* Uživatel si vyžádal omezení pohybu — respektovat všude. */
@media (prefers-reduced-motion: reduce) {
  html body .top-bar,
  html body header,
  html body .header-inner {
    transition: none !important;
  }
}
