.bottom-tabs {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(65px + env(safe-area-inset-bottom, 0px));
  display: none;
  align-items: flex-start;
  justify-content: space-around;
  background: var(--color-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--color-border-light);
  box-shadow: 0 -5px 20px var(--color-shadow);
  z-index: 50;
  padding: 8px 10px env(safe-area-inset-bottom, 0px);
}

@media (max-width: 767px) {
  .bottom-tabs {
    display: flex;
  }
  
  body {
    padding-bottom: calc(65px + env(safe-area-inset-bottom, 0px));
  }
}

.bottom-tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  flex: 1;
  height: 50px;
  gap: 4px;
  position: relative;
}

.bottom-tab-item.is-active {
  font-weight: 700;
}

.bottom-tab-icon {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.2s ease;
}

.bottom-tab-item:active .bottom-tab-icon {
  transform: scale(0.9);
}

.bottom-tab-icon svg {
  width: 24px;
  height: 24px;
  stroke-width: 1.8;
  transition: all 0.2s ease;
}

.bottom-tab-label {
  font-size: 10px;
  letter-spacing: 0.01em;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.bottom-tab-item.is-active .bottom-tab-label {
  opacity: 1;
  font-weight: 800;
  color: var(--color-text-muted);
}

/* Badge for Cart/Wishlist - Enhanced Clarity */
.bottom-tab-badge {
  position: absolute;
  top: -8px;
  right: -10px;
  background-color: var(--primary-color);
  color: var(--text-color-primary-bg);
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  z-index: 10;
  animation: badgePop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.bottom-tab-badge[style*="display: none"] {
  display: none !important;
}

/* Ensure digits are perfectly centered */
.bottom-tab-badge span,
.bottom-tab-badge {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] .bottom-tab-badge {
  border-color: var(--color-bg);
}

@keyframes badgePop {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

/* RTL Support */
[dir="rtl"] .bottom-tab-label {
  font-family: var(--font-primary);
  font-size: 11px;
}

/* Hide redundant header items on mobile */
@media (max-width: 767px) {
  #wishlist-toggle,
  #wishlist-guest-toggle,
  #login-toggle,
  #user-badge,
  #cart-toggle,
  .menu-toggle {
    display: none !important;
  }
  
  #region-toggle,
  #search-toggle {
    display: flex !important;
  }

  #region-toggle {
    order: 1;
    margin: 0;
  }

  .header-logo {
    order: 2;
    flex-grow: 1;
    display: flex;
    justify-content: center;
    margin: 0;
  }

  #search-toggle {
    order: 3;
    margin: 0;
  }
  
  .header-inner {
    justify-content: space-between !important;
    display: flex !important;
    gap: 10px;
  }
}

/* RTL Header Layout Override for Mobile */
@media (max-width: 767px) {
  [dir="rtl"] #region-toggle {
    order: 3 !important;
  }
  [dir="rtl"] #search-toggle {
    order: 1 !important;
  }
  [dir="rtl"] .header-logo {
    order: 2 !important;
  }
}

.bottom-tabs .bottom-tab-icon .header-custom-icon-svg {
  display: flex;
  align-items: center;
  justify-content: center;
}

.bottom-tab-icon .user-avatar {
  width: 24px;
  height: 24px;
  font-size: 10px;
  border-width: 1px;
}

.bottom-tab-item.is-active .user-avatar {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: var(--text-color-primary-bg);
}

/* Account Dropdown Mobile Adaption */
@media (max-width: 767px) {
  .user-account-wrapper.is-active .user-dropdown {
    position: fixed;
    top: auto;
    bottom: calc(65px + env(safe-area-inset-bottom, 0px) + 10px);
    right: 15px;
    left: 15px;
    width: calc(100% - 30px);
    max-width: none;
    transform: translateY(0) scale(1);
    border-radius: 12px;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
    z-index: 100;
  }

  .user-dropdown::before {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 12px;
    height: 12px;
    background: var(--color-bg);
    border-right: 1px solid var(--color-border-light);
    border-bottom: 1px solid var(--color-border-light);
    display: none; /* Keep it clean without arrow on mobile */
  }
}
