/* ============================================================
   APP — ABC EDITOR (desktop-first, simples) — CLEAN
============================================================ */
#abc-editor-app {
  --brand:#12B3B6;
  --brand-2:#F5C84C;
  --bg:#ffffff;
  --panel:#ffffff;
  --ink:#0e1720;
  --muted:#5b6570;
  --line:#e6ebf0;
  --shadow:0 10px 30px rgba(0,0,0,.08);
  --radius:16px;
  --dock-width:700px;
  --app-fixed-top:138px;

  background:var(--bg);
  color:var(--ink);
  font-family:"IBM Plex Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;

  padding:0 0 40px;
  max-width:1300px;
  margin:0 auto;

  position:relative;
  z-index:1; /* abaixo do menu WP */

  transition:padding-left .25s ease;
}

/* box model consistente */
#abc-editor-app * {
  box-sizing:border-box;
}

.lg-app-dialog-overlay {
  position:fixed;
  inset:0;
  z-index:100000;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
  background:rgba(14,23,32,.48);
  backdrop-filter:blur(2px);
}

.lg-app-dialog {
  width:min(100%,560px);
  overflow:hidden;
  color:#0e1720;
  background:#fff;
  border:1px solid #e6ebf0;
  border-radius:16px;
  box-shadow:0 22px 60px rgba(14,23,32,.28);
}

.lg-app-dialog p {
  margin:0;
  padding:28px 32px;
  font-size:17px;
  line-height:1.5;
}

.lg-app-dialog-footer {
  display:flex;
  justify-content:flex-end;
  padding:14px 20px;
  border-top:1px solid #e6ebf0;
  background:#fafbfc;
}

.lg-app-dialog-footer button {
  min-height:42px;
  padding:9px 20px;
  color:#0e1720;
  font:inherit;
  font-weight:700;
  background:#fff;
  border:2px solid #12b3b6;
  border-radius:10px;
  cursor:pointer;
}

.lg-app-dialog-footer button:hover,
.lg-app-dialog-footer button:focus-visible {
  background:#e9fbfb;
  outline:3px solid rgba(18,179,182,.22);
  outline-offset:2px;
}

#abc-editor-app .screen-reader-text {
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
  border:0;
}

/* ============================================================
   BOTÃO FLUTUANTE — TOGGLE DOCK
============================================================ */
#abc-editor-app #dock-toggle {
  position:fixed;
  top:80px;
  left:24px;

  z-index:10;

  width:46px;
  height:46px;
  border-radius:50%;
  background:#fff;
  color:var(--ink);
  border:1px solid var(--line);
  font-size:20px;
  cursor:pointer;
  box-shadow:0 8px 20px rgba(0,0,0,.18);
  display:inline-flex;
  align-items:center;
  justify-content:center;
}

#abc-editor-app #dock-toggle .tb-icon {
  width:24px;
  height:24px;
}

#abc-editor-app #dock-toggle .abc-dock-letter {
  display:block;
  color:#fff;
  font:700 24px/1 "IBM Plex Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;
  letter-spacing:0;
}

/* ============================================================
   BLOCOS
============================================================ */
#abc-editor-app .abc-block {
  background:var(--panel);
  padding:28px;
  margin:0 20px 36px;
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  border:1px solid var(--line);
}

/* ============================================================
   TEXTO — ABC INPUT (DESKTOP)
============================================================ */
#abc-editor-app #abc-input {
  width:100%;
  min-height:450px;
  resize:vertical;

  font:15px/1.6 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;

  background:#fafbfc;
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:16px;

  white-space:pre;
}

/* ============================================================
   CONTROLOS
============================================================ */
#abc-editor-app .block-controls {
  display:grid;
  grid-template-columns:1fr;
  gap:14px;
  align-items:start;
  font-size:14px;
}

/* ============================================================
   TRANSPOSE + BPM — CAIXINHAS
============================================================ */
#abc-editor-app .controls-params {
  display:flex;
  flex-wrap:nowrap;
  gap:14px;
  align-items:center;
  margin-left:-22px;
}

#abc-editor-app .controls-actions {
  display:flex;
  flex-wrap:nowrap;
  gap:10px;
  align-items:flex-start;
}

#abc-editor-app .controls-actions .tb-btn {
  flex:0 0 var(--btn-size);
  width:var(--btn-size);
  height:var(--btn-size);
}

