@import url("/css/components/folder-tree.css");

* {
  user-select: none;
  -moz-user-select: none;
}

.upper-canvas {
  z-index: 3;
}

/* .table-config — removed, object info now rendered inside toolbar panel */

/* ==========================================================================
   Horizontal Toolbar — top of canvas
   ========================================================================== */

.vtt-toolbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  pointer-events: none;
}

/* Main button row */
.vtt-toolbar-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 2px;
  padding: var(--space-xs) var(--space-sm);
  background-color: rgba(24, 32, 41, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--surface-border);
  pointer-events: auto;
}

/* 34x34 square icon button */
.vtt-toolbar-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--border-radius);
  color: var(--main-white);
  cursor: pointer;
  position: relative;
  transition: color var(--transition-fast), opacity var(--transition-fast);
}

.vtt-toolbar-btn:hover {
  background-color: rgba(116, 167, 215, 0.12);
  border-color: var(--surface-border);
}

.vtt-toolbar-btn.active {
  background-color: rgba(222, 199, 174, 0.15);
  border-color: var(--orange3);
  color: var(--orange3);
}

.vtt-toolbar-btn.btn-danger:hover {
  background-color: rgba(206, 101, 101, 0.2);
  border-color: var(--red1);
  color: var(--red1);
}

/* SVG inside buttons */
.vtt-toolbar-btn svg {
  flex-shrink: 0;
}

/* Vertical separator between tool groups */
.vtt-toolbar-sep {
  width: 1px;
  height: 22px;
  margin: 0 var(--space-xs);
  background-color: rgba(116, 167, 215, 0.2);
  flex-shrink: 0;
}

/* Layer color badge on the layers button */
.vtt-layer-badge {
  position: absolute;
  bottom: 3px;
  right: 3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid rgba(24, 32, 41, 0.6);
  pointer-events: none;
}

/* ==========================================================================
   Dropdown panels (anchored below their button)
   ========================================================================== */

.vtt-toolbar-panel-anchor {
  position: relative;
}

.vtt-toolbar-panel {
  position: absolute;
  top: calc(100% + var(--space-xs));
  left: 0;
  min-width: 160px;
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-sm);
  background-color: var(--blue5);
  border: 1px solid var(--surface-border);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.vtt-toolbar-panel.open {
  opacity: 1;
}

.vtt-toolbar-panel small {
  color: var(--orange3);
  font-weight: bold;
}

.vtt-toolbar-panel button {
  padding: 4px 12px;
  font-size: 14px;
}

.vtt-toolbar-panel input[type="number"] {
  width: 56px;
  padding: 2px var(--space-xs);
}

/* ==========================================================================
   Draw sub-bar (persistent when draw mode is active)
   ========================================================================== */

.vtt-draw-bar {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-md);
  background-color: rgba(24, 32, 41, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--surface-border);
  pointer-events: auto;
}

.vtt-draw-bar small {
  color: var(--orange3);
  font-weight: bold;
  margin-bottom: 0;
}

/* selected-obj-info-elem — removed, now rendered inside toolbar panel */

/* help-content styling is in modals.css */

.canvas-log-item {
  padding: var(--space-sm);
  color: var(--link-blue);
  border-radius: var(--border-radius);
  cursor: pointer;
}

.canvas-log-item:hover {
  background-color: var(--blue4);
}

.table-sidebar-image-component {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: auto;
}

#image-following-cursor {
  max-height: 200px;
  max-width: 200px;
  position: absolute;
  pointer-events: none;
  opacity: 0.6;
}

/* Online users — toggle + popover panel */
.online-users-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.online-toggle {
  gap: 4px;
}

.online-toggle.active {
  background-color: rgba(24, 32, 41, 0.9);
  color: var(--orange3);
}

.online-panel {
  position: absolute;
  bottom: 100%;
  left: 0;
  min-width: 160px;
  max-width: 240px;
  max-height: 200px;
  display: flex;
  flex-direction: column;
  background-color: rgba(24, 32, 41, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--surface-border);
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.online-panel-header {
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--surface-border);
}

.online-panel-header small {
  font-weight: 600;
  font-size: 11px;
  color: var(--orange3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.online-panel-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-xs) var(--space-sm);
  overflow-y: auto;
}

.online-panel-empty {
  font-size: 12px;
  color: var(--main-gray);
  padding: var(--space-xs) 0;
}

.online-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--green);
  margin-right: var(--space-xs);
  flex-shrink: 0;
  box-shadow: 0 0 4px rgba(76, 175, 80, 0.5);
}

.online-user-item {
  display: flex;
  align-items: center;
  padding: 4px var(--space-xs);
  font-size: 12px;
  color: var(--light-gray);
  border-radius: var(--border-radius);
  white-space: nowrap;
}

.online-user-item:hover {
  background-color: rgba(116, 167, 215, 0.1);
}

