/* =============================================================================
   Header & search banner
   Extracted from main.css (October 2025 refactor) and extended with
   compact-on-scroll styles.
   ========================================================================== */

header {
  background: #fff;
}

header .wrap {
  display: flex;
  justify-content: flex-start; /* enne space-between */
  align-items: center;
  max-width: calc(1200px - 50px);
  margin: 0 auto;
  padding: 10px 20px 0 0;
  box-sizing: border-box;
}

header .head-right {
  margin-left: auto;           /* lukustab laiuse */
  flex: 0 0 auto;
}

header .cvi h3,
header nav a {
  font-family: var(--font-heading) !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Vasak kimp: logo + claim */
header .cvi {
  display: flex;
  align-items: center;
  gap: 21px;
  margin: 14px 0 16px;
}

.header-mobile-links {
  display: none;
  align-items: center;
  gap: 12px;
}

.header-mobile-links a {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
  color: #1f2a33;
  text-decoration: none;
  transition: color 0.2s ease;
}

.header-mobile-links a:hover,
.header-mobile-links a:focus {
  color: #0099cc;
}

.header-mobile-more {
  appearance: none;
  border: 0;
  background: none;
  font-size: 22px;
  line-height: 1;
  color: #1f2a33;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.header-mobile-more:focus-visible {
  outline: 2px solid #1f7cbf;
  outline-offset: 2px;
}

#logo {
  display: inline-block;
  width: 134px;
  height: 33px;
  background: url(../../img/logo.png) no-repeat 0 0 / 134px 33px;
  flex-shrink: 0;
}

header .cvi h3 {
  margin: 0;
  padding-left: 18px;
  color: #74848f;
  font: 20px/39px var(--font-heading);
  font-weight: 400;
  border-left: 1px solid #dde1e3;
}

/* Parem kimp: top (lemmikud + miniotsing) + nav paremale veergu */
.head-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

/* Ülarida paremal */
.top {
  display: flex;
  align-items: center;
  gap: 15px;
}

/* Miniotsing paremal */
.header-search {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #e2e4e5;
  border-radius: 3px;
  background: #fff;
  padding-right: 6px;
}

.header-search input[type="text"] {
  width: 210px;
  height: 24px;
  border: 0;
  outline: none;
  padding-left: 11px;
  font-size: 12px;
  color: #a6a8a9;
  border-radius: 3px;
}

.header-search button {
  min-width: 24px;
  height: 24px;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 6px;
}

.header-search .btn-text {
  display: none;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: #ffffff;
}

/* Training search (visible in compact header) */
.header-training-search {
  display: none;
  flex: 0 1 500px;
  width: 100%;
}

body:not(.header-is-compact) .header-training-search {
  display: none;
}

body.header-is-compact .header-training-search {
  display: flex;
  flex: 1 1 460px;
  align-items: stretch;
}

.header-training-search .hts-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 3px;
  border-radius: 999px;
  background: linear-gradient(135deg, #2a9fd6, #1f7cbf);
  box-shadow: 0 4px 16px rgba(32, 122, 179, 0.18);
}

.header-training-search .hts-field {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
  padding: 0 14px;
  background: #ffffff;
  border-radius: 999px;
  box-shadow: inset 0 1px 1px rgba(15, 35, 55, 0.08);
}

.header-training-search .hts-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.45;
}

.header-training-search input[type="search"] {
  flex: 1 1 auto;
  min-width: 0;
  height: 34px;
  border: 0;
  background: transparent;
  color: #1f2a33;
  font-size: 14px;
  padding: 0;
  outline: none;
}