#abc-editor-app .controls-actions #lang-toggle.active {
  transform:none;
}

#abc-editor-app .param-box {
  display:flex;
  align-items:center;
  gap:8px;
  min-width:0;

  padding:10px 12px;
  background:var(--bg);
  border:1px solid var(--line);
  border-radius:12px;

  box-shadow:inset 0 1px 0 rgba(255,255,255,.6);
}

#abc-editor-app .param-box .tb-btn {
  flex:0 0 auto;
}

#abc-editor-app #btn-copy-link.is-copied {
  color:var(--accent);
}

#abc-editor-app .param-box .label {
  flex:0 0 auto;
  font-size:12px;
  font-weight:600;
  color:var(--muted);
  white-space:nowrap;
}

#abc-editor-app .param-box:first-child {
  flex:0 0 366px;
}

#abc-editor-app .param-box:first-child .label {
  flex-basis:104px;
}

#abc-editor-app .chip-val {
  min-width:44px;
  text-align:center;

  padding:6px 8px;
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:8px;

  font-weight:700;
  font-size:14px;
}

#abc-editor-app .param-box:hover,
#abc-editor-app .param-box:hover .chip-val {
  border-color:var(--brand);
}

/* ============================================================
   PREVIEW — PARTITURA
============================================================ */
#abc-editor-app #paper {
  background:#fafbfc;
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:16px;
  min-height:360px;
}

#abc-editor-app #paper svg,
#abc-editor-app #paper svg * {
  cursor: default;
  pointer-events: none;
}

#abc-editor-app #paper .lg-abc-sync-active {
  filter: drop-shadow(0 0 2px rgba(255, 196, 45, .95)) drop-shadow(0 0 5px rgba(20, 184, 166, .35));
}

#abc-editor-app #paper .lg-abc-sync-active,
#abc-editor-app #paper .lg-abc-sync-active * {
  fill: #ef4444 !important;
  stroke: #ef4444 !important;
}

#abc-editor-app #paper .abcjs-note_selected:not(.lg-abc-sync-active),
#abc-editor-app #paper .abcjs-note_selected:not(.lg-abc-sync-active) * {
  fill: currentColor !important;
  stroke: currentColor !important;
}

/* ============================================================
   DOCK — DESKTOP
============================================================ */
#abc-editor-app.dock-open {
  max-width:none;
  margin:0;
  padding-left:var(--dock-width);
}

#abc-editor-app #abc-dock {
  position:fixed;
  top:var(--app-fixed-top);
  left:65px;

  width:var(--dock-width);
  height:calc(100vh - 140px);
  max-width:calc(100vw - 48px);

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

  z-index:5;
  overflow-y:auto;
  background:transparent;

  transition:transform .25s ease, opacity .25s ease;
}

#abc-editor-app.dock-open .block-preview {
  position:fixed;
  top:var(--app-fixed-top);
  right:20px;
  left:calc(var(--dock-width) + 85px);
  height:calc(100vh - var(--app-fixed-top) - 20px);
  margin:0;
  overflow:auto;
  z-index:4;
}

#abc-editor-app #abc-dock:not(.is-open) {
  transform:translateX(-120%);
  opacity:0;
  pointer-events:none;
}

#abc-editor-app #abc-dock .abc-block {
  margin:0;
}

/* ============================================================
   CATÁLOGO — OVERLAY FLUTUANTE
============================================================ */
#abc-editor-app .abc-cat-overlay {
  position:fixed;
  inset:0;
  z-index:50;
  background:rgba(0,0,0,.45);
  display:flex;
  align-items:center;
  justify-content:center;
}

#abc-editor-app .abc-cat-modal {
  width:min(640px,92vw);
  max-height:80vh;
  background:var(--panel);
  color:var(--ink);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  border:1px solid var(--line);
  display:flex;
  flex-direction:column;
  overflow:hidden;
}

#abc-editor-app .abc-cat-header {
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:14px 18px;
  border-bottom:1px solid var(--line);
}

#abc-editor-app .abc-cat-header h3 {
  margin:0;
  font-size:1rem;
}

#abc-editor-app .abc-cat-close {
  background:none;
  border:none;
  font-size:22px;
  cursor:pointer;
  line-height:1;
}

