/* Tour commenting — viewer sidebar, pins, inline composer */

:root {
  --tour-comments-sidebar-width: min(400px, 100vw);
}

.tour-comments-sidebar[hidden],
.tour-comments-sidebar__composer[hidden],
.tour-comments-sidebar__footer[hidden],
#tour-comments-root[hidden] {
  display: none !important;
}

/* Shrink the panorama viewer instead of covering it with a dim overlay */
body.tour-comments-sidebar-open {
  --tour-comments-viewer-inset: var(--tour-comments-sidebar-width);
}

body.tour-comments-sidebar-open #panorama,
body.tour-comments-sidebar-open .panorama,
body.tour-comments-sidebar-open #panorama-wrapper,
body.tour-comments-sidebar-open #panorama-comparison-wrapper,
body.tour-comments-sidebar-open .panolens-container {
  width: calc(100vw - var(--tour-comments-viewer-inset));
  width: calc(100dvw - var(--tour-comments-viewer-inset));
  transition: width 0.25s ease;
}

body.tour-comments-sidebar-open .tour-comments-pins,
body.tour-comments-sidebar-open .live-tour-button-wrap,
body.tour-comments-sidebar-open .pano-thumbs-wrapper,
body.tour-comments-sidebar-open .compass-wrap.visible {
  right: var(--tour-comments-viewer-inset);
  transition: right 0.25s ease;
}

body.tour-comments-sidebar-open .koala-watermark-overlay.visible {
  clip-path: inset(0 var(--tour-comments-viewer-inset) 0 0);
}

body.tour-comments-sidebar-open .tour-comments-pano-draw {
  right: var(--tour-comments-viewer-inset);
}

.tour-comments-toggle {
  display: none;
  position: relative;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: rgba(15, 23, 42, 0.55);
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  transition: background 0.15s ease, transform 0.15s ease;
}

.tour-comments-toggle.visible {
  display: inline-flex;
}

.tour-comments-toggle:hover {
  background: rgba(15, 23, 42, 0.75);
  transform: scale(1.05);
}

.tour-comments-toggle__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #e11d48;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.tour-comments-pins {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  pointer-events: none;
  z-index: 120;
}

.tour-comments-pano-draw {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 125;
  pointer-events: none;
  touch-action: none;
}

.tour-comments-pano-draw.is-active {
  pointer-events: auto;
  cursor: crosshair;
}

.tour-comments-pin {
  position: absolute;
  pointer-events: auto;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #389af0;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  transition: transform 0.12s ease;
}

.tour-comments-pin.is-draft {
  background: #f59e0b;
  transform: scale(1.12);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.35), 0 2px 10px rgba(0, 0, 0, 0.25);
  animation: tour-comments-pin-pulse 1.2s ease-in-out infinite;
}

@keyframes tour-comments-pin-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.35), 0 2px 10px rgba(0, 0, 0, 0.25); }
  50% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0.18), 0 2px 10px rgba(0, 0, 0, 0.25); }
}

.tour-comments-pin.is-selected {
  transform: scale(1.15);
  box-shadow: 0 0 0 3px rgba(56, 154, 240, 0.45);
}

body.tour-comments-drawing canvas:not(#tour-comments-pano-draw) {
  cursor: crosshair;
}

.tour-comments-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--tour-comments-sidebar-width);
  height: 100vh;
  background: #fff;
  z-index: 140;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 32px rgba(15, 23, 42, 0.12);
}

.tour-comments-sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.tour-comments-sidebar__title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.tour-comments-sidebar__close {
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: #64748b;
}

.tour-comments-sidebar__list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 18px 16px;
}

.tour-comments-sidebar.is-composer-open .tour-comments-sidebar__list {
  display: none;
}

.tour-comments-sidebar__composer {
  flex-shrink: 0;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  padding: 0;
  overflow: hidden;
}

.tour-comments-sidebar__composer:not([hidden]) {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.tour-comments-composer__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 18px 12px;
  -webkit-overflow-scrolling: touch;
}

.tour-comments-composer__actions {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #e2e8f0;
  background: #fff;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
}

.tour-comments-sidebar__footer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #e2e8f0;
  background: #fff;
}

.tour-comments-footer__place {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tour-comments-footer__hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: #64748b;
  text-align: center;
}

.tour-comments-sidebar .button {
  margin-bottom: 0;
  display: block;
  width: 100%;
  text-align: center;
}

.tour-comments-sidebar .button[hidden],
#tour-comments-footer-place[hidden],
#tour-comments-add[hidden] {
  display: none !important;
}

body.tour-comments-placing #panorama,
body.tour-comments-placing #panorama canvas,
body.tour-comments-placing .panolens-container canvas {
  cursor: crosshair !important;
}

.tour-comments-place-cursor {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 126;
  width: 32px;
  height: 32px;
  margin: -16px 0 0 -16px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #f59e0b;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.35), 0 2px 10px rgba(0, 0, 0, 0.25);
  animation: tour-comments-pin-pulse 1.2s ease-in-out infinite;
}

.tour-comments-place-cursor[hidden] {
  display: none !important;
}

.tour-comments-sidebar .button.cta.full-width,
.tour-comments-sidebar .button.secondary.full-width {
  padding: 16px 20px;
  border-radius: 16px;
}

.tour-comments-identity-saved {
  margin: 0 0 12px;
  font-size: 13px;
  color: #64748b;
}

.tour-comments-change-name {
  border: none;
  background: transparent;
  color: #389af0;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  margin-left: 4px;
}

.tour-comments-draw-hint {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.45;
  color: #64748b;
}

