/******************** Header Styles ********************/

/* Reset WordPress default nav styles */
nav ul,
nav li,
.main-nav ul,
.main-nav li {
  list-style: none !important;
}

nav a,
.main-nav a {
  text-decoration: none !important;
  color: inherit;
  font-size: 1.375rem;
  font-weight: 600;
}

@media (max-width: 767px) {
  nav a,
  .main-nav a {
    font-size: 1.25rem;
  }
}

nav li,
.main-nav li {
  display: flex;
  margin: 0.375rem;
}

.announcement-bar-container {
  background: var(--color-text-global, #603813);
}

.header-container {
  background-color: var(--color-accent, #ffce00);
  position: relative;
}

.announcement-text {
  font-family: var(--font-family-rubik);
  font-size: 20px;
  font-weight: 400;
  color: var(--color-background, #fffdf9);
  margin: 0;
}

.desktop-header-layout {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  position: relative;
  gap: 1rem;
  height: 100px;
}

/* Icon Containers */
.left-icons-container {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .left-icons-container {
    margin-right: 100px;
  }
}

/* Desktop Categories Navigation */
.navigation-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  align-self: stretch;
  height: 100%;
}

.navigation-container nav {
  height: 100%;
}

/* Hamburger Menu */
.mobile-hamburger {
  display: none;
}

.hamburger-icon {
  width: 28px;
  height: 28px;
  display: block;
}

/* Logo Container */
.logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-logo {
  max-width: 100%;
  height: auto;
}

.desktop-categories-nav {
  width: 100%;
}

.desktop-categories-list {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
}

.desktop-category-item {
  list-style: none;
  margin: 0;
  padding: 0;
  display: inline-block;
  flex-shrink: 0;
}

.desktop-category-link {
  display: block;
  padding: 0.5rem 0;
  font-size: 1rem;
  color: #603813;
  text-decoration: none;
  transition: color 0.2s ease;
  white-space: nowrap;
}

.desktop-category-link:hover {
  color: #603813;
}

/* Icon Buttons */
.icon-button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
  position: relative;
  box-shadow: none;
}

/* Profile Icon SVG */
.profile-icon-svg {
  width: 1.625rem;
  height: 1.625rem;
  display: block;
}

.search-icon-svg {
  width: 1.625rem;
  height: 1.625rem;
}

.profile-icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Search Icon - Font Awesome */
.search-icon-button .search-icon,
.search-submit-btn .search-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  position: relative;
}

.search-icon-button-left {
  display: flex;
}

.search-icon-button-right {
  display: none;
}

@media (max-width: 767px) {
  .search-icon-button-left {
    display: none;
  }
  .search-icon-button-right {
    display: flex;
  }
}

.search-icon-button .search-icon::before,
.search-submit-btn .search-icon::before {
  content: "\f002";
  font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", "FontAwesome";
  font-weight: 900;
  font-style: normal;
  font-variant: normal;
  text-rendering: auto;
  -webkit-font-smoothing: antialiased;
  line-height: 1;
  color: #603813;
  font-size: 20px;
  display: inline-block;
}

/* Cart Icon SVG */
.cart-icon-svg {
  width: 1.75rem;
  height: 1.75rem;
  display: block;
}

.cart-icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-button img {
  width: 30px;
  height: 30px;
}

/* Search Bar Container */
.search-bar-container {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-in-out;
  border-bottom: 1px solid #e5e7eb;
}

.search-bar-container.active {
  max-height: 100px;
}

.search-bar-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 0 1rem 0;
}

@media (max-width: 767px) {
  .search-bar-inner {
    padding: 0 0 0.25rem 0;
  }
}

.search-input {
  width: 100%;
  max-width: 500px;
  padding: 10px 16px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-family: "Alef", sans-serif;
  font-size: 16px;
  direction: rtl;
  transition: border-color 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: #603813;
}

/* FiboSearch Styling - Maintain current font and style */
.fibosearch-wrapper {
  width: 100%;
  max-width: 500px;
  direction: rtl;
  margin: 0 0.5rem;
}

.fibosearch-wrapper * {
  font-family: "Alef", sans-serif !important;
}

.fibosearch-wrapper input[type="search"],
.fibosearch-wrapper input[type="text"],
.fibosearch-wrapper .dgwt-wcas-search-form input,
.fibosearch-wrapper .dgwt-wcas-search-wrapp input {
  font-family: "Alef", sans-serif !important;
  font-size: 16px !important;
  direction: rtl !important;
  padding: 10px 16px !important;
  border: 1px solid #d1d5db !important;
  border-radius: 6px !important;
  transition: border-color 0.2s ease !important;
}

