/* Shared UI fixes for navigation, overlays, popups and embedded receipts. */
:root {
  --wafrica-header-height: 4rem;
  --wafrica-announcement-height: 2.25rem;
  --wafrica-mobile-menu-z-index: 10030;
  --wafrica-ui-gutter: clamp(0.75rem, 2.5vw, 1.5rem);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
  -ms-touch-action: manipulation;
}

body {
  overflow-x: hidden;
  touch-action: manipulation;
  -ms-touch-action: manipulation;
}

input,
select,
textarea,
button,
a,
.hamburger-btn,
.header-cart-icon,
.header-profile-btn {
  touch-action: manipulation;
  -ms-touch-action: manipulation;
}

@media (max-width: 768px) {
  input,
  select,
  textarea {
    font-size: 16px !important;
  }
}

img,
svg,
video,
canvas,
iframe {
  max-width: 100%;
}

iframe {
  border: 0;
  display: block;
}

header .max-w-7xl {
  width: 100% !important;
  max-width: 1280px !important;
}

header .h-16 {
  min-width: 0 !important;
  gap: clamp(0.35rem, 1vw, 0.9rem) !important;
}

header .h-16 > a:first-child,
#homeLink {
  min-width: 0 !important;
  flex: 0 1 auto !important;
}

header .h-16 > a:first-child span,
#homeLink span {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  letter-spacing: 0 !important;
}

header .h-16 > .flex.items-center:last-child {
  flex: 0 0 auto !important;
  min-width: 0 !important;
  gap: clamp(0.35rem, 0.8vw, 0.75rem) !important;
}

header .h-16 > .flex.items-center {
  min-width: 0 !important;
  gap: clamp(0.35rem, 0.8vw, 0.75rem) !important;
}

.desktop-nav {
  min-width: 0 !important;
  flex: 1 1 auto !important;
  justify-content: center !important;
}

.desktop-nav-list {
  min-width: 0 !important;
  flex-wrap: nowrap !important;
  gap: clamp(0.1rem, 0.45vw, 0.45rem) !important;
}

.desktop-nav-link {
  min-height: 40px !important;
  padding: 0.5rem clamp(0.45rem, 0.7vw, 0.85rem) !important;
  font-size: clamp(0.78rem, 0.8vw, 0.9rem) !important;
  white-space: nowrap !important;
  letter-spacing: 0 !important;
}

.desktop-nav-link i {
  flex-shrink: 0 !important;
}

.desktop-search-wrap {
  min-width: 0 !important;
  flex: 0 1 360px !important;
  max-width: min(360px, 30vw) !important;
}

.desktop-search-box {
  min-width: 0 !important;
}

.desktop-search-input {
  min-width: 0 !important;
}

.currency-btn-wrapper {
  position: relative !important;
  flex: 0 0 auto !important;
  overflow: visible !important;
}

.desktop-img-search-btn,
.desktop-filter-btn,
.header-cart-icon,
.header-orders-icon,
.header-notifications-icon,
.hamburger-btn,
.header-account-icon,
.header-profile-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 auto !important;
  line-height: 1 !important;
  text-decoration: none !important;
}

.desktop-img-search-btn,
.desktop-filter-btn {
  width: 36px !important;
  min-width: 36px !important;
  height: 36px !important;
  padding: 0 !important;
  overflow: visible !important;
  position: relative !important;
}

.currency-btn-wrapper .currency-badge {
  position: absolute !important;
  top: -0.3rem !important;
  right: -0.25rem !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 1.25rem !important;
  max-width: 2.15rem !important;
  height: 0.95rem !important;
  padding: 0 0.22rem !important;
  border-radius: 9999px !important;
  font-size: 0.5rem !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: clip !important;
  pointer-events: none !important;
}

.currency-btn-wrapper .currency-badge.hidden {
  display: none !important;
}

@media (min-width: 1024px) and (max-width: 1180px) {
  .currency-btn-wrapper .currency-badge {
    top: -0.2rem !important;
    right: -0.15rem !important;
    min-width: 1.1rem !important;
    max-width: 1.9rem !important;
    height: 0.85rem !important;
    font-size: 0.46rem !important;
    padding: 0 0.18rem !important;
  }
}