.tour-comments-thread__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.tour-comments-like,
.tour-comments-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: #f5f5f7;
  color: #64748b;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.tour-comments-like svg,
.tour-comments-delete svg {
  width: 16px;
  height: 16px;
}

.tour-comments-like__count {
  min-width: 14px;
  margin-left: 2px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.tour-comments-like {
  width: auto;
  min-width: 34px;
  padding: 0 10px 0 8px;
}

.tour-comments-like:hover {
  background: #e0f2fe;
  color: #0284c7;
}

.tour-comments-like.is-liked {
  background: #dbeafe;
  color: #2563eb;
}

.tour-comments-like.is-liked svg {
  fill: currentColor;
  stroke: currentColor;
}

.tour-comments-delete:hover {
  background: #ffe1e1;
  color: #e60012;
  transform: translateY(-1px);
}

.tour-comments-sidebar__composer-title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

.tour-comments-thread__number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  margin-right: 8px;
  border-radius: 999px;
  background: #389af0;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.tour-comments-empty {
  color: #64748b;
  font-size: 14px;
  text-align: center;
  padding: 32px 12px;
}

.tour-comments-thread {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.tour-comments-thread.is-selected {
  border-color: #389af0;
  box-shadow: 0 0 0 1px rgba(56, 154, 240, 0.2);
}

.tour-comments-thread__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.tour-comments-thread__head-main {
  display: flex;
  align-items: center;
  min-width: 0;
}

.tour-comments-pano {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #389af0;
}

.tour-comments-meta {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 6px;
}

.tour-comments-body {
  font-size: 14px;
  line-height: 1.5;
  color: #1e293b;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

.tour-comments-thread__content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tour-comments-thread__footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}

.tour-comments-reply {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #e2e8f0;
}

.tour-comments-thread.is-replying {
  border-color: #389af0;
  box-shadow: 0 0 0 1px rgba(56, 154, 240, 0.2);
}

.tour-comments-thread__reply-composer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}

.tour-comments-inline-reply__title {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.tour-comments-inline-reply__meta {
  margin: 0 0 8px;
  font-size: 13px;
  color: #64748b;
}

.tour-comments-thread__reply-composer .tour-comments-composer__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.tour-comments-thread__reply-composer .button {
  margin-bottom: 0 !important;
}

.tour-comments-reply-btn {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: color 0.15s ease;
}

.tour-comments-reply-btn:hover {
  color: #389af0;
}

.tour-comments-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.tour-comments-drawing-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 7px 11px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #64748b;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
}

.tour-comments-drawing-badge svg {
  flex-shrink: 0;
  color: #94a3b8;
}

.tour-comments-attachment-thumb {
  display: block;
  padding: 0;
  border: none;
  background: transparent;
  cursor: zoom-in;
  border-radius: 8px;
  overflow: hidden;
  line-height: 0;
}

.tour-comments-attachment-thumb img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tour-comments-attachment-thumb:hover img {
  border-color: #389af0;
  box-shadow: 0 0 0 2px rgba(56, 154, 240, 0.2);
}

.tour-comments-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.tour-comments-lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}

.tour-comments-lightbox__backdrop {
  position: absolute;
  inset: 0;
  border: none;
  padding: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(6px);
  cursor: pointer;
}

.tour-comments-lightbox__panel {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
}

.tour-comments-lightbox__close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  color: #64748b;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tour-comments-lightbox__close:hover {
  background: rgba(15, 23, 42, 0.1);
  color: #0f172a;
}

.tour-comments-lightbox__img {
  display: block;
  width: 100%;
  max-height: calc(100vh - 180px);
  object-fit: contain;
  border-radius: 12px;
  background: #f8fafc;
}

.tour-comments-lightbox__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.tour-comments-lightbox__actions .button {
  margin-bottom: 0;
}

.tour-comments-attachments img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.tour-comments-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin: 10px 0 4px;
}

.tour-comments-input,
.tour-comments-textarea {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
}

.tour-comments-composer__tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0 10px;
}

.tour-comments-tab {
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.tour-comments-tab:hover:not(.is-active) {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.tour-comments-tab.is-active {
  color: #fff;
  border-color: transparent;
  background-color: #389af0;
  background-image: linear-gradient(to right, #379af0, #898bff);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.18);
}

.tour-comments-draw-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.tour-comments-draw-clear {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.tour-comments-upload-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 96px;
  margin-top: 4px;
  padding: 14px 12px;
  border: 1.5px dashed #cbd5e1;
  border-radius: 12px;
  background: #fff;
  color: #475569;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.tour-comments-upload-zone[hidden] {
  display: none !important;
}

.tour-comments-upload-zone:hover,
.tour-comments-upload-zone.is-dragover {
  border-color: #389af0;
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(56, 154, 240, 0.12);
}

.tour-comments-upload-zone__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #f8fafc;
  color: #389af0;
  box-shadow: none;
  border: 1px solid #e2e8f0;
}

.tour-comments-upload-zone__title {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.tour-comments-upload-zone__hint {
  font-size: 12px;
  line-height: 1.4;
  color: #64748b;
}

.tour-comments-upload-zone__input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.tour-comments-attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.tour-comments-attachment {
  position: relative;
}

.tour-comments-attachment img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
}

.tour-comments-attachment-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: #0f172a;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.tour-comments-attachment-add {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border: 1.5px dashed #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #64748b;
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.tour-comments-attachment-add:hover {
  border-color: #389af0;
  color: #389af0;
  background: #f8fafc;
}

.tour-comments-attachment-list:empty {
  display: none;
}

@media (max-width: 767px) {
  :root {
    --tour-comments-sidebar-width: min(100vw, 360px);
  }
}