/* Fallback for environments that do not support backdrop blur */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .vtt-toolbar-row,
  .vtt-draw-bar,
  .online-panel,
  .chat-box-messages,
  .chat-box-form,
  .chat-box-toggle {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .vtt-toolbar-row,
  .vtt-draw-bar,
  .chat-box-toggle {
    background-color: rgba(24, 32, 41, 0.92);
  }

  .online-panel,
  .chat-box-form {
    background-color: rgba(24, 32, 41, 0.95);
  }

  .chat-box-messages {
    background-color: rgba(24, 32, 41, 0.9);
  }
}

/* Respect OS reduced-motion preference inside VTT */
@media (prefers-reduced-motion: reduce) {
  .vtt-toolbar *,
  .vtt-draw-bar *,
  .online-users-wrapper *,
  .chat-box-container *,
  .location-pin-modal *,
  .manage-pins-list * {
    animation: none !important;
    transition: none !important;
  }

  .vtt-toolbar-row,
  .vtt-draw-bar,
  .online-panel,
  .chat-box-messages,
  .chat-box-form,
  .chat-box-toggle {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .vtt-toolbar-panel,
  .online-panel {
    transform: none !important;
  }
}

.image-name {
  width: 125px;
  word-wrap: break-word;
  margin-right: 3px;
  /* Important so we don't zoom in on mobile */
  font-size: 16px;
  border: none;
  background-color: inherit;
}

.image-name:hover {
  border: 1px solid var(--main-gray);
}

.image-name:focus {
  border: 1px solid var(--main-gray)
}

.sidebar-image-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  width: 40px;
  padding: 2px;
}

.sidebar-image-container:hover {
  border: 1px solid var(--main-white)
}

.table-sidebar-folder-component {
  padding: 5px;
  width: 100%;
  max-height: 120px;
  display: flex;
  flex-direction: column;
  background-color: var(--main-dark);
  border-bottom: 1px solid var(--main-gray);
  border-top: 1px solid var(--main-gray);
  overflow: auto;
  flex-shrink: 0;
}

.table-sidebar-filters {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  align-items: center;
}

.table-sidebar-search {
  flex: 1;
  padding: 8px var(--space-sm);
  background: rgba(31, 37, 49, 0.85);
  border: 1px solid var(--surface-border);
  border-radius: var(--border-radius);
  color: var(--main-white);
  font-size: 0.8rem;
}

.table-sidebar-load-more-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm) var(--space-sm);
}

.table-sidebar-load-more-count {
  color: var(--main-gray);
  font-size: 11px;
}

.table-sidebar-load-more {
  padding: 6px 10px;
  border-radius: var(--border-radius);
  border: 1px solid var(--surface-border);
  background: rgba(31, 37, 49, 0.9);
  color: var(--main-white);
  font-size: 12px;
  cursor: pointer;
}

.table-sidebar-load-more:hover {
  background: rgba(45, 52, 66, 0.95);
  border-color: rgba(116, 167, 215, 0.35);
}

.table-sidebar-load-more:disabled {
  opacity: 0.6;
  cursor: default;
}

/* ==========================================================================
   Chat box — frosted glass, bottom-left
   ========================================================================== */

.chat-box-container {
  position: absolute;
  width: 440px;
  max-width: 100%;
  z-index: 4;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  pointer-events: none;
}

.chat-box-container>* {
  pointer-events: auto;
}

.chat-box-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background-color: rgba(24, 32, 41, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--surface-border);
  overflow-y: auto;
  max-height: 200px;
  word-wrap: break-word;
}

.chat-box-messages * {
  user-select: text;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
}

.chat-box-messages br {
  margin-left: 2.5px;
  margin-right: 2.5px;
}

.chat-box-message-content {
  display: flex;
  flex-direction: column;
  padding: var(--space-xs) 0;
  border-bottom: 1px solid rgba(116, 167, 215, 0.06);
}

.chat-msg-header {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
}

.chat-msg-username {
  font-weight: 700;
  font-size: 12px;
  color: var(--orange3);
  margin-right: var(--space-sm);
}

.chat-msg-time {
  font-size: 10px;
  color: var(--main-gray);
  opacity: 0;
  transition: opacity var(--transition-fast);
  white-space: nowrap;
}

.chat-box-message-content:hover .chat-msg-time {
  opacity: 1;
}

.chat-msg-body {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  font-size: 13px;
  line-height: 1.4;
}