.header-training-search .button {
  flex: 0 0 auto;
  min-width: 96px;
  height: 34px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

/* Nav */
header nav {
  margin: 6px 0 10px;
}

header nav ul {
  display: flex;
  gap: 15px;
  margin: 0;
  padding: 0;
  list-style: none;
  flex-wrap: wrap;
}

header nav a {
  display: inline-block;
  padding: 0 4px;
  color: #64686e;
  font: 400 17px/18px var(--font-heading);
  text-decoration: none;
}

header nav a:hover,
header nav li.active > a,
header nav li.current-menu-item > a,
header nav li.current-menu-parent > a,
header nav li.current-menu-ancestor > a {
  color: #229ad2;
}

header nav a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Search Banner (Blue section below header)
   ========================================================================== */

.search-banner {
  background: #239bd3 url(../../img/search_bg.png) repeat-x;
  padding: 18px 0 24px;
}

.search-banner .wrap {
  display: flex !important;
  align-items: center;
  gap: 20px;
  min-height: 80px;
}

.search-banner .cta {
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  flex: 0 0 auto;
  min-width: 280px;
}

.search-banner .cta strong {
  display: block;
  font-size: 34px;
  line-height: 1.2;
  font-weight: 600;
}

.search-banner .cta .sub {
  display: block;
  font-size: 17px;
  letter-spacing: 0.3px;
  line-height: 1.3;
}

.search-banner form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  max-width: 800px;
  min-width: 450px;
}

.search-banner .biginput {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(12, 39, 68, 0.18);
  min-height: 68px;
}

.search-banner .biginput label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  min-width: 48px;
  height: 48px;
}

.search-banner .biginput label.icon.search3 {
  overflow: hidden;
  background-position: 25px -57px;
  width: 25px;
  height: 29px;
}

.search-banner .biginput input {
  flex: 1 1 auto;
  min-width: 0;
  height: 68px !important;
  border: 0;
  background: transparent;
  color: #42474d;
  font-size: 26px;
  outline: none;
  padding: 0;
}

.search-banner .biginput .button {
  flex: 0 0 auto;
  width: 92px;
  margin: 8px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px !important;
  line-height: 52px !important;
  font-size: 16px;
  font-weight: 600;
  border-radius: 6px;
}

.search-banner .controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-banner .cta .sub .num {
  font-family: 'Open Sans', sans-serif;
  font-weight: 600;
}

header > .wrap,
.search-banner .wrap {
  box-sizing: border-box;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 20px;
  padding-right: 20px;
}

@media (max-width: 1399px) {
  header > .wrap,
  .search-banner .wrap {
    max-width: 1200px;
    padding-left: 20px;
    padding-right: 20px;
  }
}

header .cvi {
  margin-left: 10 !important; /* logo+claim plokk */
}

header .wrap {
  margin-left: auto !important; /* ära lükka wrapi täiendavalt paremale */
}

body.header-is-compact .search-banner + #main {
  margin-top: 72px;
}

@media (max-width: 900px) {
  body.header-is-compact .search-banner + #main {
    margin-top: 58px;
  }
}

body.header-is-compact .archive-header,
body.header-is-compact .trainer-header,
body.header-is-compact .company-header {
  display: none !important;
}

/* ==========================================================================
   Compact header state (applied when body has .header-is-compact)
   ========================================================================== */

body.header-is-compact header {
  position: sticky;
  top: 0;
  z-index: 1200;
  padding-bottom: 6px;
  border-bottom: 4px solid #1f7cbf;
  box-shadow: 0 6px 18px rgba(15, 35, 55, 0.12);
}

body.header-is-compact header .wrap {
  padding: 8px 20px 6px 20px;
  gap: 28px;
}

body.header-is-compact header .cvi {
  margin: 4px 0;
}

body.header-is-compact header .cvi h3 {
  display: none;
}

body.header-is-compact .header-mobile-links {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-left: 18px;
}

@media (min-width: 1024px) {
  body.header-is-compact .header-mobile-links {
    display: none !important;
  }
}

body.header-is-compact .header-mobile-more {
  display: none;
}

body.header-is-compact .head-right {
  flex-direction: row;
  align-items: center;
  gap: 12px;
  width: 100%;
}

body.header-is-compact .head-right .top {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
}

body.header-is-compact .head-right .favorites,
body.header-is-compact .header-search {
  display: none;
}

body.header-is-compact .header-training-search {
  display: flex !important;
  flex: 0 1 410px;
  max-width: 410px;
  align-items: stretch;
}

body.header-is-compact .header-training-search .hts-inner {
  padding: 6px;
}

body.header-is-compact .header-training-search .hts-field {
  padding: 0 16px;
}

