/* App-wide styles shared by every page (linked from core_app/parts/head.html). */

/* Small screens: scroll tables sideways instead of overlapping neighbours.
   DataTables 2.x puts the table in .dt-layout-table > div; plain tables use .table-responsive. */
.dt-container .dt-layout-table > div { overflow-x: auto; }

@media (max-width: 767.98px) {
    table.dataTable th, table.dataTable td,
    .table-responsive .table th, .table-responsive .table td { white-space: nowrap; }
}

/* Icon-only row action buttons (the label shows as a tooltip on hover/focus). */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    line-height: 1;
    vertical-align: middle;
}

td a.btn-icon { margin-right: .25rem; }

/* Sidebar menu / submenu */
.sidebar .nav-link[data-bs-toggle="collapse"] .bi-chevron-down { transition: transform .2s ease; }
.sidebar .nav-link[data-bs-toggle="collapse"][aria-expanded="true"] .bi-chevron-down { transform: rotate(180deg); }
.sidebar-submenu { border-left: 2px solid rgba(0, 0, 0, .1); }
.sidebar-submenu .nav-link { padding-top: .3rem; padding-bottom: .3rem; font-size: .95rem; }
.sidebar .nav-link.active {
    font-weight: 600;
    color: #052c65;
    background: rgba(13, 110, 253, .12);
    border-radius: .375rem;
}

/* Download Members filter: checkbox dropdowns scroll when the list is long */
.export-checklist { max-height: 14rem; overflow-y: auto; }

/* Locked / AUTO GENERATED fields stay grey (Bootstrap 5.3 only greys :disabled, 5.0 also greyed [readonly]) */
.form-control[readonly] { background-color: #e9ecef; opacity: 1; }

.api-key-box {
    padding: .75rem 1rem;
    margin: 0 0 1rem;
    font-family: var(--bs-font-monospace);
    font-size: 1rem;
    word-break: break-all;
    white-space: pre-wrap;
    user-select: all;
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: .375rem;
}

/* vcard:start */
/* Card designer and viewer (ported from the virtual card project) */
.header-container {
    display: flex; 
    align-items: center; 
    justify-content: center;
    gap: 10px; 
}

#controls {
  margin-bottom: 15px;
}

#canvas-container {
  border: 1px solid #ccc;
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 30px;
  background: #f5f6f8;
  text-align: center;
  -webkit-overflow-scrolling: touch;
}

#front-canvas-container,
#back-canvas-container,
#coc-canvas-container {
  display: inline-block;
  min-width: max-content;
  max-width: none;
  text-align: center;
  vertical-align: top;
}

#front-canvas-container h4,
#back-canvas-container h4 {
  margin-bottom: 12px;
}

#canvas-container .canvas-container {
  display: inline-block !important;
  margin: 0 auto !important;
  max-width: none !important;
  text-align: left;
}

#canvas-container canvas,
#c-front,
#c-back,
#c-coc {
  max-width: none !important;
}

#c-front,
#c-back,
#c-coc {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

#controls button {
  margin: 0 !important;
}

#controls button,
.template-toolbar .editor-btn,
.editor-option-row .btn {
  cursor: pointer;
}

#controls button:disabled,
.template-toolbar .editor-btn:disabled,
.editor-option-row .btn:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.editor-name-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.editor-name-row label {
  margin-bottom: 0;
  white-space: nowrap;
}

.editor-name-input {
  max-width: 600px;
  min-width: 300px;
}

