/**
 * Amazon Style Theme for OpenCart 3.0.5.0
 * Mobile Navigation - Bottom Nav Bar (App-like)
 *
 * @package    theme_amazon
 * @author     ChatGPT.com
 * @version    1.0.0
 */

/* ========================================
   BOTTOM NAVIGATION BAR
   ======================================== */

.amazon-mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--amazon-mobile-nav-height);
  background: var(--amazon-mobile-nav-bg);
  border-top: 1px solid var(--amazon-border-color);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  z-index: var(--amazon-z-fixed);
}

@media (max-width: 767.98px) {
  .amazon-mobile-nav {
    display: flex;
  }

  /* Add padding to body to prevent content from being hidden */
  body {
    padding-bottom: var(--amazon-mobile-nav-height);
  }
}

.amazon-mobile-nav-inner {
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  width: 100%;
  height: 100%;
  max-width: 500px;
  margin: 0 auto;
}

/* ========================================
   NAV ITEM
   ======================================== */

.amazon-mobile-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: var(--amazon-space-1) var(--amazon-space-2);
  color: var(--amazon-mobile-nav-icon);
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color var(--amazon-transition);
  position: relative;
}

.amazon-mobile-nav-item:hover,
.amazon-mobile-nav-item:focus {
  color: var(--amazon-mobile-nav-active);
  text-decoration: none;
}

.amazon-mobile-nav-item.active {
  color: var(--amazon-mobile-nav-active);
}

/* Active indicator */
.amazon-mobile-nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 3px;
  background: var(--amazon-mobile-nav-active);
  border-radius: 0 0 3px 3px;
}

/* ========================================
   NAV ICON
   ======================================== */

.amazon-mobile-nav-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.amazon-mobile-nav-icon svg,
.amazon-mobile-nav-icon img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

/* Cart badge */
.amazon-mobile-nav-badge {
  position: absolute;
  top: -6px;
  right: -8px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: var(--amazon-font-bold);
  line-height: 18px;
  text-align: center;
  color: var(--amazon-text-light);
  background: var(--amazon-accent);
  border-radius: var(--amazon-radius-full);
}

/* v2.4.0: Hidden state for empty cart badge */
.amazon-mobile-nav-badge.hidden {
  display: none;
}

/* ========================================
   NAV LABEL
   ======================================== */

.amazon-mobile-nav-label {
  font-size: 10px;
  font-weight: var(--amazon-font-medium);
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

/* ========================================
   MOBILE SEARCH MODAL
   ======================================== */

.amazon-mobile-search-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--amazon-bg-light);
  z-index: var(--amazon-z-modal);
  transform: translateY(-100%);
  transition: transform var(--amazon-transition-slow), visibility 0s linear 0.3s;
  display: flex;
  flex-direction: column;
  visibility: hidden;
}

.amazon-mobile-search-modal.open {
  transform: translateY(0);
  visibility: visible;
  transition: transform var(--amazon-transition-slow), visibility 0s linear 0s;
}

.amazon-mobile-search-modal-header {
  display: flex;
  align-items: center;
  gap: var(--amazon-space-3);
  padding: var(--amazon-space-3);
  background: var(--amazon-bg-header);
}

.amazon-mobile-search-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  color: var(--amazon-text-light);
  cursor: pointer;
}

.amazon-mobile-search-modal-close svg {
  width: 24px;
  height: 24px;
}

.amazon-mobile-search-modal-input {
  flex: 1;
  display: flex;
  height: 40px;
  background: var(--amazon-bg-light);
  border-radius: var(--amazon-radius);
  overflow: hidden;
}

.amazon-mobile-search-modal-input input {
  flex: 1;
  padding: 0 var(--amazon-space-3);
  border: none;
  font-size: var(--amazon-text-md);
}

.amazon-mobile-search-modal-input input:focus {
  outline: none;
}

.amazon-mobile-search-modal-input button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  background: var(--amazon-accent);
  border: none;
  cursor: pointer;
}

.amazon-mobile-search-modal-input button svg {
  width: 20px;
  height: 20px;
}

.amazon-mobile-search-modal-body {
  padding: var(--amazon-space-4);
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.amazon-mobile-search-modal-section {
  margin-bottom: var(--amazon-space-6);
}

.amazon-mobile-search-modal-section-title {
  font-size: var(--amazon-text-sm);
  font-weight: var(--amazon-font-bold);
  color: var(--amazon-text-secondary);
  text-transform: uppercase;
  margin-bottom: var(--amazon-space-3);
}

.amazon-mobile-search-recent-item {
  display: flex;
  align-items: center;
  gap: var(--amazon-space-3);
  padding: var(--amazon-space-3) 0;
  color: var(--amazon-text-primary);
  border-bottom: 1px solid var(--amazon-border-light);
}

.amazon-mobile-search-recent-item svg {
  width: 18px;
  height: 18px;
  color: var(--amazon-text-muted);
}

/* ========================================
   MOBILE DRAWER / SIDE MENU
   ======================================== */

.amazon-mobile-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: calc(100% - 50px);
  max-width: var(--amazon-drawer-width);
  height: 100%;
  background: var(--amazon-bg-light);
  z-index: var(--amazon-z-drawer);
  transform: translateX(-100%);
  transition: transform var(--amazon-transition-slow);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.amazon-mobile-drawer.open {
  transform: translateX(0);
}

.amazon-mobile-drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: calc(var(--amazon-z-drawer) - 1);
  opacity: 0;
  visibility: hidden;
  transition: all var(--amazon-transition-slow);
}

