/* ==========================================================================
   ACCTBANK GLOBAL RESPONSIVE SYSTEM (MOBILE < 768px | IPAD 768-1023px | LAPTOP >= 1024px)
   ========================================================================== */

html, body {
  max-width: 100%;
  overflow-x: hidden;
}

/* Prevent long credentials, hashes, and order IDs from breaking container width */
.delivery-card,
.stock-item,
.order-detail-header,
.orders-main,
.detail-card,
#ab-chat-drawer,
#ab-parsed-vault-body {
  max-width: 100%;
  box-sizing: border-box;
}

.stock-item-value,
.delivery-item-content,
.ab-cred-break {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Filter tabs smooth horizontal scroll on mobile & iPad */
.orders-filter-tabs {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  gap: 8px;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.orders-filter-tabs::-webkit-scrollbar {
  display: none;
}
.orders-filter-tabs .filter-tab {
  flex-shrink: 0;
  white-space: nowrap;
}

/* ==========================================================================
   MOBILE VIEWPORT (< 768px)
   ========================================================================== */
@media (max-width: 767.98px) {
  .inner-section.profile-part {
    padding-top: 16px !important;
    padding-bottom: 96px !important;
  }

  /* Top-right Notification Bell positioned cleanly beside mobile search button */
  #ab-global-notif-floating {
    top: 11px !important;
    right: 54px !important;
    z-index: 10055 !important;
  }
  #ab-global-notif-floating button {
    height: 36px !important;
    padding: 0 10px !important;
    font-size: 11.5px !important;
  }

  /* Notification Dropdown full-width safe fit on mobile */
  #ab-notif-dropdown {
    position: fixed !important;
    top: 56px !important;
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    max-width: none !important;
  }

  /* Live Reply Toast positioned below top header */
  #ab-live-reply-toast {
    top: 58px !important;
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    max-width: none !important;
  }

  /* Support Drawer: full-width responsive bottom sheet above bottom tab bar */
  #ab-chat-drawer {
    position: fixed !important;
    left: 8px !important;
    right: 8px !important;
    bottom: calc(74px + env(safe-area-inset-bottom, 0px)) !important;
    top: auto !important;
    width: auto !important;
    max-width: none !important;
    height: 74dvh !important;
    max-height: 74dvh !important;
    border-radius: 16px !important;
    z-index: 10065 !important;
  }

  /* Keep Support Drawer header compact on single row */
  #ab-chat-drawer > div:first-child {
    padding: 11px 13px !important;
    gap: 8px !important;
  }
  #ab-chat-drawer > div:first-child button {
    white-space: nowrap !important;
    padding: 6px 10px !important;
    font-size: 11px !important;
  }

  /* Floating Support Button & Batch Bars above bottom navigation bar */
  #ab-support-launcher,
  .ab-support-float-btn,
  #abBatchReportBar,
  #abItemBatchBar {
    bottom: calc(74px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Order Detail Header & Action Buttons */
  .order-detail-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
    padding: 14px !important;
  }
  .order-detail-header .order-actions,
  .stock-actions-bar {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }
  .order-detail-header .order-actions > *:first-child {
    grid-column: 1 / -1 !important;
  }

  /* Green Delivered Account Cards (#1, #2, #3...): prevent header squishing */
  .ab-item-card-header {
    flex-wrap: wrap !important;
    gap: 6px !important;
    row-gap: 8px !important;
  }
  .ab-item-ctrl-wrap {
    margin-left: 0 !important;
    margin-right: 0 !important;
    order: 3 !important;
    width: 100% !important;
    justify-content: space-between !important;
    padding-top: 6px !important;
    border-top: 1px dashed rgba(6, 78, 84, 0.18) !important;
  }
  .ab-item-ctrl-wrap label,
  .ab-item-ctrl-wrap button {
    flex: 1 1 auto !important;
    justify-content: center !important;
    text-align: center !important;
    min-height: 32px !important;
  }

  /* Smart Credential Vault Header Buttons */
  #ab-vault-actions-bar {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 7px !important;
  }
  #ab-vault-actions-bar button:last-child {
    grid-column: 1 / -1 !important;
  }
}

/* ==========================================================================
   IPAD / TABLET VIEWPORT (768px - 1023.98px)
   ========================================================================== */
@media (min-width: 768px) and (max-width: 1023.98px) {
  .inner-section.profile-part {
    padding-top: 22px !important;
    padding-bottom: 92px !important;
  }

  #ab-global-notif-floating {
    top: 13px !important;
    right: 64px !important;
  }

  #ab-chat-drawer {
    width: 420px !important;
    right: 18px !important;
    left: auto !important;
    bottom: 84px !important;
    max-height: 76vh !important;
  }

  #abBatchReportBar,
  #abItemBatchBar {
    bottom: 82px !important;
  }

  .orders-table-wrapper {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
}

/* ==========================================================================
   LAPTOP / DESKTOP VIEWPORT (>= 1024px)
   ========================================================================== */
@media (min-width: 1024px) {
  #ab-global-notif-floating {
    top: 14px !important;
    right: 22px !important;
  }

  #ab-chat-drawer {
    width: 410px !important;
    right: 22px !important;
    bottom: 22px !important;
    max-height: 620px !important;
  }
}
