/* --- MOBILE NAV DROPDOWN --- */
.mobile-nav-group {
  width: 100%; /* Osiguraj da zauzima cijelu širinu */
  margin: 0.5rem 0;
}
/* Uklanja plavi tap highlight na mobilnim uređajima */
.mobile-nav-toggle,
.nav-link,
.logo,
.logo-svg,
.header-hamburger,
.dropdown-item,
.nav-dropdown {
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-toggle {
  width: 100%;
  background: none;
  border: none;
  color: #ffe066;
  font-size: 1.25rem;
  font-family: "Roboto", Arial, sans-serif;
  font-weight: 600;
  letter-spacing: 1px;
  text-align: left;
  margin: 0.7em 0;
  padding: 0.5rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0.8rem 10px 0.8rem 0;
  cursor: pointer;
  transition: color 0.18s;
}
.mobile-nav-toggle:focus {
  outline: none;
}
.mobile-nav-arrow {
  font-size: 1.2em;
  margin-left: auto;
  padding-left: 1rem;
  transition: transform 0.2s ease;
}
@media (max-width: 768px) {
  .header-mobile-nav .nav-link,
  .mobile-nav-toggle {
    font-size: 1.15rem;
    margin: 0.6rem 0;
  }
}
@media (max-width: 480px) {
  .header-mobile-nav .nav-link,
  .mobile-nav-toggle {
    font-size: 1.1rem;
    margin: 0.5rem 0;
  }
}
.mobile-nav-group.open > .mobile-nav-toggle .mobile-nav-arrow {
  /* Strelica prema dolje za otvoreni podmeni */
  transform: rotate(90deg);
}
.mobile-nav-submenu {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.2s ease, opacity 0.2s ease;
  padding-left: 2em !important;
}
.mobile-nav-group.open > .mobile-nav-submenu {
  max-height: 200px;
  opacity: 1;
  margin-bottom: 0.2rem;
}
.mobile-nav-submenu .nav-link {
  font-size: 1.15rem !important;
  color: #ffe066 !important;
  padding: 0.6rem 0 !important;
  display: block;
  transition: color 0.2s;
  font-family: "Roboto", Arial, sans-serif !important;
  font-weight: 500 !important;
}
.mobile-nav-submenu .nav-link:hover {
  color: #fff;
}
/* Stil za SVG logo - responsive za sve uređaje */

/* Logo SVG stilovi - responsive za sve uređaje */
.logo-svg {
  height: 40px;
  width: auto;
  display: inline-block;
  transition: all 0.3s ease;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  margin-top: 12px;
  border-radius: 20px;
  transition: all 0.3s ease;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.logo:hover {
  background: rgba(255, 224, 102, 0.1);
}

.logo:hover .logo-svg {
  transform: scale(1.02);
  font-weight: bold;
}

/* Responsive logo veličine */
@media (max-width: 900px) {
  .logo-svg {
    height: 36px;
  }
  .logo {
    padding: 5px 12px;
    margin-top: 10px;
  }
}

@media (max-width: 768px) {
  .logo-svg {
    height: 34px;
  }
  .logo {
    padding: 4px 10px;
    margin-top: 8px;
  }
}

@media (max-width: 700px) {
  .logo-svg {
    height: 32px;
  }
  .logo {
    padding: 4px 8px;
    margin-top: 6px;
  }
}

@media (max-width: 480px) {
  .logo-svg {
    height: 30px;
  }
  .logo {
    padding: 3px 6px;
    margin-top: 4px;
  }
}

/* Most za glatki hover između linka i dropdowna */
.nav-dropdown::before {
  content: "";
  position: absolute;
  bottom: -10px; /* Visina mosta */
  left: 0;
  width: 100%;
  height: 20px; /* Debljina mosta */
  background: transparent;
  pointer-events: none;
  z-index: 1001;
  will-change: transform;
}

.dropdown-active::before {
  pointer-events: auto;
}
.nav-dropdown {
  position: relative;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.nav-dropdown::after {
  content: "";
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-left: 10px;
  pointer-events: none;
  background-image: url('data:image/svg+xml;utf8,<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><polyline points="4,6 8,10 12,6" stroke="%23f3f3f3" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"/></svg>');
  background-repeat: no-repeat;
  background-size: contain;
  transition: transform 0.2s ease;
}

.nav-dropdown:hover::after {
  transform: rotate(180deg);
  background-image: url('data:image/svg+xml;utf8,<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><polyline points="4,6 8,10 12,6" stroke="%23ffe066" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"/></svg>');
}

.nav-dropdown:hover .dropdown-menu,
.nav-dropdown:focus-within .dropdown-menu,
.dropdown-menu--visible {
  display: block;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: #232526;
  border-radius: 12px;
  box-shadow: 0 6px 32px rgba(0, 0, 0, 0.66);
  padding: 8px 0;
  z-index: 1001;
  opacity: 0;
  margin-top: 8px; /* Bolje od calc() za ovaj slučaj */
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.dropdown-menu--visible {
  display: block;
  opacity: 0;
  transform: translateY(0);
}
.dropdown-menu--hiding {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.dropdown-menu:hover,
.dropdown-menu:focus-within {
  display: block;
}
.dropdown-item {
  display: block;
  padding: 12px 28px;
  color: #ffe066;
  text-decoration: none;
  transition: all 0.2s ease;
  text-align: center;
  white-space: normal;
}

.dropdown-item:hover,
.dropdown-item:focus {
  color: #fff;
  background: none;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: transparent;
  height: 90px;
  padding: 0 40px;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  max-width: 100%; /* Dodaj explicit max-width */
  min-width: 100%; /* Dodaj explicit min-width */
  z-index: 10;
  box-shadow: none;
  box-sizing: border-box; /* Osiguraj da padding ne prelazi granice */
}

.header-left {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.header-middle {
  flex: 3;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2.5rem;
  background: none;
  transition: all 0.3s ease;
}

/* Responsive stilovi za header navigaciju */
@media (max-width: 1250px) {
  .header-middle {
    gap: 2rem; /* Smanjuje razmak na srednje velikim ekranima */
  }
}

@media (max-width: 1150px) {
  .header-middle {
    gap: 1.3rem; /* Agresivnije smanjuje gap za problematične širine */
  }

  .nav-link-main,
  .nav-link {
    font-size: 1.1rem; /* Smanjuje font da zauzme manje prostora */
    padding: 6px 16px; /* Smanjuje padding */
  }
}

@media (max-width: 1100px) {
  .header-middle {
    gap: 1rem; /* Dodatno smanjuje razmak */
  }

  .nav-link-main,
  .nav-link {
    font-size: 1.05rem;
    padding: 6px 14px;
  }
}

@media (max-width: 1025px) {
  .header-middle {
    gap: 0.8rem; /* Još manji gap za uže ekrane */
  }

  .nav-link-main,
  .nav-link {
    font-size: 1rem;
    padding: 5px 12px;
  }
}

@media (max-width: 1000px) {
  .header-middle {
    gap: 0.7rem; /* Minimalni razmak prije prebacivanja na mobile */
  }

  .nav-link-main,
  .nav-link {
    font-size: 1rem; /* Malo manje slovo */
    padding: 5px 10px; /* Smanjeni padding */
  }
}

.nav-link-main,
.nav-link {
  color: #f3f3f3;
  font-size: 1.15rem;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: 20px;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  cursor: pointer;
  text-shadow: 0 2px 8px #000;
  white-space: nowrap; /* Sprečava prelamanje teksta u linkovima */
}
.nav-link-main:hover,
.nav-link:hover {
  background: rgba(255, 224, 102, 0.1);
  color: #ffe066;
  box-shadow: 0 2px 12px #0002;
}

.header-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1.2rem;
  background: none;
}

.header-social {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 50%;
  transition: background 0.2s;
  color: #ffe066;
}
.header-social:hover {
  background: #ffe06622;
  transform: scale(1.05);
  transition: all 0.2s ease;
}

.header-social svg {
  display: block;
}

.header-right div {
  color: #f3f3f3;
  font-size: 1rem;
  font-weight: 500;
  padding: 7px 16px;
  border-radius: 18px;
  background: rgba(34, 34, 34, 0.18);
  margin-left: 8px;
  text-shadow: 0 2px 8px #000;
  transition: background 0.2s, color 0.2s;
}
.header-right div:hover {
  background: #ffe066;
  color: #232526;
}

.header-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5em 0.7em;
  margin-left: 0.5em;
  z-index: 1002;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.header-hamburger span,
.header-hamburger span::before,
.header-hamburger span::after {
  display: block;
  background: #ffe066;
  height: 3px;
  width: 28px;
  border-radius: 2px;
  position: relative;
  transition: all 0.25s;
}
.header-hamburger span::before,
.header-hamburger span::after {
  content: "";
  position: absolute;
  left: 0;
}
.header-hamburger span::before {
  top: -9px;
}
.header-hamburger span::after {
  top: 9px;
}

/* Hamburger active (X) */
.header-hamburger.active span {
  background: transparent;
}
.header-hamburger.active span::before {
  top: 0;
  transform: rotate(45deg);
}
.header-hamburger.active span::after {
  top: 0;
  transform: rotate(-45deg);
}

/* Mobilna navigacija */
.header-mobile-nav {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  width: 80vw;
  max-width: 340px;
  height: 100vh;
  height: 100dvh; /* Better handling on mobile browsers with dynamic toolbars */
  background: #232526;
  box-shadow: -2px 0 24px #000a;
  z-index: 1001;
  flex-direction: column;
  align-items: flex-start;
  padding: 2.5em 1.5em 1.5em 1.5em;
  gap: 1.5em;
  transition: transform 0.25s;
  transform: translateX(100%);
  overflow-y: auto; /* Allow inner scrolling when content exceeds viewport */
  -webkit-overflow-scrolling: touch; /* Smooth momentum scrolling on iOS */
  overscroll-behavior: contain; /* Prevent scroll chaining to the page */
  touch-action: pan-y; /* Ensure vertical pan gestures scroll the menu */
}
.header-mobile-nav.open {
  display: flex;
  transform: translateX(0);
}

/* Mobile auth bar pinned at bottom */
@media (max-width: 1024px) {
  #header-mobile-nav {
    display: none; /* default closed */
  }
  #header-mobile-nav.open {
    display: flex;
  }
  #mobile-auth-container {
    margin-top: auto; /* push to bottom */
    width: 100%;
  }
  .mobile-auth-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 8px calc(8px + env(safe-area-inset-bottom, 0px)) 0;
    border-top: 1px solid #34383a;
    gap: 12px;
  }
  .mobile-auth-left {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ffe066;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.5px;
  }
  .mobile-auth-left.is-guest .mobile-user-name {
    opacity: 0.85;
    font-weight: 500;
  }
  .mobile-auth-left .user-icon {
    width: 20px;
    height: 20px;
    color: #ffe066;
  }
  .mobile-auth-right .mobile-logout-btn,
  .mobile-auth-right .mobile-login-btn {
    background: none;
    border: 1px solid #ffe066;
    color: #ffe066;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    cursor: pointer;
  }
  .mobile-auth-right .mobile-logout-btn:hover,
  .mobile-auth-right .mobile-login-btn:hover {
    background: #ffe06622;
  }
}

.header-mobile-nav .nav-link {
  padding-left: 0;
  display: block;
  font-size: 1.25rem;
  color: #ffe066;
  margin: 0.7em 0;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: 1px;
  transition: color 0.18s;
}
.header-mobile-nav .nav-link:hover {
  color: #fff;
}

/* Overlay za mobilni meni */
.header-mobile-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(24, 28, 34, 0.7);
  z-index: 1000;
}
.header-mobile-overlay.open {
  display: block;
}