.chat-box-form {
  display: flex;
  align-items: center;
  gap: 0;
  background-color: rgba(24, 32, 41, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.chat-box-form input,
.chat-box-btn {
  height: 38px;
  padding: 0 var(--space-md);
  background-color: transparent;
  border: none;
  border-top: 1px solid var(--surface-border);
  border-radius: 0;
  font-size: 13px;
  color: var(--main-white);
}

.chat-box-form input {
  flex: 1;
}

.chat-box-form input:focus {
  outline: none;
  box-shadow: none;
  border-radius: 0;
}

.chat-box-btn {
  border-left: 1px solid var(--surface-border);
  color: var(--orange3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
}

.chat-box-btn:hover {
  background-color: rgba(222, 199, 174, 0.1);
}

.chat-box-top-row {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 2px;
}

.chat-box-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  font-size: 11px;
  font-weight: 600;
  color: var(--main-white);
  background-color: rgba(24, 32, 41, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--surface-border);
  border-bottom: none;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  cursor: pointer;
  width: max-content;
  transition: color var(--transition-fast), opacity var(--transition-fast);
}

.chat-box-toggle:hover {
  background-color: rgba(24, 32, 41, 0.9);
  color: var(--orange3);
}

.image-notes {
  color: var(--main-white);
  width: 500px;
  height: 300px;
  max-width: 90vw;
  max-height: 90vh;
  border-radius: var(--border-radius);
  border: 1px solid var(--blue4);
  outline: none;
  font-size: 16px;
  padding: 5px;
  /* resize: none; */
  cursor: text;
}

.location-pin-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.location-pin-form input,
.location-pin-form textarea,
.location-pin-form select {
  width: 100%;
  border-radius: var(--border-radius);
  border: 1px solid var(--surface-border);
  padding: var(--space-xs);
  background: var(--blue3);
  color: var(--main-white);
}


.location-pin-modal {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.location-pin-modal input,
.location-pin-modal textarea,
.location-pin-modal select {
  width: 100%;
  border-radius: var(--border-radius);
  border: 1px solid var(--surface-border);
  padding: var(--space-xs);
  background: var(--blue3);
  color: var(--main-white);
}

.location-pin-modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-xs);
}

.location-pin-modal-buttons .btn-clear {
  border: 1px solid var(--surface-border);
  background: transparent;
  color: var(--main-white);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--border-radius);
  cursor: pointer;
}


.location-pin-draw-bar {
  flex-direction: row;
  align-items: flex-start;
  gap: var(--space-md);
}

.location-pin-selected-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: 0;
  padding: 0;
  border: none;
}

.location-pin-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.location-pin-icon svg {
  width: 24px;
  height: 24px;
}

.location-pin-icon-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.location-pin-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.location-pin-id {
  text-transform: uppercase;
  font-size: 11px;
  color: var(--light-gray);
}

.location-pin-title {
  margin: 0;
  font-size: 15px;
  color: var(--main-white);
}

.location-pin-description {
  margin: 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}

.vtt-lock-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  font-size: 11px;
  line-height: 1;
}

.vtt-lock-status.is-locked {
  border-color: rgba(222, 199, 174, 0.45);
  color: var(--orange3);
  background: rgba(222, 199, 174, 0.14);
}

.vtt-lock-status.is-unlocked {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--main-gray);
}

.vtt-lock-status-icon,
.vtt-lock-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.vtt-lock-status-icon svg,
.vtt-lock-toggle-icon svg {
  width: 13px;
  height: 13px;
}

.vtt-lock-toggle-btn {
  border-radius: var(--border-radius);
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.82);
  padding: 4px 8px;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color var(--transition-fast), opacity var(--transition-fast);
}

.vtt-lock-toggle-btn.is-locked {
  border-color: rgba(222, 199, 174, 0.5);
  background: rgba(222, 199, 174, 0.12);
  color: var(--orange3);
}

.vtt-lock-toggle-btn:hover {
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.14);
}

.location-pin-edit-btn {
  border-radius: var(--border-radius);
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.75);
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
 
.location-pin-delete-btn {
  border-radius: var(--border-radius);
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  color: rgba(255, 255, 255, 0.65);
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.location-pin-actions {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
  margin-top: var(--space-xs);
}

.location-pin-actions button:hover {
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.12);
}

.location-pin-attachments-heading {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--orange3);
  font-weight: 600;
}

.location-pin-attachments {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  width: 100%;
}

.location-pin-attachment {
  font-size: 12px;
}

.location-pin-attachment-title {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

.location-pin-attachment-link {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--link-blue);
  padding: 0;
  font-size: 12px;
  display: inline-flex;
  justify-content: flex-start;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: color var(--transition-normal), opacity var(--transition-normal);
}

.location-pin-attachment-link:hover {
  color: var(--orange3);
  background: rgba(255, 255, 255, 0.08);
  text-decoration: underline;
}

.location-pin-attachment-link::after {
  content: "↗";
  font-size: 0.9em;
  color: currentColor;
}

.location-pin-attachment-note {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}

.location-pin-modal-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

/* Manage Pins modal */
.manage-pins-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  max-height: 60vh;
  overflow-y: auto;
}

.manage-pins-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--surface-border);
  border-radius: var(--border-radius);
  background: rgba(255, 255, 255, 0.04);
}

.manage-pins-info {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
  flex: 1;
}

.manage-pins-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.manage-pins-actions {
  display: flex;
  gap: var(--space-xs);
  flex-shrink: 0;
}

.location-pin-status-active {
  font-size: 11px;
  color: var(--green);
}

.location-pin-status-orphan {
  font-size: 11px;
  color: var(--orange3);
}
