/* iOS Mobile Preview Normalization */
html {
  -webkit-text-size-adjust: 100%;
}

* {
  -webkit-tap-highlight-color: transparent;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="password"],
input[type="search"],
textarea {
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
}

select {
  -webkit-appearance: none;
  appearance: none;
  background-color: transparent;
  font-family: inherit;
}

button {
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
}

/* End iOS Normalization */

/* ========== HEADER COMPONENT STYLES ========== */


.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background-color: #fffafa;
  backdrop-filter: blur(10px);
  padding: 1.5rem 0;
}

.navbar-container {
  /* max-width: 102vw; */
  display: flex;
  padding: 0 6rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-image {
  height: 70px;
  width: auto;
  cursor: pointer;
}

.nav-wrapper {
  gap: 0.5rem;
  display: flex;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background-color: #5a4538;
  border-radius: 9999px;
  padding: 0.25rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.nav-dropdown-container {
  position: relative;
}

.nav-btn {
  padding: 0.5rem 1.5rem;
  border-radius: 9999px;
  background-color: #5a4538;
  color: white;
  font-size: 1.075rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  text-decoration: none;
}

.nav-btn:hover {
  background-color: #745948;
}

.nav-btn.active {
  background-color: #745948;
}

.nav-cart-btn {
  padding: 0.5rem 0.75rem !important;
}

.cart-image {
  width: 24px;
  height: 24px;
  filter: brightness(0) invert(1);
}

/* Language Switcher */
.language-switcher {
  display: flex;
  align-items: center;
  position: relative;
  gap: 0.25rem;
}

.language-label {
  font-size: 1.1rem;
  color: #5a4538;
  font-weight: 500;
  opacity: 0.7;
}

.language-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.5rem;
  background-color: transparent;
  border: none;
  cursor: pointer;
  color: #5a4538;
  font-size: 1.2rem;
  font-weight: 500;
  transition: all 0.3s ease;
  border-radius: 9999px;
  position: relative;
}

@media (hover: hover) {
  .language-btn:hover {
    background-color: rgba(90, 69, 56, 0.1);
  }
}

.arrow-down {
  width: 20px;
  height: 14px;
  filter: brightness(0) saturate(100%) invert(30%) sepia(15%) saturate(1000%) hue-rotate(350deg);
  transition: transform 0.3s ease;
}

.arrow-down.rotate {
  transform: rotate(180deg);
}

.language-text {
  letter-spacing: 0.05em;
}

.language-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background-color: white;
  border-radius: 1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  min-width: 150px;
  animation: dropdownSlide 0.3s ease-out;
  z-index: 1001;
}

.language-dropdown.active {
  display: block;
}

.language-dropdown-item {
  width: 100%;
  padding: 0.75rem 1.5rem;
  text-align: left;
  border: none;
  background-color: transparent;
  cursor: pointer;
  font-size: 1.075rem;
  font-weight: 500;
  color: #5a4538;
  transition: background-color 0.3s ease;
}

.language-dropdown-item:hover {
  background-color: #f3f3f3;
}

.dropdown-icon {
  transition: transform 0.3s ease;
  width: 16px;
  height: 16px;
}

.dropdown-icon.rotate {
  transform: rotate(180deg);
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: white;
  border-radius: 1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  min-width: 200px;
  margin-top: 1px;
  animation: dropdownSlide 0.3s ease-out;
  z-index: 1002;
}

.dropdown-menu.active {
  display: block;
}

.dropdown-item {
  width: 100%;
  padding: 0.75rem 1.5rem;
  text-align: left;
  border: none;
  background-color: transparent;
  cursor: pointer;
  font-size: 1.075rem;
  transition: background-color 0.3s ease;
}

.dropdown-item:hover {
  background-color: #f3f3f3;
}

