/*
  ASO – HEADER (CSS)
  - Desktop grid hlavičky a vložení vyhledávání doprostřed
  - Desktop stylování search widgetu a whispereru
  - Mobile full-screen overlay a ovládací prvky (křížek)
  - Utility bar (kontaktní lišta) – pouze desktop
*/

/* ====== DESKTOP LAYOUT & SEARCH (≥ 992px) ====== */
@media (min-width: 992px){
  /* Grid hlavičky */
  #header .header-top > .container.navigation-wrapper.header-top-wrapper{
    display: grid !important;
    grid-template-columns: minmax(180px,20%) minmax(520px,60%) minmax(180px,20%);
    align-items: center;
    gap: 16px;
    padding: 10px 20px;
    box-sizing: border-box;
    position: relative;
    overflow: visible !important;
    z-index: 50;
  }
  #header .header-top .header-top-wrapper > div{
    width: auto !important;
    flex: 0 0 auto !important;
  }

  /* Logo vlevo */
  #header .header-top .site-name{
    grid-column:1; justify-self:start; text-align:left!important; margin:0!important;
  }
  #header .header-top .site-name a{ display:inline-block; }
  #header .header-top .site-name img[src*="logo-aso-1"]{
    max-width: none !important; width: auto !important; height: auto;
    max-height:56px; object-fit:contain; display:block;
  }

  /* Střed – držák pro vyhledávání */
  #aso-header-search{ grid-column:2; justify-self:center; width:100%; position:relative; z-index:60; }

  /* Search widget v hlavičce je statický blok (ne popup) */
  #aso-header-search .user-action-search.search-widget{
    position: static !important;
    display:block !important;
    visibility:visible !important;
    opacity:1 !important;
    transform:none !important;
    background:transparent !important;
    box-shadow:none !important;
  }
  /* Křížek na desktopu nepotřebujeme */
  #aso-header-search .search-widget-close{ display:none !important; }

  /* Search form – full width, s ikonou lupy jako ::before */
  #aso-header-search form.search-form,
  #aso-header-search form.search-form.compact-form{
    width:100% !important; max-width:none !important; margin:0 !important;
    position:relative; display:flex; align-items:stretch;
    height:auto !important; padding:0 14px 0 40px; font-size:16px;
  }
  #aso-header-search .search-form-input-group{ display:flex !important; align-items:stretch !important; width:100% !important; gap:0; }
  #aso-header-search .search-input-icon{ display:none !important; }
  #aso-header-search .query-input{ flex:1 1 auto !important; min-width:0 !important; border:0 !important; outline:0 !important; box-shadow:none !important; }
  .popup-widget.search-widget form .search-form-input-group .search-button{
    position: static !important; margin-left: 8px !important; align-self: stretch !important; white-space: nowrap;
  }
  #aso-header-search form.search-form:before{
    content:""; position:absolute; left:14px; top:50%; transform:translateY(-50%);
    width:18px; height:18px; opacity:.55;
    background:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="%2399a1a8" d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79L20 21.5 21.5 20l-6-6zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/></svg>') no-repeat center/contain;
  }

  /* Whisperer pod inputem přes celou šířku */
  #aso-header-search .searchWhisperer,
  #aso-header-search .search-whisperer{
    position:absolute; left:0; right:0; top:calc(100% + 6px);
    width:100% !important; min-width:100% !important; max-width:none !important; z-index:200;
  }
  #aso-header-search .searchWhisperer > *,
  #aso-header-search .search-whisperer > *{ width:100% !important; max-width:none !important; box-sizing:border-box; }

  /* Vpravo ovládací tlačítka; schovej lupy (otevírá popup, který tu nechceme) */
  #header .header-top .navigation-buttons{ grid-column:3; justify-self:end; display:flex; gap:12px; align-items:center; }
  #header .header-top .navigation-buttons [data-target="search"]{ display:none !important; }

  /* Jednotné nastavení pro instanci popup widgetu vloženou do #aso-header-search */
  #aso-header-search .popup-widget.search-widget,
  html body #aso-header-search .popup-widget.search-widget,
  html.admin-logged body #aso-header-search .popup-widget.search-widget{
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    left: auto !important;
    right: auto !important;
    display: block !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }
  #aso-header-search form.search-form,
  #aso-header-search form.search-form.compact-form{
    width: 100% !important;
    display: block !important;
  }

  /* Jemné dorovnání wrapperu */
  #aso-header-search{
    justify-self: stretch !important;
    text-align: left !important;
    width: 100% !important;
  }
}

/* ====== MOBILE (≤ 991.98px) – base ====== */
@media (max-width: 991.98px){
  /* Střední pozice pro desktop na mobilu neukazuj */
  #aso-header-search{ display: none !important; }

  /* Search widget jako fullscreen overlay */
  .user-action .user-action-search.search-widget {
    position: fixed !important;
    top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    z-index: 9999 !important;
    background: rgba(0,0,0,0.5) !important;
  }

  /* Stav „skryto“ – řídí JS */
  .user-action .user-action-search.search-widget.aso-hidden{
    display: none !important;
  }

  /* Zruš případné staré duplicitní křížky */
  .user-action .user-action-search.search-widget .aso-close{
    display: none !important;
  }

  /* Jeden křížek nahoře */
  .user-action .user-action-search.search-widget .search-widget-close,
  .user-action .user-action-search.search-widget .close{
    position: fixed !important;
    top: 10px; right: 10px;
    z-index: 10001 !important;
    display: flex !important; align-items:center; justify-content:center;
    width: 40px; height: 40px; border-radius: 999px;
    background: #fff !important; box-shadow: 0 2px 12px rgba(0,0,0,.15);
  }
}

/* ====== UTILITY BAR (desktop only) ====== */
:root{
  --aso-accent: var(--cta, #009901);
  --aso-ub-h: 0px; /* výška horní lišty pro případné offsety */
}
.aso-ub{
  position: relative;
  z-index: 10;
  background: #f7f9fb;
  border-bottom: 1px solid #eef1f4;
  font-size: 14px;
  line-height: 1.2;
  color: #111;
}
.aso-ub-in{
  max-width: 1200px;
  margin: 0 auto;
  padding: 7px 16px;
  display: flex;
  gap: 22px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.aso-ub a{ color: inherit; text-decoration: none; white-space: nowrap; }
.aso-ub a:hover{ color: var(--aso-accent); }
.aso-ub .item{ display: flex; align-items: center; gap: 8px; }
.aso-ub .ico{ display: inline-flex; width: 18px; height: 18px; }
.aso-ub svg{ width: 18px; height: 18px; display: block; fill: currentColor; }

/* Desktop – skrýt texty pod 1200px (ponecháno) */
@media (max-width: 1200px){
  .aso-ub .txt{ display: none; }
  .aso-ub-in{ justify-content: space-between; }
}
/* Na mobilu utility bar neschovávej skriptem – zde fallback: nezobrazovat */
@media (max-width: 991.98px){
  .aso-ub{ display: none !important; height: 0 !important; padding: 0 !important; border: 0 !important; }
}
