/* Installed PWA (display-mode: standalone) — hide non-dashboard chrome */
html.pwa-shell .pwa-hide {
  display: none !important;
}

html.pwa-shell .pwa-full-menu {
  display: none !important;
}

/* Default: hide the PWA-only dashboard duplicate in normal browser */
.pwa-only-menu {
  display: none !important;
}

html.pwa-shell .pwa-only-menu {
  display: list-item !important;
}

html.pwa-shell .page-content {
  padding-top: 12px;
}

/* —— Native app shell —— */
html.pwa-shell body.pwa-home,
html.pwa-shell body.pwa-inner {
  --pwa-primary: #f58220;
  --pwa-muted: #9aa3b2;
  --pwa-text: #2a3441;
  --pwa-nav-h: 72px;
  --pwa-topbar-h: 56px;
}

/* Hide left sidebar + desktop hamburger on mobile shell */
html.pwa-shell .vertical-menu,
html.pwa-shell #vertical-menu-btn {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Overlay not used for mobile Issue/Cancel (Bootstrap modals); keep hidden on PWA */
html.pwa-shell .rightbar-overlay {
  display: none !important;
}

html.pwa-shell .main-content {
  margin-left: 0 !important;
  margin-top: calc(var(--pwa-topbar-h) + env(safe-area-inset-top, 0px)) !important;
  transition: margin-top 0.15s ease;
}

html.pwa-shell body.pwa-search-open .main-content {
  margin-top: calc(var(--pwa-topbar-h) + env(safe-area-inset-top, 0px) + 62px) !important;
}

html.pwa-shell #page-topbar {
  left: 0 !important;
  right: 0 !important;
  background: #fff !important;
  box-shadow: none !important;
  border-bottom: 1px solid #e8ecf4;
}

/* —— Mobile app bar —— */
html.pwa-shell #page-topbar.pwa-appbar {
  height: auto !important;
  min-height: var(--pwa-topbar-h);
  padding-top: env(safe-area-inset-top, 0px);
}

html.pwa-shell .pwa-topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--pwa-topbar-h);
  padding: 0 10px 0 12px;
  gap: 8px;
}

html.pwa-shell .pwa-topbar-left {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1;
}

html.pwa-shell .pwa-topbar-right {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

/* Full AIRTICKET logo (same asset as desktop logo-lg) */
html.pwa-shell .pwa-brand-logo {
  display: inline-flex;
  align-items: center;
  max-width: 160px;
  line-height: 0;
}

html.pwa-shell .pwa-brand-logo img {
  display: block;
  height: 32px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

html.pwa-shell .pwa-search-toggle,
html.pwa-shell .pwa-back-btn {
  color: var(--pwa-text) !important;
  width: 40px;
  height: 40px;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  box-shadow: none !important;
}

/* Slightly larger tap target around the back arrow (not the full app bar) */
html.pwa-shell .pwa-back-btn {
  width: 52px;
  height: 48px;
  margin-left: -6px;
  justify-content: flex-start;
  padding-left: 6px !important;
}

html.pwa-shell .pwa-search-toggle i,
html.pwa-shell .pwa-back-btn i {
  font-size: 22px;
  line-height: 1;
}

html.pwa-shell .pwa-search-toggle.is-open {
  color: var(--pwa-primary) !important;
}

/* Toggle search panel under header */
html.pwa-shell .pwa-search-panel {
  border-top: 1px solid #e8ecf4;
  padding: 10px 12px 12px;
  background: #fff;
}

html.pwa-shell .pwa-search-panel[hidden] {
  display: none !important;
}

html.pwa-shell .pwa-search-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

html.pwa-shell .pwa-search-field {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #d7dde8;
  border-radius: 8px;
  background: #fff;
}

html.pwa-shell .pwa-search-field i {
  color: var(--pwa-muted);
  font-size: 18px;
  flex-shrink: 0;
}

html.pwa-shell .pwa-search-field .form-control {
  border: 0;
  background: transparent;
  box-shadow: none;
  height: 38px;
  padding: 0;
  font-size: 14px;
  color: var(--pwa-text);
}

html.pwa-shell .pwa-search-field .form-control:focus {
  box-shadow: none;
  outline: none;
}

html.pwa-shell .pwa-search-field .form-control::placeholder {
  color: #b0b7c3;
}

html.pwa-shell .pwa-search-btn {
  flex-shrink: 0;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--pwa-primary);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}

html.pwa-shell .pwa-search-btn:active {
  filter: brightness(0.95);
}

html.pwa-shell .pwa-pnr-error {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #dc2626;
  min-height: 0;
}

html.pwa-shell .pwa-pnr-error:empty {
  display: none;
}

/* Profile icon in mobile app bar (no photo) */
html.pwa-shell .pwa-appbar .pwa-profile-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--pwa-text, #1e293b);
}