.fibosearch-wrapper input[type="search"]:focus,
.fibosearch-wrapper input[type="text"]:focus,
.fibosearch-wrapper .dgwt-wcas-search-form input:focus,
.fibosearch-wrapper .dgwt-wcas-search-wrapp input:focus {
  outline: none !important;
  border-color: #603813 !important;
}

.fibosearch-wrapper .dgwt-wcas-search-form,
.fibosearch-wrapper .dgwt-wcas-search-wrapp {
  width: 100% !important;
  max-width: 500px !important;
}

/* FiboSearch Suggestions Dropdown - RTL Styling */
.dgwt-wcas-suggestions-wrapp {
  direction: rtl !important;
  text-align: right !important;
}

.dgwt-wcas-suggestions-wrapp * {
  direction: rtl !important;
  text-align: right !important;
}

/* Headlines */
.dgwt-wcas-suggestions-wrapp .dgwt-wcas-suggestion-headline {
  text-align: right !important;
}

.dgwt-wcas-suggestions-wrapp .dgwt-wcas-suggestion-headline .dgwt-wcas-st {
  text-align: right !important;
}

/* Product suggestions - reverse layout for RTL */
.dgwt-wcas-suggestions-wrapp .dgwt-wcas-suggestion-product {
  display: flex !important;
  flex-direction: row-reverse !important;
  align-items: center !important;
  text-align: right !important;
}

/* Image container - move to right side */
.dgwt-wcas-suggestions-wrapp .dgwt-wcas-si {
  order: 2 !important;
  margin-left: 12px !important;
  margin-right: 0 !important;
}

.dgwt-wcas-suggestions-wrapp .dgwt-wcas-si img {
  display: block !important;
}

/* Content wrapper - align to right */
.dgwt-wcas-suggestions-wrapp .dgwt-wcas-content-wrapp {
  order: 1 !important;
  flex: 1 !important;
  text-align: right !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-end !important;
}

/* Product title - right align */
.dgwt-wcas-suggestions-wrapp .dgwt-wcas-st-title {
  text-align: right !important;
  direction: rtl !important;
}

.dgwt-wcas-suggestions-wrapp .dgwt-wcas-st {
  text-align: right !important;
  direction: rtl !important;
}

/* Price - position on right side */
.dgwt-wcas-suggestions-wrapp .dgwt-wcas-meta {
  text-align: right !important;
  direction: rtl !important;
}

.dgwt-wcas-suggestions-wrapp .dgwt-wcas-sp {
  text-align: right !important;
  direction: rtl !important;
}

.dgwt-wcas-suggestions-wrapp .woocommerce-Price-amount {
  direction: rtl !important;
  text-align: right !important;
}

.dgwt-wcas-suggestions-wrapp .woocommerce-Price-amount bdi {
  direction: rtl !important;
  text-align: right !important;
}

/* Category suggestions */
.dgwt-wcas-suggestions-wrapp .dgwt-wcas-suggestion-tax {
  text-align: right !important;
  direction: rtl !important;
}

.dgwt-wcas-suggestions-wrapp .dgwt-wcas-st-breadcrumbs {
  text-align: right !important;
  direction: rtl !important;
}

/* "See all" link */
.dgwt-wcas-suggestions-wrapp .dgwt-wcas-suggestion-more {
  text-align: right !important;
  direction: rtl !important;
}

.dgwt-wcas-suggestions-wrapp .dgwt-wcas-st-more {
  text-align: right !important;
  direction: rtl !important;
}

.search-close-btn,
.search-submit-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
}

.search-close-btn:hover,
.search-submit-btn:hover {
  background-color: #e5e7eb;
}

.search-close-btn img,
.search-submit-btn img {
  width: 24px;
  height: 24px;
}

/* Cart Badge */
.cart-badge {
  position: absolute;
  top: 0;
  right: 0;
  background-color: #603813;
  color: white;
  font-size: var(--font-size-small);
  font-weight: 600;
  border-radius: 50%;
  width: 1.25rem;
  height: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 767px) {
  .cart-badge {
    font-size: var(--font-size-extra-small);
    width: 1rem;
    height: 1rem;
  }
}

