/* Tooltips CSS - Tooltip and menu styles */

/* View menu tooltip container */
.view-menu-tooltip {
  position: fixed;
  background-color: white;
  color: #333;
  font-size: 14px;
  font-family: Arial, sans-serif;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 1px solid #ddd;
  padding: 0;
  z-index: 1100;
  min-width: 150px;
  max-width: 250px;
  display: none;
}

.view-menu-tooltip.active {
  display: block;
}

/* View menu items */
.view-menu-item {
  padding: 8px 16px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.view-menu-item:last-child {
  border-bottom: none;
}

.view-menu-item:hover {
  background-color: #f5f5f5;
}

.view-menu-item.active {
  background-color: #e3f2fd;
  font-weight: 500;
  color: #4a90e2;
}

/* Generic tooltip styles */
.tooltip {
  position: absolute;
  background-color: rgba(0, 0, 0, 0.9);
  color: white;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 4px;
  pointer-events: none;
  z-index: 1200;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s;
}

.tooltip.show {
  opacity: 1;
}

/* Tooltip arrow */
.tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.9);
}

/* Tippy.js custom theme for documentation tooltips */
.tippy-box[data-theme~='documentation'] {
  background-color: #2c2c2c !important;
  color: #ffffff !important;
  border-radius: 8px;
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.5;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
  max-width: 350px;
  z-index: 9999 !important;
}

.tippy-box[data-theme~='documentation'] .tippy-content {
  padding: 14px 18px;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.tippy-box[data-theme~='documentation'] .tippy-arrow {
  color: #2c2c2c;
}

/* Source view label styles */
.tippy-box[data-theme~='documentation'] .doc-content {
  padding-bottom: 0;
  white-space: pre-wrap;
}

.tippy-box[data-theme~='documentation'] .tooltip-divider {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  margin: 8px 0 6px 0;
}

.tippy-box[data-theme~='documentation'] .source-view-label {
  text-align: center;
  font-size: 11px;
  font-style: italic;
  opacity: 0.7;
  padding: 0;
  margin: 0;
  white-space: nowrap;
  line-height: 1;
}

.tippy-box[data-theme~='documentation'] .source-view-label-only {
  text-align: center;
  font-size: 11px;
  font-style: italic;
  opacity: 0.7;
  padding: 0;
  margin: 0;
  white-space: nowrap;
  line-height: 1;
}

/* Clickable source view label styles */
.tippy-box[data-theme~='documentation'] .source-view-clickable {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
  transition: opacity 0.2s ease;
}

.tippy-box[data-theme~='documentation'] .source-view-clickable:hover {
  opacity: 1;
  text-decoration-style: solid;
}

/* Tippy.js help tooltip theme */
.tippy-box[data-theme~='help'] {
  background-color: rgba(0, 0, 0, 0.85) !important;
  color: white !important;
  border-radius: 6px;
  font-size: 13px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.4;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
  max-width: 200px;
  z-index: 9999 !important;
}

.tippy-box[data-theme~='help'] .tippy-content {
  padding: 8px 12px;
  text-align: center;
}

.tippy-box[data-theme~='help'] .tippy-arrow {
  color: rgba(0, 0, 0, 0.85);
}

/* Floating View Menu Styles */
.floating-view-menu {
  position: fixed;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10001;

  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  padding: 16px 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);

  display: flex;
  flex-direction: column;
  gap: 8px;

  user-select: none;
  max-width: 250px;
  width: auto;

  /* Smooth transitions for collapse/expand */
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Collapsed state - narrow width, just bullets visible */
.floating-view-menu.collapsed {
  width: 44px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Reduce bullet opacity when menu is collapsed */
.floating-view-menu.collapsed .floating-view-bullet {
  opacity: 0.5;
}

.floating-view-item {
  display: flex;
  align-items: flex-start; /* Align to top for multi-line labels */
  gap: 10px;
  cursor: pointer;
  transition: gap 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 4px 0;
}

/* Remove gap when collapsed */
.floating-view-menu.collapsed .floating-view-item {
  gap: 0;
}

.floating-view-bullet {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #000;
  flex-shrink: 0;
  transition: all 0.2s ease;
  margin-top: 4px; /* Align with first line of text */
}

.floating-view-item:not(.active) .floating-view-bullet {
  background-color: #ccc;
}

.floating-view-label {
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #999;
  line-height: 1.4; /* Increased line height for better spacing */

  /* Handle long names */
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2; /* Allow max 2 lines */
  -webkit-box-orient: vertical;
  word-break: break-word;
  flex: 1; /* Take remaining space */

  /* Only transition color by default */
  transition: color 0.2s ease;
}

/* Hide labels when menu is collapsed */
.floating-view-menu.collapsed .floating-view-label {
  opacity: 0;
  width: 0;
  overflow: hidden;
  /* Force single line to prevent height expansion from wrapping */
  -webkit-line-clamp: 1 !important;
  white-space: nowrap !important;
  display: block !important;

  /* Instant change when collapsing - no transition */
  transition: none;
}

/* When expanding (not collapsed), keep collapsed display mode during expansion */
.floating-view-menu:not(.collapsed) .floating-view-label {
  /* Maintain single-line collapsed state during width expansion */
  -webkit-line-clamp: 1;
  white-space: nowrap;
  display: block;

  /* After 0.3s, snap all properties to normal instantly */
  transition:
    -webkit-line-clamp 0s step-end 0.3s,
    white-space 0s step-end 0.3s,
    display 0s step-end 0.3s,
    opacity 0s step-end 0.3s,
    width 0s step-end 0.3s,
    color 0.2s ease;
}

.floating-view-item.active .floating-view-label {
  color: #000;
  font-weight: 400;
}

.floating-view-item:hover .floating-view-label {
  color: #000;
}