/* Generated file. Source: js/src/handoff.css. Do not edit directly. */
/* Backdrop */
.querychat-handoff-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.12);
  z-index: 1069;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.querychat-handoff-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* Off-canvas panel */
.querychat-handoff-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 50vw;
  max-width: 700px;
  height: 100vh;
  background: var(--bs-body-bg, #fff);
  border-left: 1px solid var(--bs-border-color, #dee2e6);
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.1);
  /* Above Bootstrap modals (1050–1060) so the panel isn't obscured */
  z-index: 1070;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.querychat-handoff-panel.open {
  transform: translateX(0);
}

/* Single-row panel header */
.querychat-handoff-panel-header {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--bs-border-color, #dee2e6);
  flex-shrink: 0;
}

.querychat-handoff-panel-header h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
}

.querychat-handoff-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Spinner shown next to the title only while source is streaming in. */
.querychat-handoff-header-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid var(--bs-border-color, #dee2e6);
  border-top-color: var(--bs-primary, #0d6efd);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}

.querychat-handoff-panel.streaming .querychat-handoff-header-spinner {
  display: inline-block;
}

.querychat-handoff-header-spacer {
  flex: 1;
}

.querychat-handoff-header-divider {
  width: 1px;
  align-self: stretch;
  background: var(--bs-border-color, #dee2e6);
  margin: 0.1rem 0.15rem;
}

/* Scoped under the header so these beat Bootstrap's .btn-default border/bg
   that Shiny's input_action_button adds. */
.querychat-handoff-panel-header .querychat-handoff-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.34rem;
  line-height: 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--bs-secondary-color, #5c636a);
  border-radius: 6px;
}

.querychat-handoff-panel-header .querychat-handoff-icon-btn:hover {
  background: var(--bs-secondary-bg, #eef0f2);
  color: var(--bs-body-color, #212529);
}

.querychat-handoff-icon-btn .bi {
  vertical-align: -0.125em;
}

.querychat-handoff-panel-header .querychat-handoff-download-btn,
.querychat-handoff-panel-header .querychat-handoff-download-btn:hover {
  background: var(--bs-primary, #0d6efd);
  border-color: var(--bs-primary, #0d6efd);
  color: #fff;
}

.querychat-handoff-revise-drawer {
  display: none;
  flex-direction: column;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--bs-border-color, #dee2e6);
  flex-shrink: 0;
}

.querychat-handoff-revise-drawer.open {
  display: flex;
}

.querychat-handoff-revise-toggle.active {
  background: var(--bs-primary, #0d6efd);
  border-color: var(--bs-primary, #0d6efd);
  color: #fff;
}

.querychat-handoff-panel-body {
  flex: 1;
  overflow: auto;
  padding: 0;
}

/* shinychat re-adopts the chat footer into its React tree at page load, which
   double-initializes this editor; the live instance is the last one. */
.querychat-handoff-panel-body .code-editor > *:not(:last-child) {
  display: none;
}

.querychat-handoff-panel-body .ace_editor {
  height: 100% !important;
}

.querychat-handoff-panel-error {
  padding: 0.75rem 1rem;
  background: var(--bs-danger-bg-subtle, #f8d7da);
  color: var(--bs-danger-text-emphasis, #842029);
  border-bottom: 1px solid var(--bs-danger-border-subtle, #f5c2c7);
}

/* Chat pill */
.querychat-handoff-pill {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.7rem;
  margin-bottom: 0.5rem;
  border-radius: 0.5rem;
  background: var(--bs-primary-bg-subtle, #cfe2ff);
  color: var(--bs-primary-text-emphasis, #052c65);
  border: 1px solid var(--bs-primary-border-subtle, #9ec5fe);
  cursor: pointer;
  font-size: 0.875rem;
  text-align: left;
  max-width: 340px;
  transition: background 0.15s;
}

.querychat-handoff-pill:hover {
  background: var(--bs-primary-border-subtle, #9ec5fe);
}

.querychat-handoff-pill-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 0.4rem;
  background: var(--bs-primary-border-subtle, #9ec5fe);
  font-size: 1.15rem; /* drives the 1em icon SVG */
  flex-shrink: 0;
}

.querychat-handoff-pill-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.querychat-handoff-pill-title {
  font-weight: 600;
  line-height: 1.2;
}

.querychat-handoff-pill-subtitle {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--bs-secondary-text-emphasis, #41464b);
  line-height: 1.25;
}

.querychat-handoff-pill-open {
  display: flex;
  align-items: center;
  margin-left: auto;
  font-size: 0.9rem; /* drives the 1em icon SVG */
  opacity: 0.65;
}

/* Modal: handoff type pill selector */
.querychat-handoff-type-selector {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.querychat-handoff-type-pill {
  padding: 0.375rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--bs-border-color, #dee2e6);
  background: transparent;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.15s;
}

.querychat-handoff-type-pill:hover {
  border-color: var(--bs-primary, #0d6efd);
}

.querychat-handoff-type-pill.active {
  background: var(--bs-primary, #0d6efd);
  color: white;
  border-color: var(--bs-primary, #0d6efd);
}

.querychat-handoff-language-selector {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.querychat-handoff-language-option {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--bs-border-color, #dee2e6);
  background: transparent;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.15s;
}

.querychat-handoff-language-radio {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.querychat-handoff-language-icon {
  width: 1rem;
  height: 1rem;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.querychat-handoff-language-icon-python {
  background-image: url("img/handoff-language-python.svg");
}

.querychat-handoff-language-icon-r {
  background-image: url("img/handoff-language-r.svg");
}

.querychat-handoff-language-radio:focus-visible
  + .querychat-handoff-language-icon {
  outline: 2px solid var(--bs-focus-ring-color, rgba(13, 110, 253, 0.5));
  outline-offset: 3px;
}

.querychat-handoff-language-option:hover:not(.disabled) {
  border-color: var(--bs-primary, #0d6efd);
}

.querychat-handoff-language-option:has(
  .querychat-handoff-language-radio:checked
) {
  background: var(--bs-primary, #0d6efd);
  color: white;
  border-color: var(--bs-primary, #0d6efd);
}

.querychat-handoff-language-option.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  text-decoration: line-through;
  pointer-events: none;
}

/* Modal: gallery scroll container */
.querychat-handoff-gallery-scroll {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 0.5rem;
}

/* Modal: gallery grid */
.querychat-handoff-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}

.querychat-handoff-gallery-item {
  border: 2px solid var(--bs-border-color, #dee2e6);
  border-radius: 0.5rem;
  padding: 0.5rem;
  cursor: pointer;
  transition: border-color 0.15s;
}

.querychat-handoff-gallery-item:hover {
  border-color: var(--bs-primary, #0d6efd);
}

.querychat-handoff-gallery-item.selected {
  border-color: var(--bs-primary, #0d6efd);
  background: var(--bs-primary-bg-subtle, #cfe2ff);
}

.querychat-handoff-gallery-item .preview-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 0.25rem;
}

.querychat-handoff-gallery-item .placeholder-icon {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bs-secondary-bg, #e9ecef);
  border-radius: 0.25rem;
  color: var(--bs-secondary-color, #6c757d);
}

.querychat-handoff-gallery-item .title {
  font-size: 0.8125rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.querychat-handoff-gallery-item .preview-container {
  height: 120px;
  overflow: hidden;
  margin-bottom: 0.25rem;
  border-radius: 0.25rem;
}

.querychat-handoff-gallery-item .sql-snippet {
  font-size: 0.75rem;
  color: var(--bs-secondary-color, #6c757d);
  font-family: var(--bs-font-monospace);
  padding: 0.375rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.querychat-preview-table {
  width: 100%;
  font-size: 0.6875rem;
  border-collapse: collapse;
  table-layout: fixed;
}

.querychat-preview-table th,
.querychat-preview-table td {
  padding: 0.125rem 0.375rem;
  border-bottom: 1px solid var(--bs-border-color, #dee2e6);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 0;
}

.querychat-preview-table th {
  background: var(--bs-secondary-bg, #e9ecef);
  font-weight: 600;
}

.querychat-handoff-gallery-empty {
  text-align: center;
  padding: 2rem;
  color: var(--bs-secondary-color, #6c757d);
}

/* Checkbox overlay */
.querychat-handoff-gallery-item {
  position: relative;
}

.querychat-handoff-gallery-item .gallery-checkbox {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--bs-border-color, #dee2e6);
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  z-index: 1;
}

.querychat-handoff-gallery-item.selected .gallery-checkbox {
  background: var(--bs-primary, #0d6efd);
  border-color: var(--bs-primary, #0d6efd);
}

.querychat-handoff-gallery-item .gallery-checkbox svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: white;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.querychat-handoff-gallery-item.selected .gallery-checkbox svg {
  opacity: 1;
}

/* Shimmer loading animation */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.querychat-handoff-gallery.loading .querychat-handoff-gallery-item {
  pointer-events: none;
}

.querychat-handoff-gallery.loading .querychat-handoff-gallery-item .preview-container,
.querychat-handoff-gallery.loading .querychat-handoff-gallery-item .title {
  background: linear-gradient(
    90deg,
    var(--bs-secondary-bg, #e9ecef) 25%,
    var(--bs-tertiary-bg, #f8f9fa) 50%,
    var(--bs-secondary-bg, #e9ecef) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  color: transparent;
  border-radius: 0.25rem;
}

.querychat-handoff-gallery.loading .querychat-handoff-gallery-item .gallery-checkbox {
  display: none;
}

.querychat-handoff-gallery.loading .querychat-handoff-gallery-item .preview-container img,
.querychat-handoff-gallery.loading .querychat-handoff-gallery-item .preview-container table,
.querychat-handoff-gallery.loading .querychat-handoff-gallery-item .preview-container .sql-snippet {
  visibility: hidden;
}

/* Loading status line */
.querychat-handoff-loading-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--bs-secondary-color, #6c757d);
  margin-bottom: 0.75rem;
}

.querychat-handoff-loading-status.hidden {
  display: none;
}

.querychat-handoff-loading-status.error {
  color: var(--bs-danger-text-emphasis, #842029);
}

.querychat-handoff-loading-status .spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--bs-border-color, #dee2e6);
  border-top-color: var(--bs-primary, #0d6efd);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Directions textarea loading state */
.querychat-handoff-directions-wrapper.loading textarea {
  pointer-events: none;
  background: linear-gradient(
    90deg,
    var(--bs-secondary-bg, #e9ecef) 25%,
    var(--bs-tertiary-bg, #f8f9fa) 50%,
    var(--bs-secondary-bg, #e9ecef) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.querychat-handoff-directions-wrapper textarea {
  max-height: 150px;
}

.querychat-handoff-directions-subtitle {
  display: inline-flex;
  align-items: center;
  gap: 0.2em;
  margin-left: auto;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--bs-primary, #0d6efd);
}

.querychat-handoff-directions-subtitle.hidden {
  display: none;
}

.querychat-handoff-freeform-input.hidden {
  display: none;
}

/* Modal: intro lead-in */
.modal-content:has(.querychat-handoff-modal-intro) .modal-header {
  padding-bottom: 0.25rem;
}

.modal-body:has(> .querychat-handoff-modal-intro) {
  padding-top: 0;
}

.querychat-handoff-modal-intro {
  font-size: 0.8125rem;
  color: var(--bs-secondary-color, #6c757d);
  margin-bottom: 1rem;
}

/* Section labels */
.querychat-handoff-section-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--bs-body-color, #212529);
  margin-bottom: 0.375rem;
}

.querychat-handoff-section-label-row {
  display: flex;
  align-items: baseline;
  margin-bottom: 0.375rem;
}

.querychat-handoff-section-label-row .querychat-handoff-section-label {
  margin-bottom: 0;
}

.querychat-handoff-info-icon {
  color: var(--bs-secondary-color, #6c757d);
  cursor: help;
}
