/* Contextual info-help: icon, hover popover, click modal */

.wms-info-help-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  color: #18a0a8;
  vertical-align: middle;
  border: 0;
  background: transparent;
  cursor: help;
  text-decoration: none !important;
}

.wms-info-help-trigger:hover,
.wms-info-help-trigger:focus,
.wms-info-help-trigger:focus-visible {
  color: #0a2f4b;
  text-decoration: none !important;
}

.wms-info-help-trigger i {
  font-size: 1.05rem;
}

/* Above sticky headers / dropdowns; below stacked help modal */
.wms-info-help-popover {
  --bs-popover-max-width: min(420px, calc(100vw - 24px));
  z-index: 1085 !important;
  max-width: min(420px, calc(100vw - 24px));
}

.wms-info-help-popover .popover-body {
  max-height: min(360px, 55vh);
  overflow-x: hidden;
  overflow-y: auto;
  font-size: 0.875rem;
  line-height: 1.45;
  color: #212529;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: normal;
}

.wms-info-help-popover .popover-header {
  font-family: "Patua One", cursive;
  font-weight: 400;
  color: #0a2f4b;
  background: #f4f7f6;
}

.wms-info-help-body,
.wms-info-help-popover .popover-body .wms-info-help-body {
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: normal;
  max-width: 100%;
}

.wms-info-help-body a,
.wms-info-help-popover .popover-body a {
  text-decoration: none !important;
  overflow-wrap: anywhere;
}

.wms-info-help-body img,
.wms-info-help-popover .popover-body img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.wms-info-help-body table,
.wms-info-help-popover .popover-body table {
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  margin: 0.5rem 0;
  font-size: 0.85em;
}

.wms-info-help-body th,
.wms-info-help-body td,
.wms-info-help-popover .popover-body th,
.wms-info-help-popover .popover-body td {
  border: 1px solid #dee2e6;
  padding: 0.25rem 0.4rem;
  vertical-align: top;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.wms-info-help-body pre,
.wms-info-help-body code,
.wms-info-help-popover .popover-body pre,
.wms-info-help-popover .popover-body code {
  max-width: 100%;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.wms-info-help-body ul,
.wms-info-help-body ol,
.wms-info-help-popover .popover-body ul,
.wms-info-help-popover .popover-body ol {
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
}

.wms-info-help-body p:last-child,
.wms-info-help-popover .popover-body p:last-child {
  margin-bottom: 0;
}

.wms-info-help-popover-hint {
  margin-top: 0.5rem;
  padding-top: 0.4rem;
  border-top: 1px solid #e9ecef;
  font-size: 0.75rem;
  color: #6c757d;
}

/* Stacked above Bootstrap modals (1055) and AppModal (~1300+) */
.wms-info-help-modal-root {
  position: fixed;
  inset: 0;
  z-index: 1400;
  pointer-events: none;
}

.wms-info-help-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1400;
  background: rgba(7, 10, 15, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top, 0px) + 8px) max(16px, env(safe-area-inset-right, 0px) + 8px)
    max(16px, env(safe-area-inset-bottom, 0px) + 8px) max(16px, env(safe-area-inset-left, 0px) + 8px);
  pointer-events: auto;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.wms-info-help-modal {
  width: min(720px, 100%);
  max-height: calc(100dvh - 32px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(10, 47, 75, 0.18);
  color: #212529;
}

.wms-info-help-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 8px;
  border-bottom: 1px solid #e9ecef;
}

.wms-info-help-modal-title {
  margin: 0;
  font-family: "Patua One", cursive;
  font-size: 1.25rem;
  font-weight: 400;
  color: #0a2f4b;
  line-height: 1.3;
}

.wms-info-help-modal-body {
  padding: 14px 18px;
  overflow-x: hidden;
  overflow-y: auto;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: normal;
}

.wms-info-help-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 18px 16px;
  border-top: 1px solid #e9ecef;
}

.wms-info-help-empty {
  color: #6c757d;
  font-size: 0.9rem;
  margin: 0;
}