@keyframes dropdownSlide {
  0% {
    opacity: 0;
    transform: translateY(-10px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile Actions */
.header-top {
  display: contents;
}

.mobile-actions {
  display: none;
  align-items: center;
  gap: 1rem;
}

.mobile-menu-btn {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  z-index: 1001;
}

.hamburger-line {
  width: 100%;
  height: 3px;
  background-color: #5a4538;
  border-radius: 2px;
  transition: all 0.3s ease;
  transform-origin: center;
}

.mobile-menu-btn.active .hamburger-line:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}

.mobile-menu-btn.active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.mobile-menu-btn.active .hamburger-line:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

.mobile-cart-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  background-color: #5a4538;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
}

.mobile-cart-btn:hover {
  background-color: #745948;
}

.mobile-cart-btn .cart-image {
  width: 24px;
  height: 24px;
  filter: brightness(0) invert(1);
}

.desktop-cart {
  display: flex;
}

/* Mobile Full Screen Menu Overlay */
.mobile-menu-overlay {
  display: none;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 150vh;
  height: 150dvh;
  max-width: 100%;
  background-color: #5a4538;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  overflow: hidden;
  margin: 0 !important;
  padding: 0;
  transform: translateX(0);
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .mobile-menu-overlay.active {
    display: flex !important;
    opacity: 1;
    visibility: visible;
  }
}

@media (min-width: 769px) {
  .mobile-menu-overlay {
    display: none !important;
  }
}

.mobile-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background-color: #5a4538;
  width: 100%;
  flex-shrink: 0;
}

.mobile-menu-header .logo-image {
  height: 45px;
  filter: brightness(0) invert(1);
}

.mobile-menu-close {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

.mobile-menu-close:active {
  transform: scale(0.9);
}

.mobile-menu-close svg {
  color: white;
  width: 32px;
  height: 32px;
}

.mobile-menu-content {
  padding: 1rem 1.5rem;
  padding-bottom: 5rem;
  display: flex;
  flex-direction: column;
  gap: 0;
  background-color: #5a4538;
  width: 100%;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.mobile-menu-content::-webkit-scrollbar {
  width: 6px;
}

.mobile-menu-content::-webkit-scrollbar-track {
  background: transparent;
}

.mobile-menu-content::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

.mobile-menu-content::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.5);
}

.mobile-menu-item {
  background: transparent;
  border: none;
  color: white;
  font-size: 1.7rem;
  font-weight: 400;
  text-align: left;
  padding: 1.5rem 0;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: opacity 0.3s ease;
  letter-spacing: 0.05em;
  text-decoration: none;
}

[dir="rtl"] .mobile-menu-item {
  text-align: right;
  direction: rtl;
  justify-content: space-between;
}

[dir="rtl"] .mobile-menu-item span {
  width: 100%;
  text-align: right;
}

.mobile-menu-item:active {
  opacity: 0.7;
}

.no-border {
  border-bottom: none !important;
}

.mobile-menu-item svg {
  color: white;
  flex-shrink: 0;
}

.mobile-menu-divider {
  height: 1px;
  background-color: rgba(255, 255, 255, 0.1);
  margin: 0;
}

.mobile-language-arrow {
  transition: transform 0.3s ease;
}

.mobile-language-arrow.rotate {
  transform: rotate(180deg);
}

.mobile-shop-arrow {
  transition: transform 0.3s ease;
}

.mobile-shop-arrow.rotate {
  transform: rotate(180deg);
}

.mobile-shop-dropdown {
  display: none;
  flex-direction: column;
  gap: 0;
  padding-left: 1rem;
  margin-top: 0.5rem;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}

[dir="rtl"] .mobile-shop-dropdown {
  padding-left: 0;
  padding-right: 0;
  margin-right: 1.5rem;
}

.mobile-shop-dropdown.active {
  display: flex;
  max-height: 500px;
}

.mobile-shop-category {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.4rem;
  text-align: left;
  padding: 1rem 0;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: color 0.3s ease;
}

[dir="rtl"] .mobile-shop-category {
  text-align: right;
  width: 100%;
}

.mobile-shop-category:active {
  color: white;
}