/* Add to Cart Notification */
.added-to-cart-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background-color: #10b981;
  color: white;
  padding: 16px 24px;
  border-radius: 8px;
  font-family: "Bona Nova SC", serif;
  font-size: 14px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  z-index: 10000;
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.3s ease;
  pointer-events: none;
}

.added-to-cart-notification.show {
  opacity: 1;
  transform: translateY(0);
}

/* Toast Notification System */
.toast-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 16px 24px;
  border-radius: 8px;
  font-family: "Bona Nova SC", serif;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 10001;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
  pointer-events: none;
  max-width: 350px;
  direction: rtl;
  display: flex;
  align-items: center;
  gap: 12px;
}

.toast-notification.show {
  opacity: 1;
  transform: translateX(0);
}

.toast-notification.success {
  background-color: #10b981;
  color: white;
}

.toast-notification.error {
  background-color: #ef4444;
  color: white;
}

.toast-notification.info {
  background-color: #3b82f6;
  color: white;
}

.toast-notification-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast-notification-message {
  flex: 1;
  line-height: 1.5;
}

.container-nav {
  justify-content: center;
}

/* Mobile Styles (below 767px) */
@media (max-width: 767px) {
  /* Text size for mobile */
  .announcement-text {
    font-size: 16px;
  }

  /* Unified header layout - single row on mobile */
  .desktop-header-layout {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    height: 60px;
  }

  /* Navigation container - hamburger visible */
  .navigation-container {
    flex-shrink: 0;
    margin: 0;
    position: relative;
    gap: 0.25rem;
  }

  .navigation-container .main-nav {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: auto;
    min-width: 250px;
    max-width: 70vw;
    background-color: #fff;
    z-index: 1000;
    box-shadow: -4px 0 6px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    border-left: 1px solid #e5e7eb;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
  }

  .navigation-container .main-nav.mobile-active {
    transform: translateX(0);
  }

  /* Mobile menu close button */
  .mobile-nav-close {
    display: none;
  }

  .main-nav .mobile-nav-close {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 1rem;
    left: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    color: #603813;
    transition: opacity 0.2s ease;
  }

  .main-nav .mobile-nav-close:hover {
    opacity: 0.7;
  }

  .main-nav .mobile-nav-close svg {
    width: 24px;
    height: 24px;
  }

  /* Backdrop overlay when menu is open */
  .mobile-nav-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
    pointer-events: none;
  }

  .mobile-nav-backdrop.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .mobile-hamburger {
    display: block;
    padding: 6px;
    flex-shrink: 0;
    margin: 0;
  }

  .hamburger-icon {
    width: 24px;
    height: 24px;
  }

  /* Logo container - smaller on mobile */
  .logo-container {
    flex-shrink: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
  }

  .header-logo {
    width: 180px;
    height: 60px;
    max-width: 100%;
    object-fit: contain;
  }

  /* Icons container - smaller icons on mobile */
  .left-icons-container {
    flex-shrink: 0;
    margin: 0;
    gap: 4px;
  }

  /* Navigation - hidden by default on mobile, shown when active */
  .main-nav {
    display: block;
    width: auto;
    margin-top: 0;
    padding: 1rem 0;
  }

  .main-nav ul {
    padding: 0.5rem 0;
  }

  .main-nav ul {
    flex-direction: column !important;
    align-items: stretch;
    gap: 0;
    padding: 0;
    margin: 0;
    height: 100%;
  }

  .main-nav .nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    padding-right: 0.5rem;
  }

  /* Icon sizing for mobile - smaller */
  .icon-button {
    padding: 4px;
  }

  .icon-button img {
    width: 2rem !important;
    height: 2rem !important;
    flex-shrink: 0;
  }

  .search-icon-svg {
    width: 1.5rem;
    height: 1.5rem;
  }

  /* Mobile Profile Icon - smaller */
  .profile-icon-svg {
    width: 1.125rem;
    height: 1.125rem;
  }

  .search-icon-button .search-icon::before {
    font-size: 16px;
  }

  /* Mobile Cart Icon - smaller */
  .cart-icon-svg {
    width: 1.25rem;
    height: 1.25rem;
  }

  .nav-link {
    padding: 0.25rem 0.5rem;
    width: 100%;
    font-size: 1rem;
  }
}

