/* ============================================
   HEADER WRAPPER & CONTAINER
============================================ */
.backdrop-blur-md {
  background-color: var(--bg-hdr-color);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--slate-200);
  transition: all 0.3s;
}

.header-wrapper {
  grid-area: header;
  display: flex;
  justify-content: center;
  z-index: var(--menu-idx);
  /* background-color: var(--bg-color); */
  border-bottom: 1px solid var(--slate-800);
  padding-block: 0.5rem;
  transition: border-color 0.3s;
  min-height: 4rem;
}

.header-wrapper .header {
  display: flex;
  flex-wrap: wrap;
  row-gap: 1rem;
  width: 100%;
  padding-inline: 0.5rem;
}

/* Spoločné štýly pre riadky v headery */
.menu-row {
  display: flex;
  align-items: center;
}

/* ============================================
   LOGO
============================================ */
.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 700;
  margin-inline-start: 0.5rem;
  width: 15rem;
  cursor: pointer;
  position: relative;
}

.logo .icon {
  background-color: var(--orange-500);
  padding: 0.275rem;
  color: white;
  transform: rotate(-6deg);
  border-radius: 0.5rem;
  width: 1.75rem;
  height: 1.75rem;
}

.logo span {
  font-weight: 800;
  letter-spacing: -0.025em;
}

/* ============================================
   SEARCH COMPONENT
============================================ */
.search-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 100px;
  order: 3;
  /* Mobile: pod logom a profilom */
  justify-content: center;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  background-color: var(--icon-hover-bg);
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 4px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-wrapper:not(.has-results) .search:focus-within {
  border-color: var(--color-orange);
}

.search #searchitems {
  flex: 1;
  border: none;
  padding: 0.5rem 0.75rem;
  font-size: 16px;
  background-color: transparent;
  color: var(--text-primary);
  outline: none;
  font-weight: 500;
}

.search #searchitems::placeholder {
  color: var(--color-text-tertiary);
  font-weight: 400;
}

/* Vyhľadávacie tlačidlo */
.search .icon-btn {
  background: var(--icon-hover-bg);
  border: none;
  border-radius: 12px;
  width: 56px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-primary);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search .icon-btn:hover {
  background: var(--icon-hover);
  color: var(--app-bg-2);
  transform: scale(1.05);
}

.search .icon-btn svg {
  width: 1.5rem;
  height: 1.5rem;
  stroke-width: 2.5;
  fill: none;
  /* Pre search icon */
}

/* Výsledky hľadania */
.result-wrapper {
  position: relative;
}

.search-results {
  position: absolute;
  width: 100%;
  z-index: 10;
}

/* start */
/* ============================================
   SEARCH AUTOCOMPLETE / SUGGESTIONS
============================================ */
/* Kontajner, ktorý drží výsledky (relatívny k hľadaniu) */
.result-wrapper {
  position: relative;
  width: 100%;
  z-index: var(--menu-idx);
}

/* Samotný vysúvací panel s výsledkami */
.search-results {
  position: absolute;
  top: 0;
  /* Hneď pod .search elementom */
  left: 0;
  right: 0;
  background-color: var(--surface);
  /*border: 1px solid var(--color-orange); Oranžový lem ladí s focusom inputu */
  border-top: none;
  /* Odstránime horný lem, aby splynul s inputom */
  border-radius: 0 0 16px 16px;
  /* Zaoblenie len na spodku */
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  max-height: 400px;
  overflow-y: auto;
  /* Animácia objavenia */
  animation: slideDown 0.2s ease-out;
}

.has-results .search-results {
  border: 1px solid var(--color-orange);
}

.search-wrapper {
  &.has-results {
    border-radius: 16px 16px 0px 0px;
    border: 1px solid var(--color-orange);
  }
}

/* Jednotlivý riadok výsledku */
.search-results .suggest {
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
}

.search-results .suggest:last-child {
  border-bottom: none;
}