#abc-editor-app #abc-cat-search {
  padding:10px 14px;
  border:none;
  border-bottom:1px solid var(--line);
  font-size:14px;
  outline:none;
}

#abc-editor-app .abc-cat-results {
  padding:8px;
  overflow-y:auto;
}

#abc-editor-app .abc-cat-item {
  display:flex;
  justify-content:space-between;
  align-items:center;
  width:100%;
  padding:8px 10px;
  margin:2px 0;
  border:0;
  background:none;
  border-radius:8px;
  cursor:pointer;
  text-align:left;
}

#abc-editor-app .abc-cat-item:hover {
  background:rgba(0,0,0,.06);
}

#abc-editor-app .abc-cat-item strong {
  font-weight:600;
}

#abc-editor-app .abc-cat-item .cat {
  font-size:.75em;
  opacity:.6;
  margin-left:10px;
}

/* ============================================================
   MOBILE — ≤900px
============================================================ */
@media (max-width:900px) {

  #abc-editor-app {
    width:100%;
    max-width:100%;
    margin:0;
    padding:0 0 24px;
    overflow-x:hidden;
    -webkit-text-size-adjust:100%;
  }

  #abc-editor-app #dock-toggle {
    top:16px;
    left:16px;
  }

  #abc-editor-app #abc-dock {
    position:static;
    width:100%;
    height:auto;
    max-width:100%;
    display:flex;
    gap:18px;
    margin:0;
    padding:0;
    min-width:0;
  }

  #abc-editor-app #abc-dock > *,
  #abc-editor-app .block-controls {
    min-width:0;
    max-width:100%;
  }

  #abc-editor-app #abc-dock:not(.is-open) {
    display:none;
  }

  #abc-editor-app.dock-open {
    padding-left:0;
  }

  #abc-editor-app.dock-open .block-preview {
    position:static;
    height:auto;
    overflow:visible;
    margin:0 0 20px;
  }

  #abc-editor-app .abc-block {
    margin:0 0 20px;
    padding:16px;
    border-radius:0;
  }

  #abc-editor-app #abc-input {
    min-height:260px;
    font-size:16px;
    white-space:pre-wrap;
    overflow-wrap:anywhere;
    word-break:break-word;
  }

  #abc-editor-app #paper {
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
    padding:12px;
  }

  #abc-editor-app .controls-params {
    flex-wrap:wrap;
    margin-left:0;
    width:100%;
    min-width:0;
  }

  #abc-editor-app .controls-actions {
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(44px,54px));
    width:100%;
    min-width:0;
    justify-content:start;
  }

  #abc-editor-app .controls-actions .tb-btn {
    width:100%;
    max-width:54px;
    height:auto;
    aspect-ratio:1;
  }

  #abc-editor-app .param-box {
    display:grid;
    grid-template-columns:repeat(4,minmax(40px,54px));
    justify-content:start;
    width:100%;
    max-width:100%;
    min-width:0;
    gap:8px;
    padding:10px;
  }

  #abc-editor-app .param-box:first-child {
    flex-basis:auto;
  }

  #abc-editor-app .param-box .label,
  #abc-editor-app .param-box:first-child .label {
    grid-column:1 / -1;
    min-width:0;
    white-space:normal;
  }

  #abc-editor-app .param-box .tb-btn {
    width:100%;
    max-width:54px;
    height:auto;
    aspect-ratio:1;
  }

  #abc-editor-app .param-box .chip-val {
    width:100%;
    min-width:0;
    align-self:center;
  }

  /* ============================================================
     FIX MOBILE — CATÁLOGO (anti overflow lateral)
  ============================================================ */

  #abc-editor-app .abc-cat-overlay {
    overflow-x:hidden;
    overscroll-behavior:contain;
  }

  #abc-editor-app .abc-cat-modal {
    width:100%;
    max-width:100%;
    margin:0 12px;
  }

  #abc-editor-app #abc-cat-search {
    width:100%;
    max-width:100%;
    box-sizing:border-box;
  }

  #abc-editor-app .abc-cat-results {
    overflow-x:hidden;
  }

  #abc-editor-app .abc-cat-item {
    max-width:100%;
    overflow:hidden;
  }

  #abc-editor-app .abc-cat-item strong,
  #abc-editor-app .abc-cat-item .cat {
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }
}