/* Desktop Styles (above 767px) */
@media (min-width: 768px) {
  /* Hide hamburger on desktop */
  .mobile-hamburger {
    display: none;
  }

  /* Hide mobile close button on desktop */
  .mobile-nav-close {
    display: none !important;
  }

  /* Show navigation menu on desktop */
  .main-nav {
    display: block !important;
  }

  .main-nav ul {
    display: flex;
    flex-direction: row;
    justify-content: center;
    height: 100%;
  }

  .dropdown-menu {
    display: grid !important;
    grid-template-columns: repeat(
      auto-fit,
      minmax(min(250px, 100%), 1fr)
    ) !important;
  }

  /* On desktop, arrow button is visual only - hover handles interaction */
  .dropdown-arrow-toggle {
    pointer-events: none;
    cursor: default;
  }

  /* Ensure dropdowns work on desktop hover */
  .nav-item-has-dropdown:hover > .dropdown-menu:not(.nested-dropdown) {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  /* Desktop logo sizing */
  .header-logo {
    height: 100px;
  }
}

.child-nav-item {
  border-bottom: none;
}

.child-nav-item .nav-link {
  font-weight: 400;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  font-size: 1.625rem;
  position: relative;
}

.dropdown-arrow-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  vertical-align: middle !important;
  border: none !important;
  color: #603813 !important;
}

.dropdown-arrow {
  font-size: 10px;
  transition: transform 0.2s ease;
  display: inline-block;
}

/* Dropdown Menu Wrapper - Container for the dropdown */
.dropdown-menu-wrapper {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 85vw;
  max-width: 900px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 1000;
  pointer-events: none;
  overflow: visible;
  box-sizing: border-box;
  margin-top: -15px;
  padding-top: 15px;
}

/* Desktop: Extend wrapper to full viewport width to bridge horizontal gaps */
@media (min-width: 1200px) {
  .dropdown-menu-wrapper {
    left: 50%;
    transform: translateX(-40vw);
  }
}
@media (min-width: 768px) {
  .dropdown-menu-wrapper {
    left: 50%;
    transform: translateX(-45vw);
    width: 100vw;
    max-width: 100vw;
    display: flex;
    justify-content: center;
  }
}

.dropdown-menu {
  background: var(--color-background);
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 0.5rem 0;
  margin: 0;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  width: 85vw;
  max-width: 900px;
  overflow: visible;
  box-sizing: border-box;
}

/* Show dropdown when hovering over nav-item */
.nav-item-has-dropdown:hover > .dropdown-menu-wrapper:not(.nested-dropdown) {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Keep dropdown visible when hovering over the wrapper itself */
.dropdown-menu-wrapper:hover:not(.nested-dropdown) {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Keep dropdown visible when hovering over dropdown menu */
.dropdown-menu-wrapper:not(.nested-dropdown) .dropdown-menu:hover {
  opacity: 1;
  visibility: visible;
}

.nav-item-has-dropdown:hover .dropdown-arrow {
  transform: rotate(90deg);
}

.dropdown-menu li {
  padding: 0;
  margin: 0;
  list-style: none;
  flex-shrink: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.dropdown-menu a {
  display: block;
  padding: 0.25rem 2rem;
  color: #603813;
  text-decoration: none;
  transition: background-color 0.2s ease;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
  box-sizing: border-box;
}

/* Mobile dropdown styles - Accordion functionality */
@media (max-width: 767px) {
  .dropdown-menu-wrapper {
    position: static;
    left: auto;
    transform: none;
    width: 100%;
    max-width: 100%;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .dropdown-menu {
    position: static;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    padding: 0;
    margin: 0;
    transform: none;
    border: none;
    box-shadow: none;
    background: transparent;
    transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.3s ease;
  }

  .dropdown-menu.active {
    max-height: 1000px;
    opacity: 1;
    visibility: visible;
    padding: 0.25rem 0;
  }

  .nav-item-has-dropdown {
    width: 100%;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
  }

  .nav-item-has-dropdown .nav-link {
    padding: 0.25rem 0.5rem;
    width: auto;
    flex: 0 0 auto;
  }

  .nav-link {
    padding: 0.25rem 0.5rem;
    width: auto;
    text-align: center;
  }

  .dropdown-arrow-toggle {
    padding: 0.5rem 0.5rem;
    margin: 0;
    pointer-events: auto;
    cursor: pointer;
    flex-shrink: 0;
  }

  .dropdown-arrow {
    transition: transform 0.3s ease;
  }

  .nav-item-has-dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
  }
}

/******************** End of Header Styles ********************/
