/* File menu and the name prompt — warp web's first popup and first modal.
   Uses only the :root custom properties from style.css, so the two stay in
   step: --bg --panel --edge --text --dim --accent --error --warn. */

/* --- the menu ------------------------------------------------------------- */

/* shared by the File and Output menus */
.menu {
  position: relative;
  display: inline-flex;
}

.menu-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 40;
  min-width: 232px;
  padding: 5px;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}

.menu-pop[hidden] { display: none; }

.menu-pop hr {
  border: 0;
  border-top: 1px solid var(--edge);
  margin: 5px 4px;
}

.menu-pop .menu-head {
  padding: 5px 10px 3px;
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  /* --dim, not --edge: --edge is the BORDER colour and sits at 1.25:1 on
     --panel, which is invisible. --dim is 5.20:1. */
  color: var(--dim);
}

/* menu items are buttons, so they reuse the app's focus and disabled handling,
   but must not look like the chrome's pill buttons */
.menu-pop .menu-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
  padding: 6px 10px;
  background: none;
  border: 1px solid transparent;
  border-radius: 5px;
  font-size: 13px;
  color: var(--text);
  text-align: left;
}

.menu-pop .menu-item:hover:not(:disabled) {
  background: var(--accent);
  color: #10231a;
  border-color: transparent;
}

.menu-pop .menu-item:hover:not(:disabled) .accel { color: #10231a; opacity: 0.7; }

.menu-pop .menu-item:disabled { opacity: 0.35; }

.menu-pop .accel {
  font-size: 11px;
  color: var(--dim);
  white-space: nowrap;
}

/* the Output menu holds live controls (a select, a checkbox), not menu items */
.menu-pop .menu-row {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 4px 6px 6px;
}

.menu-pop .menu-row select { width: 100%; }

.menu-pop label.toggle { padding: 2px 4px; }

.menu-pop .menu-note {
  padding: 0 6px 4px;
  font-size: 11px;
  color: var(--dim);
  max-width: 250px;
}

/* --- the name prompt ------------------------------------------------------ */

#name-dialog {
  padding: 0;
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  min-width: 340px;
  max-width: 90vw;
}

/* no dialog::backdrop precedent in the app — set it explicitly */
#name-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }

#name-dialog form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px 14px;
}

#name-dialog h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.04em;
}

#name-input {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 7px 10px;
  font: inherit;
  font-size: 13px;
}

#name-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* reserves its line so the dialog does not jump as the hint appears */
#name-hint {
  margin: 0;
  min-height: 1.2em;
  font-size: 11px;
  color: var(--dim);
}

#name-hint.warn { color: var(--warn); }

#name-dialog .row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 2px;
}

#name-dialog button.primary {
  background: var(--accent);
  color: #10231a;
  font-weight: 600;
  border-color: transparent;
}

#name-dialog button.primary:disabled { opacity: 0.4; }

/* --- the Open dialog ------------------------------------------------------ */

#open-dialog {
  padding: 0;
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  width: min(680px, 92vw);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
}

#open-dialog:not([open]) { display: none; }
#open-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }

.open-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px 11px 18px;
  border-bottom: 1px solid var(--edge);
}

.open-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

#open-filter {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 5px 9px;
  font: inherit;
  font-size: 12px;
}

#open-filter:focus { outline: none; border-color: var(--accent); }

#open-close {
  padding: 3px 9px;
  font-size: 13px;
  line-height: 1.2;
}

#open-list {
  overflow-y: auto;
  padding: 6px;
  flex: 1;
}

/* These organize the whole list, so they need to be legible, not decorative:
   10px uppercase in the border colour was 1.25:1 on --panel. */
.open-group {
  padding: 13px 10px 5px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--dim);
}

/* no dead space above the first group */
#open-list > .open-group:first-child { padding-top: 6px; }

/* a row is a flex line: the big open button, then the per-file affordances */
.song-row {
  display: flex;
  align-items: center;
  gap: 4px;
  border-radius: 6px;
}

.song-row:hover { background: rgba(255, 255, 255, 0.04); }

.song-open {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 10px;
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  text-align: left;
  color: var(--text);
}

.song-open:hover { border-color: var(--accent); }

.song-name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
}

/* the metadata line is the whole point of the dialog — never let it wrap into
   a wall, but never truncate it to uselessness either */
.song-meta {
  font-size: 11px;
  color: var(--dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.song-row.broken .song-meta { color: var(--error); }

.badge {
  font-size: 9.5px;
  padding: 1px 5px;
  border-radius: 999px;
  border: 1px solid currentColor;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge.yaml, .badge.warp { color: var(--error); }
.badge.warn { color: var(--warn); }

.song-when {
  font-size: 11px;
  color: var(--dim);
  white-space: nowrap;
  padding-right: 2px;
}

.song-del {
  padding: 4px 8px;
  background: none;
  border: 1px solid transparent;
  font-size: 12px;
  opacity: 0;
}

.song-row:hover .song-del { opacity: 0.55; }
.song-del:hover { opacity: 1; border-color: var(--error); }

.open-empty {
  margin: 0;
  padding: 26px 14px;
  text-align: center;
  font-size: 12px;
  color: var(--dim);
}

.open-foot {
  padding: 9px 16px;
  border-top: 1px solid var(--edge);   /* --edge IS right for a border */
  font-size: 11px;
  color: var(--dim);
}
