/* GlowBright — Rich Note Editor */

.gb-editor-wrap {
  border: 1px solid var(--input-border, #1e293b);
  border-radius: var(--radius-md, 10px);
  background: var(--input-bg, #0b1220);
  overflow: visible; /* tooltips must not be clipped */
  position: relative;
  z-index: 5;
}

.gb-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid rgba(0, 240, 255, 0.12);
  background: rgba(7, 11, 20, 0.85);
  position: relative;
  z-index: 30;
  overflow: visible;
}

.gb-editor-btn {
  position: relative;
  width: 2.15rem;
  height: 2.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.gb-editor-btn:hover,
.gb-editor-btn:focus-visible {
  color: #00f0ff;
  background: rgba(0, 240, 255, 0.1);
  border-color: rgba(0, 240, 255, 0.25);
  outline: none;
}

.gb-editor-btn.is-active {
  color: #00f0ff;
  background: rgba(0, 240, 255, 0.18);
  border-color: rgba(0, 240, 255, 0.4);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.15);
}

.gb-editor-btn svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gb-editor-sep {
  width: 1px;
  height: 1.4rem;
  background: rgba(148, 163, 184, 0.25);
  margin: 0.35rem 0.2rem;
  align-self: center;
}

/* Floating name tooltip — BELOW button so it stays above page content / sticky header */
.gb-editor-tip {
  position: absolute;
  z-index: 9999;
  top: calc(100% + 8px);
  bottom: auto;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 0.32rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #0b1220;
  background: #00f0ff;
  border-radius: 6px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s ease, visibility 0.12s ease;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), 0 0 12px rgba(0, 240, 255, 0.35);
}

.gb-editor-tip::after {
  content: "";
  position: absolute;
  bottom: 100%;
  top: auto;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-color: #00f0ff;
  border-top-color: transparent;
}

.gb-editor-btn:hover .gb-editor-tip,
.gb-editor-btn.show-tip .gb-editor-tip {
  /* legacy — replaced by .gb-float-tip */
  opacity: 0;
  visibility: hidden;
}

/* On touch devices, suppress pure CSS hover tip so JS controls it */
@media (hover: none) {
  .gb-editor-btn:hover .gb-editor-tip {
    opacity: 0;
    visibility: hidden;
  }
  .gb-editor-btn.show-tip .gb-editor-tip {
    opacity: 1;
    visibility: visible;
  }
}

.gb-editor-surface {
  min-height: 200px;
  max-height: 520px;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  z-index: 1;
  padding: 0.9rem 1rem;
  color: var(--text, #e2e8f0);
  line-height: 1.7;
  outline: none;
  word-break: break-word;
}

.gb-editor-surface:empty:before {
  content: attr(data-placeholder);
  color: #64748b;
  pointer-events: none;
}

.gb-editor-surface:focus {
  box-shadow: inset 0 0 0 1px rgba(0, 240, 255, 0.2);
}

/* Content styles inside editor + public view */
.gb-editor-surface h2,
.note-prose h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 1.1rem 0 0.5rem;
  color: #f1f5f9;
}
.gb-editor-surface h3,
.note-prose h3 {
  font-size: 1.15rem;
  font-weight: 650;
  margin: 0.95rem 0 0.4rem;
  color: #e2e8f0;
}
.gb-editor-surface h4,
.note-prose h4 {
  font-size: 1.02rem;
  font-weight: 600;
  margin: 0.85rem 0 0.35rem;
  color: #cbd5e1;
}
.gb-editor-surface p,
.note-prose p {
  margin: 0.55rem 0;
}
.gb-editor-surface ul,
.note-prose ul {
  margin: 0.5rem 0 0.5rem 1.25rem;
  list-style: disc;
}
.gb-editor-surface ol,
.note-prose ol {
  margin: 0.5rem 0 0.5rem 1.25rem;
  list-style: decimal;
}
.gb-editor-surface li,
.note-prose li {
  margin: 0.2rem 0;
}
.gb-editor-surface blockquote,
.note-prose blockquote,
.gb-editor-surface .gb-callout,
.note-prose .gb-callout {
  margin: 0.85rem 0;
  padding: 0.7rem 0.9rem;
  border-left: 3px solid #00f0ff;
  background: rgba(0, 240, 255, 0.07);
  border-radius: 0 8px 8px 0;
  color: #cbd5e1;
}
.gb-editor-surface hr,
.note-prose hr {
  border: none;
  border-top: 1px solid rgba(0, 240, 255, 0.25);
  margin: 1.1rem 0;
}
.gb-editor-surface code,
.note-prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
  padding: 0.12em 0.35em;
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.15);
  color: #67e8f9;
}
.gb-editor-surface mark,
.note-prose mark {
  background: rgba(250, 204, 21, 0.45);
  color: inherit;
  padding: 0.05em 0.2em;
  border-radius: 3px;
}
.gb-editor-surface a,
.note-prose a {
  color: #22d3ee;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.gb-editor-surface img,
.note-prose img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  margin: 0.75rem 0;
  display: block;
  border: 1px solid rgba(0, 240, 255, 0.15);
}

.gb-editor-color-pop {
  position: absolute;
  z-index: 50;
  top: calc(100% + 4px);
  left: 0;
  display: none;
  gap: 0.3rem;
  padding: 0.4rem;
  background: #0f172a;
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.gb-editor-color-pop.open {
  display: flex;
  flex-wrap: wrap;
  max-width: 160px;
}
.gb-editor-color-swatch {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}
.gb-editor-color-swatch:hover,
.gb-editor-color-swatch:focus-visible {
  border-color: #fff;
  outline: none;
}

.gb-editor-hidden-file {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 560px) {
  .gb-editor-btn {
    width: 2.35rem;
    height: 2.35rem;
  }
  .gb-editor-surface {
    min-height: 180px;
    max-height: 420px;
  }
}


/* Fixed floating tip — above button, always on top of page chrome */
.gb-float-tip {
  position: fixed;
  z-index: 100000;
  left: 0;
  top: 0;
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #0b1220;
  background: #00f0ff;
  border-radius: 6px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(2px);
  transition: opacity 0.12s ease, visibility 0.12s ease, transform 0.12s ease;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 14px rgba(0, 240, 255, 0.35);
  white-space: nowrap;
  max-width: min(90vw, 240px);
}
.gb-float-tip.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.gb-float-tip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #00f0ff;
}
.gb-float-tip.below::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: #00f0ff;
}

/* Dark/black swatches need a ring so they are visible */
.gb-editor-color-swatch[style*="#000"],
.gb-editor-color-swatch[style*="#0f172a"] {
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.35);
}