html.pwa-shell .pwa-appbar .pwa-profile-btn i {
  font-size: 28px;
  line-height: 1;
}

html.pwa-shell .pwa-appbar .header-profile-user {
  display: none;
}

/* Detail page: app-bar back replaces in-content back link */
html.pwa-shell body.pwa-inner .mb-detail-shell .mb-back {
  display: none !important;
}

html.pwa-shell body.pwa-inner .mb-detail-shell .detail-body {
  margin-top: 25px;
}

/* Bottom tab bar — home only */
.pwa-bottom-nav {
  display: none;
}

html.pwa-shell body.pwa-home .pwa-bottom-nav {
  display: flex;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1005;
  box-sizing: border-box;
  /* Content height stays fixed; safe-area is padding only (avoids iPhone squeeze) */
  min-height: calc(var(--pwa-nav-h) + env(safe-area-inset-bottom, 0px));
  height: auto;
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom, 0px));
  background: #fff;
  border-top: 1px solid #e8ecf4;
  box-shadow: 0 -2px 12px rgba(26, 35, 50, 0.06);
  justify-content: space-around;
  align-items: flex-start;
  overflow: visible;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html.pwa-shell body.pwa-home .pwa-tab {
  flex: 1;
  max-width: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  border: 0;
  background: transparent;
  color: var(--pwa-muted);
  min-height: 56px;
  padding: 6px 2px 4px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
  overflow: visible;
}

html.pwa-shell body.pwa-home .pwa-tab i {
  font-size: 26px;
  line-height: 1;
  display: block;
  -webkit-text-size-adjust: 100%;
}

/* Label text only — do not clip icon wrap / badge */
html.pwa-shell body.pwa-home .pwa-tab > span:not(.pwa-tab-icon-wrap) {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html.pwa-shell body.pwa-home .pwa-tab.is-active {
  color: var(--pwa-primary);
}

html.pwa-shell body.pwa-home .pwa-tab-icon-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  overflow: visible;
}

html.pwa-shell body.pwa-home .pwa-tab-badge {
  position: absolute;
  top: -8px;
  right: -12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff !important;
  font-size: 10px;
  font-weight: 700;
  font-style: normal;
  font-family: inherit;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  overflow: visible;
  box-shadow: 0 0 0 2px #fff;
  pointer-events: none;
}

html.pwa-shell body.pwa-home .main-content,
html.pwa-shell body.pwa-home .page-content {
  padding-bottom:20px;
}

/* Tab panels */
html.pwa-shell .mb-tab-panel[hidden] {
  display: none !important;
}

html.pwa-shell .mb-tab-card {
  border: 0;
  box-shadow: none;
  background: transparent;
}

html.pwa-shell .mb-tab-card > .card-body {
  padding: 0;
}

/* Mobile Issue/Cancel Bootstrap modals — top aligned like Remarks */
html.pwa-shell #mbIssueModal .modal-dialog,
html.pwa-shell #mbCancelModal .modal-dialog {
  margin: 0.75rem auto 1rem;
  max-width: 440px;
}

html.pwa-shell #mbIssueModal.modal,
html.pwa-shell #mbCancelModal.modal {
  padding-top: env(safe-area-inset-top, 0px);
}

html.pwa-shell #mbIssueModal .mb-issue-rules,
html.pwa-shell #mbCancelModal .mb-cancel-rules {
  max-height: 180px;
  overflow-y: auto;
  margin-bottom: 12px;
}

html.pwa-shell #mbIssueModal .modal-title,
html.pwa-shell #mbCancelModal .modal-title {
  font-size: 15px;
  font-weight: 600;
  padding-right: 12px;
}

/* —— Install / iOS tip banner —— */
#pwa-install-host {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 11000;
  pointer-events: none;
  padding: 0 12px calc(12px + env(safe-area-inset-bottom, 0px));
}

html.pwa-shell body.pwa-home #pwa-install-host {
  bottom: calc(64px + env(safe-area-inset-bottom, 0px));
}

.pwa-install-banner {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff2e7;
  color: #0b3d5c;
  border: 1px solid #f0dcc8;
  border-radius: 12px;
  padding: 12px 12px 12px 14px;
  box-shadow: 0 8px 28px rgba(26, 35, 50, 0.12);
}

.pwa-install-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pwa-install-text strong {
  font-size: 14px;
  font-weight: 600;
  color: #0b3d5c;
}

.pwa-install-text span {
  font-size: 12px;
  opacity: 0.9;
  line-height: 1.35;
  color: #334155;
}

.pwa-install-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.pwa-install-btn {
  border: 0;
  border-radius: 8px;
  background: #f58220;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
}

.pwa-install-dismiss {
  border: 0;
  background: transparent;
  color: #64748b;
  opacity: 1;
  font-size: 22px;
  line-height: 1;
  width: 32px;
  height: 32px;
  padding: 0;
}
