/* --- Tonalit Editor UI (non-breaking CSS) --- */
:root {
  --bg: #ffffff;
  --surface: #f6f7fb;
  --surface-2: #eef0f6;
  --ink: #0f172a;
  --muted: #6b7280;
  --accent: #2563eb;
  /* primary */
  --ring: rgba(37, 99, 235, .35);
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 6px 24px rgba(15, 23, 42, .06);
}

html,
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.35 ui-sans-serif, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

* {
  box-sizing: border-box
}

button {
  font: inherit
}

/* Sticky top bar */
.top-toolbar-container {
  position: sticky;
  top: 0;
  z-index: 50;
  background: none;
  padding: 10px 8px 8px;
}

/* New single-row toolbar */
.toolbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: scroll;
  overflow-y: hidden;
  background: none;
  border:none;
  border-radius: 12px;
  padding-bottom: 8px;

}

/* Notation surface: allow horizontal scrolling instead of cramping */
#notation {
  position: relative;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.spacer {
  flex: 1 1 auto;
}

.center-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 auto;
}

.bpm {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 6px 10px;
}

.bpm label {
  color: var(--muted);
  font-weight: 600;
}

.bpm input[type="range"] {
  width: 100px;
  accent-color: #2563eb;
}

.bpm output {
  min-width: 2.5ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.toolbar-btn,
#btnAddNotes,
[onclick="playNotes()"],
[onclick="stopPlayback()"],
#btnDot,
.dropdown-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .03);
  transition: transform .05s ease, background .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.toolbar-btn:hover,
#btnAddNotes:hover,
[onclick="playNotes()"]:hover,
#btnDot:hover {
  background: var(--surface-2)
}

.toolbar-btn:active,
#btnAddNotes:active,
[onclick="playNotes()"]:active,
#btnDot:active {
  transform: translateY(1px)
}

/* Duration type accents (kept to avoid JS changes) */
.dur-note {
  --btn-bd: #bfdbfe;
  --btn-bg: #eff6ff;
  --btn-fg: #1d4ed8;
}

.dur-rest {
  --btn-bd: #a7f3d0;
  --btn-bg: #ecfdf5;
  --btn-fg: #047857;
}

/* Dotted active */
#btnDot.is-active,
#durationSelector button.is-active,
#btnAddNotes.is-active {
  border-color: currentColor !important;
  background: color-mix(in srgb, currentColor 12%, #fff) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent);
}

/* Dropdowns */
.dropdown {
  position: relative;
}

.dropdown-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 460px;
  max-width: min(88vw, 680px);
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px;
  box-shadow: var(--shadow);
  display: none;
  /* hidden by default */
}

.dropdown-panel.is-open {
  display: block;
}

.dropdown-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.dropdown-row button {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #fff;
}

/* Selected state for duration buttons (green highlight) */
.dropdown-row button.is-selected {
  color: #065f46;
  /* dark emerald */
  border-color: #34d399;
  /* emerald-300 */
  background: #ecfdf5;
  /* emerald-50 */
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .25);
}

.dropdown-row button.is-selected:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, .35);
}

.toolbar-row button:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}

/* Field (label + input/select) */
.field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.field>label {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}

.field>input[type="number"],
.field>select {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #fff;
}

#measures {
  width: 64px
}

/* Notation wrapper */


#notation {
  position: relative;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

/* VexFlow Annotation yazıları için kırmızı */
#notation svg text.vf-annotation {
  fill: #d32f2f;
  stroke: none;
}

/* Eğer başka bir kural !important ile eziyorsa: */
#notation svg text.vf-annotation,
#notation .vf-annotation {
  fill: #d32f2f !important;
  stroke: none !important;
}

/* üstten/ alttan güvenli pay için */
#playhead {
  scroll-margin-top: 72px;
  scroll-margin-bottom: 40px;
}

#notation.note-input-active {
  cursor: crosshair;
}

#notation.drag-over {
  outline: 3px dashed rgba(37, 99, 235, .45);
  outline-offset: 4px;
}

#deleteBubble {
  position: absolute;
  display: none;
  width: 32px;
  height: 32px;
  line-height: 32px;
  text-align: center;
  border-radius: 16px;

  box-shadow: 0 6px 14px rgba(162, 162, 162, 0.35);
  cursor: pointer;
  user-select: none;
  z-index: 11;
  transform-origin: center bottom;
  font-size: 18px;
}

#deleteBubble.bounce {
  animation: bubble-bounce 520ms cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes bubble-bounce {
  0% {
    transform: translateY(8px) scale(.7);
    opacity: .0;
  }

  60% {
    transform: translateY(-4px) scale(1.06);
    opacity: 1;
  }

  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

#deleteBubble:hover {
  filter: brightness(1.05);
}

#deleteBubble:active {
  transform: scale(.94);
}

.playhead {
  scroll-margin-top: 60px;
}

/* --- Measure Navigator --- */
.measure-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 6px 10px;
  box-shadow: var(--shadow);
}

.measure-nav .nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
}

.measure-nav .nav-btn:hover {
  background: var(--surface-2);
}

.measure-nav .nav-btn:active {
  transform: translateY(1px);
}

.measure-nav input[type="number"] {
  width: 70px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #fff;
  font-variant-numeric: tabular-nums;
}

.measure-nav .slash {
  color: var(--muted);
  user-select: none;
}

.measure-nav .total {
  min-width: 2.5ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

/* küçük ekranlarda satır kırıldığında da derli toplu kalsın */
@media (max-width: 780px) {
  .measure-nav {
    padding: 6px 8px;
  }

  .measure-nav input[type="number"] {
    width: 56px;
  }
}

@media (max-width: 780px) {
  .dropdown-panel {
    min-width: 300px
  }
}

/* === Loading Overlay === */
.loading-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(1.1) blur(2px);
  -webkit-backdrop-filter: saturate(1.1) blur(2px);
  z-index: 9999;
}

.loading-overlay.show {
  display: flex;
}

.loading-box {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  box-shadow: var(--shadow);
  color: var(--ink);
  font-weight: 600;
}

.loading-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #e5e7eb;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* === Persistent Watermark (bottom-right) === */
.nothera-watermark {
  position: fixed;
  right: 14px;
  bottom: 12px;
  z-index: 4000;
  pointer-events: none; /* don’t block clicks/scroll */
  opacity: .8; /* subtle, watermark feel */
}

.nothera-watermark img {
  display: block;
  max-width: clamp(88px, 12vw, 150px);
  height: auto;
  filter: drop-shadow(0 1px 1.5px rgba(0,0,0,.08));
}