body.header-is-compact .header-training-search input[type="search"] {
  height: 38px;
  font-size: 15px;
}

body.header-is-compact .header-training-search .button {
  height: 38px;
  min-width: 100px;
}

body.header-is-compact header nav {
  margin: 0;
  flex: 0 0 auto;
}

body.header-is-compact header nav ul {
  gap: 18px;
}

body.header-is-compact .search-banner {
  display: none !important;
  height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
}

/* ==========================================================================
   Mobile adjustments
   ========================================================================== */

@media (max-width: 900px) {
  /* Search banner responsive */
  .search-banner .wrap {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .search-banner form {
    max-width: none;
    min-width: 0;
    width: 100%;
  }

  .search-banner .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .search-banner .button {
    width: 100%;
    margin-left: 0;
  }

  /* Compact header responsive */
  body.header-is-compact header .wrap {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  body.header-is-compact .head-right {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  body.header-is-compact header nav {
    display: none;
  }

  body.header-is-compact .header-training-search {
    flex: 1 1 auto;
    width: 100%;
  }

  body.header-is-compact .header-training-search .hts-inner {
    padding: 6px;
  }

  body.header-is-compact .header-training-search .hts-field {
    padding: 0 14px;
  }

  body.header-is-compact .header-training-search input[type="search"] {
    width: 100%;
  }
}

@media (max-width: 640px) {
  /* Header logo and CTA - smaller on mobile */
  header .wrap {
    position: relative;
    padding: 6px 16px 0 16px;
  }

  header .cvi {
    gap: 10px;
    margin: 8px 0 10px;
    flex: 1 1 auto;
    width: 100%;
    flex-wrap: wrap;
  }

  #logo {
    width: 100px;
    height: 25px;
    background-size: 100px 25px;
  }

  header .cvi h3 {
    display: none;
  }

  .header-mobile-links {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    white-space: nowrap;
  }

  .header-mobile-links a {
    font-size: 13px;
  }

  /* Search banner small mobile */
  .search-banner {
    padding: 14px 0 16px;
  }

  .search-banner .wrap {
    gap: 10px;
  }

  .search-banner form {
    gap: 6px;
    min-width: 0;
  }

  .search-banner .cta {
    gap: 1px;
  }

  .search-banner .cta strong {
    font-size: 22px;
    line-height: 1.2;
  }

  .search-banner .cta .sub {
    font-size: 12px;
  }

  .search-banner .biginput {
    gap: 8px;
    padding: 0 8px;
  }

  .search-banner .biginput label {
    width: 26px;
    min-width: 26px;
    height: 26px;
  }

  .search-banner .biginput input {
    font-size: 16px;
    height: 42px !important;
  }

  .search-banner .biginput .button {
    width: 68px;
    padding: 8px 12px;
    font-size: 14px;
    min-height: 36px;
    height: 42px !important;
  }

  /* Header small mobile */
  header {
    position: sticky;
    top: 0;
    z-index: 1100;
  }

  header nav {
    display: none;
  }

  .head-right {
    align-items: stretch;
  }

  .top {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .top .favorites {
    display: none;
  }

  .header-search {
    display: none;
  }

  .header-training-search {
    display: none !important;
  }

  body.header-is-compact .header-training-search {
    display: flex !important;
    width: 100%;
  }

  body.header-is-compact .header-training-search .hts-inner {
    padding: 6px;
  }

  body.header-is-compact .header-training-search .hts-field {
    padding: 0 12px;
  }

  body.header-is-compact .header-training-search input[type="search"] {
    width: 100%;
  }

  body.mobile-menu-open header nav {
    display: block;
    position: absolute;
    top: calc(100% + 6px);
    right: 16px;
    background: #ffffff;
    border: 1px solid #d6dce6;
    border-radius: 12px;
    box-shadow: 0 14px 28px rgba(15, 35, 55, 0.18);
    padding: 14px 18px;
    min-width: 210px;
    z-index: 1200;
  }

  body.mobile-menu-open header nav ul {
    flex-direction: column;
    gap: 10px;
  }

  body.mobile-menu-open header nav a {
    font-size: 14px;
    display: block;
  }
}