.mobile-language-options {
  display: none;
  flex-direction: column;
  gap: 0;
  padding-left: 1rem;
  margin-top: 0.5rem;
}

[dir="rtl"] .mobile-language-options {
  padding-left: 0;
  padding-right: 0;
  margin-right: 1.5rem;
}

.mobile-language-options.active {
  display: flex;
}

.mobile-language-option {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.4rem;
  text-align: left;
  padding: 1rem 0;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: color 0.3s ease;
}

[dir="rtl"] .mobile-language-option {
  text-align: right;
}

.mobile-language-option:active {
  color: white;
}

/* Responsive Styles */
@media (max-width: 768px) {
  .navbar {
    padding: 1rem 0rem;
    overflow: visible;
  }

  .navbar-container {
    flex-direction: column;
    padding: 0 0.5rem;
    align-items: stretch;
    gap: 0;
  }

  .header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }

  .logo {
    flex: 0 0 auto;
  }

  .logo-image {
    height: 65px;
  }

  .mobile-actions {
    display: flex;
    flex: 0 0 auto;
  }

  .mobile-menu-overlay {
    left: 0 !important;
    right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
  }

  .desktop-cart {
    display: none !important;
  }

  .nav-wrapper {
    display: none !important;
  }

  .mobile-menu-header .logo-image {
    height: 65px;
  }

  .mobile-menu-item {
    font-size: 1.9rem;
  }

  /* Specific iOS font size reduction for mobile menu items */
  @supports (-webkit-touch-callout: none) {
    .mobile-menu-item {
      font-size: 1.15rem;
    }
  }

  .mobile-shop-category {
    font-size: 1.6rem;
  }

  @supports (-webkit-touch-callout: none) {
    .mobile-shop-category {
      font-size: 1.1rem;
    }
  }

  .mobile-language-option {
    font-size: 1.6rem;
  }

  @supports (-webkit-touch-callout: none) {
    .mobile-language-option {
      font-size: 1.1rem;
    }
  }
}

@media (max-width: 480px) {
  .navbar {
    padding: 0.75rem 0.25rem;
  }

  .logo-image {
    height: 60px;
  }

  .mobile-menu-header .logo-image {
    height: 60px;
  }

  .mobile-menu-item {
    font-size: 1.45rem;
    padding: 1.25rem 0;
  }

  @supports (-webkit-touch-callout: none) {
    .mobile-menu-item {
      font-size: 1.05rem;
    }
  }

  .mobile-shop-category {
    font-size: 1.4rem;
  }

  @supports (-webkit-touch-callout: none) {
    .mobile-shop-category {
      font-size: 1.0rem;
    }
  }

  .mobile-language-option {
    font-size: 1.2rem;
    padding: 0.85rem 0;
  }

  @supports (-webkit-touch-callout: none) {
    .mobile-language-option {
      font-size: 0.95rem;
    }
  }

  .mobile-menu-close svg {
    width: 28px;
    height: 28px;
  }

  .mobile-cart-btn {
    padding: 0.4rem;
  }

  .mobile-cart-btn .cart-image {
    width: 20px;
    height: 20px;
  }
}

@media (max-width: 360px) {
  .logo-image {
    height: 55px;
  }

  .mobile-menu-header .logo-image {
    height: 55px;
  }

  .mobile-menu-item {
    font-size: 1.3rem;
    padding: 1.1rem 0;
  }

  .mobile-shop-category {
    font-size: 1.2rem;
  }

  .mobile-language-option {
    font-size: 1.1rem;
  }
}

/* Fix Arabic text disconnection on iOS due to letter-spacing */
html[lang="ar"],
.lang-ar,
.rtl,
[dir="rtl"] {
  letter-spacing: normal !important;
  word-spacing: normal !important;
}

[lang="ar"] *,
.lang-ar *,
.rtl *,
[dir="rtl"] * {
  letter-spacing: normal !important;
  word-spacing: normal !important;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1;
}