/* Trigger */
.tq-widget {
  display: inline-block;
  max-width: 100%;
}

.tq-widget__trigger {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  padding: 0.65em 1.4em;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.01em;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, rgb(6, 147, 227) 0%, rgb(20, 39, 109) 100%) !important;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.12) inset,
    0 4px 16px rgba(6, 147, 227, 0.35),
    0 2px 6px rgba(20, 39, 109, 0.25);
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease, border-color 0.2s ease;
}

.tq-widget__trigger:hover {
  filter: brightness(1.06);
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.15) inset,
    0 6px 22px rgba(6, 147, 227, 0.45),
    0 3px 10px rgba(20, 39, 109, 0.3);
  transform: translateY(-1px);
}

.tq-widget__trigger:active {
  transform: translateY(0);
  filter: brightness(0.98);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 2px 8px rgba(6, 147, 227, 0.3);
}

.tq-widget__trigger:focus {
  outline: 2px solid rgb(6, 147, 227);
  outline-offset: 3px;
}

.tq-widget__trigger:focus:not(:focus-visible) {
  outline: none;
}

.tq-widget__trigger:focus-visible {
  outline: 2px solid rgb(6, 147, 227);
  outline-offset: 3px;
}

/* Backdrop (stacked under surface inside dialog) */
.tq-widget__backdrop {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  align-self: stretch;
  justify-self: stretch;
  background: rgba(15, 18, 28, 0.55);
  backdrop-filter: blur(4px);
  cursor: pointer;
  opacity: 0;
  animation: tq-widget-backdrop-in 0.22s ease forwards;
}

@keyframes tq-widget-backdrop-in {
  to {
    opacity: 1;
  }
}

/* Dialog shell (often moved to document.body via modal.js so fixed positioning is viewport-relative) */
.tq-widget__dialog {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  min-height: 100%;
  min-height: 100dvh;
  z-index: 2147483646;
  isolation: isolate;
  display: grid;
  place-items: center;
  padding: 0;
  box-sizing: border-box;
  margin: 0;
  pointer-events: auto;
}

.tq-widget__dialog[hidden] {
  display: none;
}

.tq-widget__dialog-surface {
  grid-area: 1 / 1;
  z-index: 1;
  width: min(960px, 100%);
  max-height: min(90vh, 880px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  pointer-events: auto;
  transform: translateY(12px) scale(0.98);
  opacity: 0;
  animation: tq-widget-surface-in 0.28s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes tq-widget-surface-in {
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.tq-widget__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem 0.65rem 1.1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: linear-gradient(180deg, #fafafa 0%, #f3f3f3 100%);
}

.tq-widget__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #111;
  line-height: 1.3;
}

.tq-widget__close {
  appearance: none;
  border: none;
  background: transparent;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #333;
  transition: background 0.15s ease, color 0.15s ease;
}

.tq-widget__close:hover {
  background: rgba(0, 0, 0, 0.06);
}

.tq-widget__close:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

.tq-widget__close-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.tq-widget__frame-wrap {
  flex: 1;
  min-height: 0;
  background: #fff;
}

.tq-widget-lightbox-iframe {
  display: block;
  width: 100%;
  height: min(72vh, 720px);
  border: 0;
  background: #fff;
}

html.tq-widget-modal-open,
body.tq-widget-modal-open {
  overflow: hidden;
  /* Prevent iOS background rubber-band while modal is open */
  touch-action: none;
}

@media (max-width: 600px) {
  .tq-widget__dialog {
    padding: 0;
    place-items: stretch;
  }

  .tq-widget__dialog-surface {
    width: 100%;
    max-height: none;
    align-self: stretch;
    border-radius: 0;
  }

  .tq-widget-lightbox-iframe {
    height: calc(100vh - 52px);
  }
}