/* Hover stav riadku */
.search-results .suggest:hover {
  background-color: rgb(var(--highlight-rgb) / 1);
  color: var(--brand-600);
  padding-left: 1.5rem;
  /* Jemný posun doprava pre dynamický efekt */
}

/* Štýl pre zvýraznený text (<mark>) */
.search-results .suggest mark {
  background-color: transparent;
  color: var(--brand-500);
  font-weight: 800;
  text-decoration: underline;
}

/* Úprava pre Dark Mode */
body.dark .search-results {
  background-color: var(--surface);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

body.dark .search-results .suggest:hover {
  background-color: var(--surface-active);
}

/* Pomocná animácia */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Custom scrollbar pre výsledky */
.search-results::-webkit-scrollbar {
  width: 6px;
}

.search-results::-webkit-scrollbar-track {
  background: transparent;
}

.search-results::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}

/* end */
/* ============================================
   PROFILE & ACTIONS
============================================ */
.profile-wrapper {
  margin-inline-start: auto;
  gap: 0.5rem;
}

.profile-wrapper .btn.profile {
  display: flex;
  align-items: center;
  padding: var(--space-2xs) var(--space-xs);
  border: 1px solid transparent;
  color: var(--text-primary);
  background: transparent;
  cursor: pointer;
}

.profile-wrapper .icon {
  width: 1.5rem;
}

.profile-wrapper .title {
  display: none;
}

/* Skryté na mobile aj desktope podľa HTML */
/* ============================================
   MENU BUTTON
============================================ */
.menu-btn {
  display: flex;
  color: var(--text-primary);
  background: transparent;
  border: none;
  cursor: pointer;
}

.menu-btn .icon {
  width: 2.5rem;
  height: 2.5rem;
}

.menu-btn:hover, .profile.btn:hover {
  color: var(--icon-hover);
}

@media screen and (max-width: 1024px) {
  .center-row {
    --logo-width: 18rem;
    flex-grow: 1;
    justify-content: space-between;

    .logo {
      margin-inline: auto;
    }
  }
}

@media screen and (max-width: 324px) {
  .center-row {
    --logo-width: 13rem;
  }
}

/* ============================================
   DESKTOP OPTIMIZATION (1024px+)
============================================ */
@media screen and (min-width: 1024px) {
  .header-wrapper {
    border-bottom: 1px solid var(--color-border);
  }

  .header-wrapper .header {
    max-width: var(--app-width);
    flex-wrap: nowrap;
    margin-inline: auto;
  }

  .search-wrapper {
    order: 2;
    /* Desktop: do stredu */
    width: 50%;
    margin-inline: auto;
  }

  .profile-wrapper {
    order: 3;
    margin-inline-start: 0;
  }

  /* Interakcie tlačidiel v headery */
  .header .menu-row button:hover {
    background-color: var(--color-bg-tertiaty-active);
    border-radius: 0.5rem;
  }
}

/* ============================================
   POTENCIÁLNE NEPOUŽITÉ / DOPLNKOVÉ ŠTÝLY
============================================ */
.caps {
  text-transform: capitalize;
}

.search-wrapper .suggest {
  /* background-color: var(--bg-color); */
  background-color: var(--icon-hover-bg);
  padding: 0.5rem 0.75rem;
}

.search-wrapper .suggest mark {
  font-weight: bold;
  background-color: transparent;
}

button.icon {
  background: var(--icon-hover-bg);
  border: none;
  border-radius: 12px;
  width: 56px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-right: 4px;
  color: var(--text-primary);
}

.search-wrapper .search button.icon:focus-visible {
  outline: 1px solid var(--color-primary);
}

.search-wrapper .search button.icon:hover {
  background: var(--icon-hover);
  color: var(--app-bg-2);
  transform: scale(1.05);
}

.search-wrapper .search button.icon:active {
  transform: scale(0.95);
}

.search-wrapper .search button.icon svg {
  width: 1.5rem;
  height: 1.5rem;
  stroke: transparent;
  stroke-width: 2.5;
  color: inherit;
}