.amazon-mobile-drawer-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* Drawer header */
.amazon-mobile-drawer-header {
  display: flex;
  align-items: center;
  gap: var(--amazon-space-3);
  padding: var(--amazon-space-4);
  background: var(--amazon-primary);
  color: var(--amazon-text-light);
}

.amazon-mobile-drawer-avatar {
  width: 36px;
  height: 36px;
  background: var(--amazon-bg-gray);
  border-radius: var(--amazon-radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

.amazon-mobile-drawer-avatar svg {
  width: 20px;
  height: 20px;
  color: var(--amazon-text-secondary);
}

.amazon-mobile-drawer-greeting {
  font-size: var(--amazon-text-lg);
  font-weight: var(--amazon-font-bold);
}

.amazon-mobile-drawer-close {
  position: absolute;
  top: var(--amazon-space-4);
  right: calc(-1 * 44px);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--amazon-text-light);
  cursor: pointer;
}

/* Drawer sections */
.amazon-mobile-drawer-section {
  border-bottom: 8px solid var(--amazon-bg-gray);
}

.amazon-mobile-drawer-section:last-child {
  border-bottom: none;
}

.amazon-mobile-drawer-section-title {
  padding: var(--amazon-space-4) var(--amazon-space-4) var(--amazon-space-2);
  font-size: var(--amazon-text-md);
  font-weight: var(--amazon-font-bold);
  color: var(--amazon-text-primary);
}

.amazon-mobile-drawer-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.amazon-mobile-drawer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--amazon-space-3) var(--amazon-space-4);
  color: var(--amazon-text-primary);
  text-decoration: none;
  transition: background var(--amazon-transition);
}

.amazon-mobile-drawer-item:hover {
  background: var(--amazon-bg-gray-light);
  color: var(--amazon-text-primary);
  text-decoration: none;
}

.amazon-mobile-drawer-item svg {
  width: 16px;
  height: 16px;
  color: var(--amazon-text-muted);
}

/* Drawer submenu */
.amazon-mobile-drawer-submenu {
  background: var(--amazon-bg-gray-light);
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--amazon-transition-slow);
}

.amazon-mobile-drawer-submenu.open {
  max-height: 2000px;
}

.amazon-mobile-drawer-submenu .amazon-mobile-drawer-item {
  padding-left: var(--amazon-space-8);
  font-size: var(--amazon-text-sm);
}

/* ========================================
   TOUCH INTERACTION STYLES
   ======================================== */

.amazon-mobile-nav-item:active,
.amazon-mobile-drawer-item:active {
  background: var(--amazon-bg-gray);
}

/* Smooth scroll for iOS */
.amazon-mobile-drawer {
  -webkit-overflow-scrolling: touch;
}

/* ========================================
   LANDSCAPE MODE ADJUSTMENTS
   ======================================== */

@media (max-width: 767.98px) and (orientation: landscape) {
  .amazon-mobile-nav {
    height: 48px;
  }

  body {
    padding-bottom: 48px;
  }

  .amazon-mobile-nav-icon svg,
  .amazon-mobile-nav-icon img {
    width: 20px;
    height: 20px;
    object-fit: contain;
  }

  .amazon-mobile-nav-label {
    font-size: 9px;
  }
}

/* ========================================
   SAFE AREA SUPPORT (iPhone X+)
   ======================================== */

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .amazon-mobile-nav {
    height: calc(var(--amazon-mobile-nav-height) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
  }

  @media (max-width: 767.98px) {
    body {
      padding-bottom: calc(var(--amazon-mobile-nav-height) + env(safe-area-inset-bottom));
    }
  }

  .amazon-mobile-drawer {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* ========================================
   ANIMATIONS
   ======================================== */

/* Ripple effect on tap */
.amazon-mobile-nav-item {
  overflow: hidden;
}

.amazon-mobile-nav-item::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.3s, height 0.3s;
}

.amazon-mobile-nav-item:active::after {
  width: 80px;
  height: 80px;
}

/* Badge animation on update */
@keyframes amazon-badge-pop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1);
  }
}

.amazon-mobile-nav-badge.updated {
  animation: amazon-badge-pop 0.3s ease;
}

/* Fix: Hide mobile search modal when not open to prevent compositing/paint issues */
.amazon-mobile-search-modal:not(.open) {
  display: none !important;
}
.amazon-mobile-search-modal.open {
  display: flex !important;
}