.editor-option-row {
  display: flex !important;
  align-items: center !important;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.editor-option-row.d-none {
  display: none !important;
}

.editor-option-label {
  margin-bottom: 0;
  white-space: nowrap;
  height: 31px;
  display: inline-flex;
  align-items: center;
}

.editor-option-select-wrap {
  width: 120px !important;
  min-width: 120px !important;
  max-width: 120px !important;
  flex: 0 0 120px !important;
}

.editor-option-select-wrap.editor-option-select-wrap--font {
  width: 190px !important;
  min-width: 190px !important;
  max-width: 190px !important;
  flex: 0 0 190px !important;
}

.editor-option-select-wrap.editor-option-select-wrap--behavior {
  width: 220px !important;
  min-width: 220px !important;
  max-width: 220px !important;
  flex: 0 0 220px !important;
}

.editor-style-toggle-group {
  display: inline-flex;
  gap: 4px;
}

.editor-style-btn {
  width: 31px;
  height: 31px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 1px solid #ced4da;
  background: #fff;
  color: #212529;
}

.editor-style-btn:hover {
  background: #f1f3f5;
}

.editor-style-btn[aria-pressed="true"] {
  background: #0d6efd;
  border-color: #0d6efd;
  color: #fff;
}

.editor-style-underline {
  text-decoration: underline;
}

.editor-option-size {
  width: 80px;
  height: 31px;
}

.editor-option-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.editor-option-select-wrap .form-select {
  width: 100% !important;
  height: 31px;
}

.editor-option-btn {
  height: 31px;
  min-height: 31px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  margin: 0 !important;
}

.editor-option-indicator {
  height: 31px;
  display: inline-flex;
  align-items: center;
  font-weight: 700;
  margin-left: 8px;
  white-space: nowrap;
}

.template-toolbar .btn {
  margin: 0;
}

.side-btn {
  margin: 0 !important;
  height: 31px;
  min-height: 31px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-weight: 600;
  border-radius: 5px;
  cursor: pointer;
}

.side-btn-front {
  background: #2563eb;
  color: #ffffff;
  border: 1px solid #2563eb;
}

.side-btn-front:hover {
  background: #3b82f6;
  color: #ffffff;
  border-color: #3b82f6;
}

.side-btn-back {
  background: #f3e8ff;
  color: #6b21a8;
  border: 1px solid #c084fc;
}

.side-btn-back:hover {
  background: #e9d5ff;
  color: #581c87;
  border-color: #a855f7;
}

.side-btn.active-side {
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

.template-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  background: #f6f7f9;
  border-radius: 6px;
}

.template-toolbar .editor-btn {
  margin: 0 !important;
  min-height: 31px;
  padding: 5px 12px;
  border-radius: 6px;
  font-weight: 600;
  border: 1px solid transparent;
  box-shadow: none;
}

.editor-btn-blue {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

.editor-btn-teal {
  background: #0f766e;
  color: #ffffff;
  border-color: #0f766e;
}

.editor-btn-teal-outline {
  background: #ffffff;
  color: #0f766e;
  border-color: #0f766e;
}

.editor-btn-gray {
  background: #64748b;
  color: #ffffff;
  border-color: #64748b;
}

.editor-btn-cyan {
  background: #e0f7fa;
  color: #036672;
  border-color: #67d7e5;
}

.editor-btn-amber {
  background: #fff7ed;
  color: #b45309;
  border-color: #f59e0b;
}

.editor-btn-red {
  background: #dc3545;
  color: #ffffff;
  border-color: #dc3545;
}

.editor-btn-yellow {
  background: #facc15;
  color: #1f2937;
  border-color: #eab308;
}

.editor-btn-green {
  background: #198754;
  color: #ffffff;
  border-color: #198754;
}

.template-toolbar .editor-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.editor-btn-blue:hover {
  background: rgb(88, 152, 255); 
  color: #ffffff;
  border-color: #3b82f6;
}

.editor-btn-teal:hover {
  background: #14b8a6; 
  color: #ffffff;
  border-color: #14b8a6;
}

.editor-btn-gray:hover {
  background: #94a3b8; 
  color: #ffffff;
  border-color: #94a3b8;
}

.editor-btn-red:hover {
  background: #ef4444; 
  color: #ffffff;
  border-color: #ef4444;
}

.editor-btn-green:hover {
  background: #22c55e; 
  color: #ffffff;
  border-color: #22c55e;
}

.editor-btn-yellow:hover {
  background: #ffe26d;
  color: #1f2937;
  border-color: #eab308;
}

.viewer-container {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-align: center;
  margin: 24px auto;
  padding: 0 16px;
  font-size: 13px;
  overflow-x: hidden;
}

.viewer-container .form-select,
.viewer-container .form-control {
  max-width: 100%;
}

#canvas-root {
  display: block;
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 30px;
  background: #f5f6f8;
  margin-top: 1rem;
  text-align: center;
  -webkit-overflow-scrolling: touch;
}

.canvas-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f6f8;
  z-index: 1;
}

.canvas-loading[hidden] {
  display: none;
}

#canvas-root > div {
    margin: 0 auto;
}

#c {
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.csv-preview-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 auto;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  background: #ffffff;
}

.csv-preview-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  margin: 0;
  white-space: nowrap;
}

.csv-preview-table th,
.csv-preview-table td {
  white-space: nowrap;
  vertical-align: middle;
}

@media (max-width: 768px) {
  .csv-preview-scroll {
    max-height: 55vh;
  }
  #searchInput {
    max-width: 100% !important;
  }
}

#canvas-root .canvas-container {
  display: inline-block !important;
  margin: 0 auto !important;
  max-width: none !important;
  text-align: left;
}

#canvas-root canvas,
#c {
  max-width: none !important;
}

#canvas-container canvas {
    display: block;
}

@media (max-width: 992px) {
  .viewer-container {
    margin: 16px auto;
    padding: 0 10px;
  }
  #canvas-root {
    padding: 15px;
  }
}

.viewer-header-clean {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  text-align: left;
}

.viewer-title-block {
  min-width: 240px;
}

