/* Shared layout for the management pages (start dashboard + song editor).
   Loads after style.css and reuses its theme variables. */

body.manage {
  overflow: hidden auto;
  height: auto;
  min-height: 100vh;
  min-height: 100dvh;
}

.manage-main {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 84px 18px 96px;
  padding-left: max(18px, env(safe-area-inset-left));
  padding-right: max(18px, env(safe-area-inset-right));
}

.manage-main .title {
  font-size: 1.7em;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-align: center;
  margin: 0 0 4px;
}

.manage-main .title em {
  color: var(--accent);
  font-style: normal;
  font-weight: 400;
}

.manage-main .subtitle {
  text-align: center;
  color: var(--text-dim);
  margin: 0 0 28px;
}

/* -------- panels & forms -------- */

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--boxShadow);
  padding: 26px 24px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.auth-panel {
  max-width: 380px;
  margin: 10vh auto 0;
}

.manage input[type="text"],
.manage input[type="password"],
.manage input[type="number"] {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(11, 13, 20, 0.25);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1em;
  outline: none;
  transition: var(--ease);
}

body.theme-light.manage input[type="text"],
body.theme-light.manage input[type="password"],
body.theme-light.manage input[type="number"] {
  background: rgba(255, 255, 255, 0.75);
}

.manage input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-error {
  color: var(--live);
  font-size: 0.9em;
  min-height: 1.3em;
  margin: 2px 0 10px;
}

.form-hint {
  color: var(--text-faint);
  font-size: 0.85em;
  margin: -6px 0 12px;
}

.primary-btn {
  display: block;
  width: 100%;
  padding: 13px 18px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--live), #ff5c74);
  color: #fff;
  font-weight: 700;
  font-size: 1em;
  letter-spacing: 0.08em;
  text-align: center;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: var(--ease);
}

.primary-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.primary-btn:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.auth-switch {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.92em;
  margin-top: 18px;
}

.manage a {
  color: var(--accent);
  text-decoration: none;
}

.manage a:hover {
  filter: brightness(1.15);
}

/* -------- dashboard -------- */

.dash-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 18px;
}

.dash-head h2 {
  margin: 0;
  font-size: 1.25em;
  letter-spacing: 0.06em;
}

.dash-head .primary-btn {
  display: inline-block;
  width: auto;
  padding: 10px 16px;
}

.song-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.song-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--boxShadow);
  padding: 16px 18px;
}

.song-title {
  font-weight: 700;
  font-size: 1.08em;
}

.song-meta {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.78em;
  letter-spacing: 0.05em;
  margin-top: 3px;
}

.song-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

a.btn-play,
a.btn-ghost,
button.btn-ghost,
button.btn-danger {
  display: inline-block;
  padding: 9px 14px;
  border-radius: 9px;
  font-size: 0.92em;
  font-weight: 700;
  text-decoration: none !important;
  white-space: nowrap;
  transition: var(--ease);
  background: none;
  cursor: pointer;
}

a.btn-play {
  background: var(--accent);
  color: #0b0d14;
}

a.btn-play:hover {
  filter: brightness(1.1);
}

a.btn-ghost,
button.btn-ghost {
  border: 1px solid var(--line);
  color: var(--text);
}

a.btn-ghost:hover,
button.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  filter: none;
}

button.btn-danger {
  border: 1px solid transparent;
  color: var(--live);
}

button.btn-danger:hover {
  border-color: var(--live);
}

.dash-foot {
  text-align: center;
  margin-top: 22px;
  font-size: 0.92em;
}

.dash-empty {
  text-align: center;
  color: var(--text-dim);
  padding: 40px 10px;
}

.chip-btn {
  font-family: var(--font-mono);
  font-size: 0.72em;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  white-space: nowrap;
  background: rgba(23, 29, 48, 0.55);
  cursor: pointer;
}

.chip-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* -------- editor -------- */

.edit-form .field-row {
  display: flex;
  gap: 14px;
}

.edit-form .field-row label {
  flex: 1;
  font-size: 0.85em;
  color: var(--text-dim);
}

.edit-form .field-row input {
  margin-top: 5px;
}

.loop-details {
  margin: 4px 0 2px;
  color: var(--text-dim);
}

.loop-details summary {
  cursor: pointer;
  font-size: 0.9em;
  padding: 4px 0;
}

.loop-details .field-row {
  margin-top: 10px;
}

.loop-info {
  margin: 8px 0 0;
  font-family: var(--font-mono);
  font-size: 0.8em;
  color: var(--accent);
}

.drop-zone {
  margin: 16px 0;
  border: 2px dashed var(--line);
  border-radius: 16px;
  padding: 22px 18px;
  text-align: center;
  color: var(--text-dim);
  transition: var(--ease);
}

.drop-zone.drag {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.drop-zone p {
  margin: 0 0 8px;
}

.drop-zone code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--text);
}

.drop-zone button.btn-ghost {
  margin-top: 6px;
}

.warn-box {
  position: relative;
  border: 1px solid rgba(255, 196, 0, 0.5);
  background: rgba(255, 196, 0, 0.08);
  color: var(--text-dim);
  border-radius: 10px;
  padding: 8px 34px 8px 12px;
  font-size: 0.82em;
  line-height: 1.5;
  margin: 12px 0;
  max-height: 96px;
  overflow-y: auto;
}

