.nav-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background-color: #fff8f2;
  border-bottom: 1px solid #e2d8ce;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 999;
  box-sizing: border-box;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
}

.logo {
  height: 70px;
  cursor: pointer;
}

.nav-menu {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex: 1;
}

.nav-menu a {
  text-decoration: none;
  color: #5a3d2c;
  font-weight: 500;
}

.nav-menu a:hover {
  color: #ffffff;
  background: #3e2c1c;
}

/* Search styles */
.search-container {
  position: relative;
  display: flex;
  align-items: center;
}

.search-toggle {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.5rem;
  transition: background 0.3s ease;
}

.search-toggle:hover {
  background: rgba(62, 44, 28, 0.1);
}

.search-input {
  position: absolute;
  right: 0;
  top: 100%;
  width: 0;
  opacity: 0;
  padding: 0.5rem;
  border: 2px solid #3e2c1c;
  border-radius: 0.5rem;
  font-size: 1rem;
  transition: all 0.3s ease;
  background: white;
  z-index: 1000;
}

.search-input.show {
  width: 250px;
  opacity: 1;
  margin-top: 0.5rem;
}

.search-input:focus {
  outline: none;
  border-color: #8b4513;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
  position: relative;
}

.search-icon {
  font-size: 1.2rem;
  cursor: pointer;
  transition: transform 0.2s ease;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  z-index: 10;
  color: #8B4513;
}

.search-icon:hover {
  transform: scale(1.2);
}

.search-bar input {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  width: 0;
  padding: 0;
  border: 1px solid #cdbdab;
  border-radius: 0.7rem;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  background: white;
  overflow: hidden;
  pointer-events: none;
}

.search-bar input.show {
  opacity: 1;
  width: 200px;
  padding: 0.4rem 0.8rem;
  min-width: 200px;
  pointer-events: auto;
  right: 30px;
  z-index: 101;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.search-bar input:focus {
  outline: none;
  border-color: #3e2c1c;
  box-shadow: 0 0 0 2px rgba(62, 44, 28, 0.1);
}

.search-section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 1rem;
}

.search-bar input {
  padding: 0.3rem 0.6rem;
  border: 1px solid #d0c4ba;
  border-radius: 0.4rem;
  font-size: 0.9rem;
  width: 200px;
}

.search-bar button {
  padding: 0.3rem 0.6rem;
  background-color: #3e2c1c;
  color: white;
  border: none;
  border-radius: 0.4rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.search-bar button:hover {
  background-color: #5a3d2c;
}

/* Samsung Galaxy S23 specific adjustments */
@media (max-width: 430px) and (min-device-pixel-ratio: 3) {
  .nav-wrapper {
    padding: 0.6rem 1.2rem;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 0.4rem;
    min-height: 80px;
    background-color: #fff8f2;
    border-bottom: 1px solid #e2d8ce;
  }

  .logo-section {
    flex: 0 0 auto;
    justify-content: flex-start;
    margin-bottom: 0;
  }

  .logo {
    height: 36px;
    max-height: 36px;
  }

  .nav-menu {
    flex: 1;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 0.2rem;
    font-size: 0.75rem;
  }

  .nav-menu a {
    padding: 0.4rem 0.5rem;
    white-space: nowrap;
    border-radius: 0.4rem;
    min-width: fit-content;
    min-height: 42px;
    display: flex;
    align-items: center;
    touch-action: manipulation;
  }
}

/* Samsung Galaxy S & smaller devices navigation */
@media (max-width: 22.5em) {
  .nav-wrapper {
    padding: 0.5rem 1rem;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 0.3rem;
    min-height: 80px;
    /* Samsung specific */
    background-color: #fff8f2;
    border-bottom: 1px solid #e2d8ce;
  }

  .logo-section {
    flex: 0 0 auto;
    justify-content: flex-start;
    margin-bottom: 0;
  }

  .logo {
    height: 35px;
    max-height: 35px;
  }

  .nav-menu {
    flex: 1;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 0.1rem;
    font-size: 0.7rem;
  }

  .nav-menu a {
    padding: 0.3rem 0.3rem;
    white-space: nowrap;
    border-radius: 0.2rem;
    min-width: fit-content;
    min-height: 36px;
    display: flex;
    align-items: center;
    /* Better touch targets for Samsung */
    touch-action: manipulation;
  }

  .search-container {
    flex: 0 0 auto;
    justify-content: flex-end;
    margin-top: 0;
  }

  .search-bar input {
    width: 120px;
    font-size: 0.8rem;
    padding: 0.4rem;
    border-radius: 0.3rem;
  }

  .search-bar button {
    font-size: 0.8rem;
    padding: 0.4rem 0.6rem;
    border-radius: 0.3rem;
  }
}

/* iPhone Standard & larger phones navigation */
@media (min-width: 361px) and (max-width: 768px) {
  .nav-wrapper {
    padding: 0.4rem 0.8rem;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 0.3rem;
    min-height: 70px;
    /* iPhone safe area support */
    padding-left: max(0.8rem, env(safe-area-inset-left));
    padding-right: max(0.8rem, env(safe-area-inset-right));
    background-color: #fff8f2;
    border-bottom: 1px solid #e2d8ce;
    /* iOS optimizations */
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
  }

  .logo-section {
    flex: 0 0 auto;
    justify-content: flex-start;
    margin-bottom: 0;
  }

  .logo {
    height: 35px;
  }

  .nav-menu {
    flex: 1;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 0.2rem;
    font-size: 0.8rem;
  }

  .nav-menu a {
    padding: 0.4rem 0.5rem;
    white-space: nowrap;
    border-radius: 8px; /* iOS design language */
    min-width: fit-content;
    min-height: 44px; /* iOS recommended touch target */
    display: flex;
    align-items: center;
    /* iOS optimizations */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .search-container {
    flex: 0 0 auto;
    justify-content: flex-end;
    margin-top: 0;
  }

  .search-bar {
    margin: 0;
    justify-content: flex-end;
  }

  .search-bar input.show {
    width: 200px;
    max-width: 60vw;
    right: 0;
    position: relative;
    transform: none;
    border-radius: 8px;
  }

  .search-bar input {
    width: 150px;
    font-size: 0.9rem;
    padding: 0.5rem;
    border-radius: 8px;
    /* iOS styling */
    -webkit-appearance: none;
    appearance: none;
  }

  .search-bar button {
    font-size: 0.9rem;
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    /* iOS styling */
    -webkit-appearance: none;
    appearance: none;
  }
}

/* Tablet responsive for navigation */
@media (max-width: 1024px) and (min-width: 769px) {
  .search-bar input {
    width: 180px;
  }

  .nav-menu {
    gap: 0.8rem;
  }
}