/* Responsive */
@media (max-width: 1024px) {
  .header-middle {
    display: none;
  }

  .header-hamburger {
    display: block;
  }

  /* Hide desktop/tablet auth UI on mobile; mobile auth lives in the drawer */
  .auth-container {
    display: none !important;
  }
}

@media (max-width: 900px) {
  .header-middle {
    display: none !important;
  }
  .header-hamburger {
    display: block;
  }
  .header {
    padding: 0.8rem 1rem;
  }
  .header-left {
    font-size: 1.6rem;
  }
}

@media (max-width: 768px) {
  .header {
    padding: 0.7rem 0.8rem;
  }
  .header-mobile-nav {
    width: 85vw;
    max-width: 300px;
    padding: 2rem 1.2rem 1.2rem 1.2rem;
  }
  .header-mobile-nav .nav-link {
    font-size: 1.15rem;
    margin: 0.6rem 0;
  }
}

@media (max-width: 700px) {
  .header {
    padding: 0.6rem 0.5rem;
  }

  /* Sakrij Facebook i Instagram ikone na mobilnim uređajima */
  .header-social {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 0.5rem 0.3rem;
  }
  .header-mobile-nav {
    width: 90vw;
    max-width: 280px;
    padding: 1.5rem 1rem 1rem 1rem;
  }
  .header-mobile-nav .nav-link {
    font-size: 1.1rem;
    margin: 0.5rem 0;
  }
}