.header-cart-icon,
.header-orders-icon,
.header-notifications-icon,
.hamburger-btn {
  width: 42px !important;
  min-width: 42px !important;
  height: 42px !important;
  padding: 0 !important;
  border-radius: 12px !important;
}

.header-cart-icon .header-icon-text,
.header-orders-icon .header-icon-text,
.header-notifications-icon .header-icon-text,
.hamburger-btn .header-icon-text {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

#cart-count-badge,
.cart-count-badge {
  pointer-events: none !important;
}

.mobile-menu {
  width: min(86vw, 320px) !important;
  max-width: 320px !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  z-index: var(--wafrica-mobile-menu-z-index) !important;
  align-items: stretch !important;
  padding-top: calc(env(safe-area-inset-top, 0px) + var(--wafrica-header-height, 4rem) + 0.75rem) !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
}

body.has-announcement .mobile-menu,
body.has-announcement-bar .mobile-menu {
  padding-top: calc(env(safe-area-inset-top, 0px) + var(--wafrica-announcement-height, 2.25rem) + var(--wafrica-header-height, 4rem) + 0.75rem) !important;
}

.mobile-menu ul {
  margin: 0 !important;
}

.mobile-menu a {
  min-height: 48px !important;
  line-height: 1.35 !important;
}

.mobile-menu .dropdown-menu a {
  min-height: 44px !important;
}

.mobile-menu-version {
  margin-top: auto !important;
}

@media (min-width: 1024px) {
  .desktop-nav {
    display: flex !important;
  }

  .desktop-search-wrap {
    display: block !important;
  }

  .hamburger-btn {
    display: none !important;
  }
}

@media (max-width: 1180px) and (min-width: 1024px) {
  .desktop-search-wrap {
    display: none !important;
  }

  header .h-16 > a:first-child span,
  #homeLink span {
    max-width: 13rem !important;
  }
}

@media (max-width: 1023px) {
  header .h-16 > a:first-child,
  #homeLink {
    flex: 1 1 auto !important;
  }

  .desktop-nav,
  .desktop-search-wrap {
    display: none !important;
  }

  .hamburger-btn {
    display: inline-flex !important;
  }
}

@media (max-width: 480px) {
  header .max-w-7xl {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }

  header .h-16 > a:first-child span,
  #homeLink span {
    max-width: min(42vw, 9.5rem) !important;
  }

  .desktop-img-search-btn,
  .desktop-filter-btn,
  .header-cart-icon,
  .header-orders-icon,
  .header-notifications-icon,
  .hamburger-btn,
  .header-account-icon,
  .header-profile-btn {
    width: 38px !important;
    min-width: 38px !important;
    height: 38px !important;
    border-radius: 10px !important;
  }
}

@media (max-width: 360px) {
  header .h-16 > a:first-child span,
  #homeLink span {
    display: none !important;
  }
}

#newsletterPopup,
#countryPopup,
#categoriesPopup,
#imageSearchPopup,
#order-channel-modal,
.modal,
.modal-overlay,
.ticket-modal,
.transfer-modal,
.transaction-receipt-modal,
.avatar-cropper-modal,
.founder-modal,
#media-lightbox,
#img-zoom-overlay,
.wafrica-avatar-lightbox {
  align-items: center !important;
  justify-content: center !important;
  padding: var(--wafrica-ui-gutter) !important;
}

#newsletterPopup .popup-container,
#countryPopup .popup-container,
#categoriesPopup .popup-container,
#imageSearchPopup .isp-container,
#order-channel-modal .ocm-card,
.ticket-modal-content,
.transfer-dialog,
.transaction-receipt-dialog,
.avatar-cropper-dialog,
.founder-modal-content,
.modal-box {
  width: min(100%, 560px) !important;
  max-height: calc(100dvh - (var(--wafrica-ui-gutter) * 2)) !important;
  margin: auto !important;
  overflow: auto !important;
  overscroll-behavior: contain !important;
}

