/*
 * DETAIL OVERLAY (themes/shared/js/detail-overlay.js) and the "Back" button on a
 * detail page opened on its own (application/views/enduser/theme_includes/detail_back.php).
 * Colours from the portal's variables; 14px is the smallest text.
 */

/* the page behind: held in place while the overlay is open (the script sets body's top) */
html.qdo-lock { overflow: hidden; }
html.qdo-lock body { position: fixed; left: 0; right: 0; width: 100%; overflow: hidden; }

.qdo {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  flex-direction: column;
  background: #fff;
  font-size: 15px;
  line-height: 1.4;
}
.qdo[hidden] { display: none; }

.qdo-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 60px;
  padding: 8px 20px;
  padding-top: max(8px, env(safe-area-inset-top));
  background: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, .1);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
}
.qdo .qdo-close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--site_color_g, var(--secondary-color, #1f2937));
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.qdo .qdo-close:hover { filter: brightness(.92); }
.qdo .qdo-close:focus-visible { outline: 3px solid var(--site_color_g, #1f2937); outline-offset: 3px; }
.qdo-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--site_font_color_g, #16233a);
  font-size: 17px;
  font-weight: 700;
}

.qdo-body { position: relative; flex: 1 1 auto; min-height: 0; }
.qdo-frame { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
.qdo.is-loading .qdo-frame { visibility: hidden; }

.qdo-spin {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--site_font_color_g, #16233a);
  font-size: 15px;
}
.qdo-spin[hidden] { display: none; }
.qdo-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(0, 0, 0, .1);
  border-top-color: var(--site_color_g, var(--secondary-color, #1f2937));
  border-radius: 50%;
  animation: qdo-turn .8s linear infinite;
}
@keyframes qdo-turn { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .qdo-spinner { animation-duration: 2.4s; } }

@media (max-width: 600px) {
  .qdo-bar { gap: 10px; min-height: 56px; padding-left: 12px; padding-right: 12px; }
  .qdo-title { font-size: 15px; }
}

/* ---------- "Back" on a detail page opened on its own ---------- */
/* also .container: the theme's own container lines it up with the content (its side padding is kept) */
.qme-detail-back-wrap {
  position: relative;
  z-index: 5;
  margin-left: auto;
  margin-right: auto;
  padding-top: 16px;
  padding-bottom: 0;
}
a.qme-detail-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid rgba(0, 0, 0, .14);
  border-radius: 999px;
  background: #fff;
  color: var(--site_font_color_g, #16233a) !important;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
}
a.qme-detail-back:hover, a.qme-detail-back:focus-visible {
  border-color: var(--site_color_g, #1f2937);
  color: var(--site_color_g, #1f2937) !important;
}
