/**
 * Floating Text Format Toolbar
 * Appears on text selection with formatting options
 */

.floating-text-format-popup {
  display: flex;
  background: #fff;
  padding: 4px;
  vertical-align: middle;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  transition: opacity 0.15s ease-in-out;
  height: auto;
  will-change: transform;
}

.floating-text-format-popup.visible {
  opacity: 1;
  pointer-events: auto;
}

.floating-text-format-popup button.popup-item {
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
  vertical-align: middle;
  transition: background-color 0.2s;
  color: #000;
  min-width: 32px;
  height: 32px;
}

.floating-text-format-popup button.popup-item svg {
  display: block;
  width: 16px;
  height: 16px;
  stroke-width: 2;
  stroke: currentColor;
  fill: none;
}

.floating-text-format-popup button.popup-item:hover:not([disabled]) {
  background-color: #eee;
}

.floating-text-format-popup button.popup-item:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.floating-text-format-popup button.popup-item.active {
  background-color: rgba(33, 111, 219, 0.1);
}

.floating-text-format-popup button.popup-item i {
  display: flex;
  width: 16px;
  height: 16px;
}

.floating-text-format-popup .divider {
  width: 1px;
  background-color: #eee;
  margin: 0 4px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .floating-text-format-popup {
    background: #374151;
    color: #fff;
    box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.5);
  }

  .floating-text-format-popup button.popup-item {
    color: #fff;
  }

  .floating-text-format-popup button.popup-item:hover:not([disabled]) {
    background-color: #4b5563;
  }

  .floating-text-format-popup button.popup-item.active {
    background-color: rgba(33, 111, 219, 0.3);
  }

  .floating-text-format-popup .divider {
    background-color: #4b5563;
  }
}

/**
 * Floating Link Editor
 * Appears on link selection for editing/viewing
 */

.link-editor {
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1001;
  max-width: 400px;
  width: 100%;
  opacity: 0;
  pointer-events: none;
  background-color: #fff;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  transition: opacity 0.15s ease-in-out;
  will-change: transform;
  align-items: center;
  padding: 6px 8px;
  gap: 8px;
}

.link-editor:not(:empty) {
  opacity: 1;
  pointer-events: auto;
}

.link-editor .button {
  width: 20px;
  height: 20px;
  display: inline-flex;
  padding: 6px;
  border-radius: 4px;
  cursor: pointer;
  border: 0;
  background: none;
  transition: background-color 0.2s;
}

.link-editor .button:hover {
  background-color: #eee;
}

.link-editor .button i {
  background-size: contain;
  height: 20px;
  width: 20px;
  display: flex;
}

.link-editor .link-input {
  flex: 1;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 14px;
  outline: none;
  min-width: 200px;
}

.link-editor .link-input:focus {
  border-color: #2163DB;
  box-shadow: 0 0 0 2px rgba(33, 111, 219, 0.1);
}

.link-editor .link-view {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.link-editor .link-view a {
  color: #2163DB;
  text-decoration: underline;
  cursor: pointer;
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.link-editor .link-view a:hover {
  text-decoration-thickness: 2px;
}

.link-editor .actions {
  display: flex;
  gap: 4px;
}

.link-editor .link-edit,
.link-editor .link-cancel,
.link-editor .link-confirm,
.link-editor .link-trash {
  width: 20px;
  height: 20px;
  cursor: pointer;
  border: 0;
  background: none;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.link-editor .link-edit:hover,
.link-editor .link-cancel:hover,
.link-editor .link-confirm:hover,
.link-editor .link-trash:hover {
  background-color: #eee;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .link-editor {
    background-color: #374151;
    color: #fff;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.5);
  }

  .link-editor .button:hover {
    background-color: #4b5563;
  }

  .link-editor .link-input {
    background-color: #1f2937;
    border-color: #4b5563;
    color: #fff;
  }

  .link-editor .link-input:focus {
    border-color: #2163DB;
    box-shadow: 0 0 0 2px rgba(33, 111, 219, 0.2);
  }

  .link-editor .link-view a {
    color: #60a5fa;
  }

  .link-editor .link-edit:hover,
  .link-editor .link-cancel:hover,
  .link-editor .link-confirm:hover,
  .link-editor .link-trash:hover {
    background-color: #4b5563;
  }
}