.warn-x {
  position: absolute;
  top: 4px;
  right: 4px;
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 0.9em;
  padding: 4px 7px;
  cursor: pointer;
}

.warn-x:hover {
  color: var(--text);
}

.clickable {
  cursor: pointer;
  transition: var(--ease);
}

.inst-thumb.clickable:hover,
.v-thumb.clickable:hover {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.inst-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0;
}

.inst-panel {
  padding: 14px 16px;
}

.inst-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.inst-thumb {
  width: 46px;
  height: 46px;
  object-fit: contain;
  background: var(--paper);
  border-radius: 9px;
  border: 1px solid var(--line);
}

.inst-label {
  flex: 1;
}

.manage input.inst-label {
  margin-bottom: 0;
  padding: 8px 10px;
}

.inst-id {
  font-family: var(--font-mono);
  font-size: 0.75em;
  color: var(--text-faint);
}

.variant-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 2px;
  border-top: 1px solid var(--line);
  font-size: 0.92em;
}

.v-num {
  font-family: var(--font-mono);
  color: var(--text-faint);
  width: 18px;
  text-align: right;
}

.v-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v-name em {
  color: var(--accent);
  font-style: normal;
  font-size: 0.85em;
}

.v-check {
  font-family: var(--font-mono);
  font-size: 0.8em;
  white-space: nowrap;
}

.v-check.ok { color: #3ddc84; }
.v-check.bad { color: var(--live); }
.v-check.dim { color: var(--text-faint); }

.v-thumb {
  width: 26px;
  height: 26px;
  object-fit: contain;
  background: var(--paper);
  border-radius: 6px;
  border: 1px solid var(--line);
}

.row-x {
  background: none;
  border: 1px solid transparent;
  color: var(--text-faint);
  border-radius: 7px;
  font-size: 0.85em;
  padding: 4px 8px;
  cursor: pointer;
}

.row-x:hover {
  color: var(--live);
  border-color: var(--live);
}

.save-row {
  margin: 8px 0 4px;
}

.save-row .primary-btn {
  padding: 14px 26px;
}

/* upload/processing progress rendered INSIDE the primary button */
.primary-btn.busy {
  opacity: 1;
  cursor: progress;
  transform: none;
  filter: none;
}

.primary-btn.busy.working {
  animation: busyPulse 1.1s ease-in-out infinite;
}

@keyframes busyPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.25); }
}

.danger-row {
  margin-top: 26px;
  text-align: center;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 0.85em;
}

.report-table th,
.report-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
}

.report-table th {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.85em;
}

.done-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 18px;
}

/* -------- drop-zone example graphic -------- */

.drop-demo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 14px 0 10px;
  flex-wrap: wrap;
}

.demo-files {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-end;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.78em;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 4px 9px;
  background: rgba(11, 13, 20, 0.22);
  white-space: nowrap;
}

.file-chip .ic {
  width: 1.25em;
  height: 1.25em;
  color: var(--accent);
  flex: none;
}

.demo-arrow {
  font-size: 1.5em;
  color: var(--accent);
}

.demo-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 16px 8px;
  box-shadow: var(--boxShadow);
}

.demo-tile img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.demo-tile-name {
  font-family: var(--font-mono);
  font-size: 0.7em;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(11, 13, 20, 0.6);
}

.demo-tile-badge {
  font-family: var(--font-mono);
  font-size: 0.66em;
  color: rgba(11, 13, 20, 0.45);
}

/* -------- modal (styled confirm) -------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 7000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 13, 24, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.modal-overlay.open {
  opacity: 1;
}

.modal {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
  padding: 22px 24px;
  max-width: 420px;
  width: 100%;
}

.modal-title {
  margin: 0 0 8px;
  font-size: 1.15em;
  font-weight: 700;
}

.modal-text {
  margin: 0 0 18px;
  color: var(--text-dim);
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

button.modal-danger {
  padding: 9px 16px;
  border-radius: 9px;
  border: none;
  background: var(--live);
  color: #fff;
  font-size: 0.92em;
  font-weight: 700;
  cursor: pointer;
}

button.modal-danger:hover {
  filter: brightness(1.1);
}

@media (max-width: 600px) {
  .song-card {
    flex-direction: column;
    align-items: stretch;
  }
  .song-actions {
    justify-content: flex-end;
  }
  .auth-panel {
    margin-top: 4vh;
  }
  .edit-form .field-row {
    flex-direction: column;
    gap: 0;
  }
  .demo-files {
    align-items: center;
  }
}

/* Desktop-App-Seite (app.html) */
.app-panel {
  max-width: 520px;
}
.app-panel h3 {
  margin: 28px 0 10px;
  font-size: 1.02em;
}
.app-hint {
  color: var(--text-dim);
  font-size: 0.92em;
  margin: 8px 0 0;
}
.app-code {
  font-size: 2em;
  font-weight: 700;
  letter-spacing: 0.14em;
  margin: 14px 0 2px;
  user-select: all;
}