#categoriesPopup .popup-container {
  width: min(100%, 720px) !important;
  overflow: hidden !important;
}

#imageSearchPopup .isp-container {
  width: min(100%, 640px) !important;
}

#imageModal .modal-content {
  max-width: calc(100vw - 2rem) !important;
  max-height: calc(100dvh - 4rem) !important;
  object-fit: contain !important;
}

#order-channel-modal {
  padding-top: var(--wafrica-ui-gutter) !important;
  overflow-y: auto !important;
}

#order-channel-modal .ocm-card {
  max-width: 540px !important;
  max-height: calc(100dvh - (var(--wafrica-ui-gutter) * 2)) !important;
  border-radius: 16px !important;
}

.ocm-product-name,
.ticket-modal-title,
.ticket-modal-event-name {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

.ocm-promo-input,
.ocm-link-input,
.currency-input,
.currency-select {
  min-width: 0 !important;
}

.transaction-receipt-modal {
  z-index: 10600 !important;
}

.transaction-receipt-dialog {
  width: min(100%, 560px) !important;
  height: min(760px, calc(100dvh - (var(--wafrica-ui-gutter) * 2))) !important;
  overflow: hidden !important;
}

.transaction-receipt-frame {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  border: 0 !important;
}

.map-container {
  width: min(100%, 1000px) !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

.map-container iframe {
  width: 100% !important;
  height: clamp(260px, 40vw, 420px) !important;
}

.currency-converter-popup {
  z-index: 10080 !important;
  max-width: calc(100vw - 1rem) !important;
}

.currency-popup-header,
.ocm-header,
.ticket-modal-header {
  min-width: 0 !important;
}

.currency-popup-title,
.ocm-title,
.ocm-subtitle {
  min-width: 0 !important;
  overflow-wrap: anywhere !important;
}

@media (max-width: 1023px) {
  .currency-converter-popup:not(.hidden) {
    position: fixed !important;
    top: calc(var(--wafrica-header-height) + 0.75rem) !important;
    left: 50% !important;
    right: auto !important;
    width: min(92vw, 360px) !important;
    max-height: calc(100dvh - var(--wafrica-header-height) - 1.5rem) !important;
    transform: translateX(-50%) !important;
    overflow: auto !important;
  }
}

@media (max-width: 640px) {
  #newsletterPopup,
  #countryPopup,
  #categoriesPopup,
  #imageSearchPopup,
  #order-channel-modal,
  .modal,
  .modal-overlay,
  .ticket-modal,
  .transfer-modal,
  .transaction-receipt-modal,
  .avatar-cropper-modal,
  .founder-modal,
  #media-lightbox,
  #img-zoom-overlay,
  .wafrica-avatar-lightbox {
    padding: 0.5rem !important;
  }

  #newsletterPopup .popup-container,
  #countryPopup .popup-container,
  #categoriesPopup .popup-container,
  #imageSearchPopup .isp-container,
  #order-channel-modal .ocm-card,
  .ticket-modal-content,
  .transfer-dialog,
  .transaction-receipt-dialog,
  .avatar-cropper-dialog,
  .founder-modal-content,
  .modal-box {
    max-height: calc(100dvh - 1rem) !important;
    border-radius: 14px !important;
  }

  .ocm-header,
  .ocm-body,
  .ocm-footer,
  .ticket-modal-body,
  .ticket-modal-footer {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  .ocm-promo-input-wrap,
  .ocm-payment-link-row,
  .ocm-flow-actions,
  .ticket-modal-actions,
  .ticket-modal-total,
  .isp-preview-actions,
  .isp-result-actions {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .ocm-apply-promo-btn,
  .ocm-copy-link-btn,
  .ocm-primary-btn,
  .ocm-secondary-btn,
  .ticket-modal-btn,
  .isp-btn-primary,
  .isp-btn-secondary {
    width: 100% !important;
    min-height: 44px !important;
  }

  .ocm-channels,
  .isp-options-grid {
    grid-template-columns: 1fr !important;
  }

  .transaction-receipt-dialog {
    width: calc(100vw - 1rem) !important;
    height: calc(100dvh - 1rem) !important;
  }
}