.viewer-main-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.viewer-panel {
  background: #ffffff;
  border: 1px solid #dee2e6;
  border-radius: 10px;
  padding: 16px;
  text-align: left;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.viewer-panel-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 3px;
}

.viewer-panel-help {
  color: #6c757d;
  font-size: 13px;
  margin-bottom: 14px;
}

.viewer-options-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.viewer-import-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.viewer-delivery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.viewer-field .form-label {
  font-weight: 600;
  margin-bottom: 4px;
}

.viewer-field .form-select,
.viewer-field .form-control {
  width: 100%;
  max-width: 100%;
}

@media (max-width: 768px) {
  .viewer-header-clean {
    align-items: stretch;
  }
  .viewer-main-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .viewer-main-actions .btn {
    width: 100%;
  }
  .viewer-options-grid,
  .viewer-import-grid,
  .viewer-delivery-grid {
    grid-template-columns: 1fr;
  }
  .viewer-import-grid .btn {
    width: 100%;
  }
}

#c.card-flippable {
  cursor: pointer;
  transition: transform 0.16s ease-in;
}

#c.card-flipping {
  transform: perspective(1200px) rotateY(90deg);
}

@media (prefers-reduced-motion: reduce) {
  #c.card-flippable {
    transition: none;
  }
}

.editor-real-toggle[aria-pressed="true"] {
  background: #0d6efd;
  border-color: #0d6efd;
  color: #fff;
}

.preview-both {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}
/* vcard:end */

.viewer-search { max-width: 300px; }

/* Card designer, COC designer and viewer layout (sub-project 5, hand-written; the ported block above is not edited) */
#back-canvas-container { display: none; }          /* editor.js shows it with an inline display value */
#downloadCard, #downloadGif, #downloadCoc, #downloadSelected, #downloadAll { display: none; }   /* viewer.js shows them */

.editor-group {
    padding: .75rem 0;
    border-bottom: 1px solid var(--bs-border-color);
}

.editor-group:first-child { padding-top: .25rem; }

.editor-group:last-child {
    padding-bottom: .25rem;
    border-bottom: 0;
}

.editor-group-title {
    margin-bottom: .5rem;
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
}

.editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.editor-group .editor-name-row,
.editor-group .editor-option-row { margin-bottom: .5rem; }

.editor-group .editor-option-row:last-child { margin-bottom: 0; }

.editor-status {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.editor-live-search { max-width: 220px; }

.editor-live-select { max-width: 320px; }

.editor-canvas-caption {
    margin-bottom: .75rem;
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
}

.viewer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--bs-border-color);
}

/* viewer.js shows each download button with an inline display value; no visible button = no strip */
.viewer-actions:not(:has(button[style*="inline-block"])) { display: none; }

@media (max-width: 576px) {
    .editor-name-input { min-width: 0; width: 100%; }
    .editor-live-search,
    .editor-live-select { max-width: none; width: 100%; }
    .editor-header > div { width: 100%; }
    .editor-header > div > .btn { flex: 1 1 auto; }
}

/* portal pages (public lookup, card, change request) */
.portal-body { min-height: 100vh; }
.portal-container { max-width: 960px; }
.portal-lookup-card { max-width: 420px; }
.lockout-clock { font-variant-numeric: tabular-nums; font-weight: 600; }
.portal-change-card { max-width: 720px; }
#canvas-root #c, #canvas-root #previewBoth { zoom: var(--card-fit, 1); }   /* public card page: shrink to the screen (portal_card_fit.js) */

/* watermark */
.preferences-card { max-width: 560px; }
.hmo-watermark {
  position: fixed; left: 0; right: 0; bottom: 6vh; height: 200px; z-index: 2;
  display: flex; align-items: center; overflow: hidden; pointer-events: none;
  color: rgba(220, 53, 69, 0.08);          /* very light red */
}
.hmo-watermark-steth { flex: 0 0 auto; height: 180px; width: auto; margin-left: 2vw; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; }
.hmo-watermark-track {
  flex: 1 1 auto; height: 100%; overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12%, #000 88%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 12%, #000 88%, transparent 100%);
}
.hmo-watermark-ecg { width: 200%; height: 100%; will-change: transform; animation: hmo-ecg-run 16s linear infinite; }
.hmo-watermark-line { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 3; stroke-linejoin: round; }
.hmo-watermark-line path { vector-effect: non-scaling-stroke; }
@media (min-width: 768px) { .hmo-watermark-staff { left: 25%; } }                 /* the sidebar is the left quarter */
@media (min-width: 992px) { .hmo-watermark-staff { left: 16.6667%; } }
@keyframes hmo-ecg-run { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .hmo-watermark .hmo-watermark-ecg { animation: none; } }
@media print { .hmo-watermark { display: none; } }
