*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #020617;
  color: #e5e7eb;
}

body {
  display: flex;
  flex-direction: column;
}

/* Header y navegación */

.app-header {
  padding: 12px 16px 8px 16px;
  border-bottom: 1px solid #111827;
  background: radial-gradient(circle at top, #111827 0, #020617 55%);
  position: sticky;
  top: 0;
  z-index: 40;
}

.app-header h1 {
  margin: 0 0 8px 0;
  font-size: 22px;
  letter-spacing: 0.04em;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.artist-nav {
  flex: 1;
  overflow-x: auto;
}

#nav-artists {
  list-style: none;
  display: flex;
  gap: 6px;
  padding: 0;
  margin: 0;
}

#nav-artists li {
  flex: 0 0 auto;
}

#nav-artists button {
  border-radius: 9999px;
  border: 1px solid #1f2937;
  padding: 4px 10px;
  background: #020617;
  color: #e5e7eb;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

#nav-artists button.active {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.top-buttons {
  display: flex;
  gap: 6px;
}

.top-buttons button {
  border-radius: 9999px;
  border: 1px solid #1f2937;
  padding: 4px 12px;
  background: #020617;
  color: #e5e7eb;
  font-size: 13px;
  cursor: pointer;
}

.top-buttons button.active {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.top-buttons button[disabled] {
  opacity: 0.45;
  cursor: default;
}

.hidden {
  display: none !important;
}

/* Player bar */

#player-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0 2px 0;
  font-size: 12px;
}

#player-bar button {
  border-radius: 9999px;
  border: 1px solid #1f2937;
  padding: 3px 8px;
  background: #020617;
  color: #e5e7eb;
  cursor: pointer;
}

.player-title {
  margin-left: 4px;
  margin-right: 6px;
  max-width: 260px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  font-size: 13px;
}

#player-seek {
  flex: 1;
}

.time-label {
  min-width: 80px;
  text-align: center;
}

.volume-label {
  font-size: 14px;
  margin-left: 4px;
  margin-right: 2px;
}

#player-volume {
  width: 80px;
}

/* Main */

#main {
  flex: 1;
  padding: 10px 16px 24px 16px;
  position: relative;
}

/* Capa de medios */

#artist-sections {
  position: relative;
  min-height: 400px;
}

/* Cada artista en pantalla ocupa la zona de medios */

.artist-section {
  position: relative;
  width: 100%;
  min-height: 300px;
}

/* Panel flotante de edición, separado de la capa de medios */

.artist-editor {
  border: 1px solid #1f2937;
  border-radius: 12px;
  padding: 12px;
  background: #020617;
  position: fixed;
  left: 32px;
  top: 110px;
  width: min(900px, calc(100% - 64px));
  max-height: calc(100vh - 150px);
  overflow: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  z-index: 35;
}

/* Cabecera del editor */

.artist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.artist-header-left {
  flex: 1;
}

.artist-name-input {
  width: 100%;
  border-radius: 8px;
  border: 1px solid #111827;
  background: #020617;
  color: #e5e7eb;
  padding: 4px 8px;
  font-size: 15px;
}

.artist-header-right {
  display: flex;
  gap: 6px;
}

.artist-header-right button {
  border-radius: 9999px;
  border: 1px solid #1f2937;
  padding: 4px 10px;
  background: #020617;
  color: #e5e7eb;
  font-size: 12px;
  cursor: pointer;
}

/* Lista de pistas dentro del editor */

.track-list {
  margin-top: 6px;
  border-top: 1px solid #111827;
  padding-top: 6px;
}

.track-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}

.track-row.track-hidden {
  opacity: 0.45;
}

.track-title-input {
  width: 100%;
  border-radius: 6px;
  border: 1px solid #111827;
  background: #020617;
  color: #e5e7eb;
  padding: 3px 6px;
  font-size: 13px;
}

.track-play {
  border-radius: 9999px;
  border: 1px solid #1f2937;
  padding: 2px 6px;
  background: #020617;
  color: #e5e7eb;
  cursor: pointer;
}

.track-actions {
  display: flex;
  gap: 4px;
}

.track-actions button {
  border-radius: 9999px;
  border: 1px solid #1f2937;
  padding: 2px 6px;
  background: #020617;
  color: #e5e7eb;
  font-size: 11px;
  cursor: pointer;
}

/* Botones del editor */

.artist-tools {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.artist-tools button {
  border-radius: 9999px;
  border: 1px solid #1f2937;
  padding: 4px 10px;
  background: #020617;
  color: #e5e7eb;
  font-size: 12px;
  cursor: pointer;
}

/* Capa de imágenes flotantes (medios) */

.float-layer {
  position: relative;
  margin-bottom: 8px;
  min-height: 40px;
}

/* En edición se ve el marco y el fondo del contenedor */

.float-layer.editing {
  border-radius: 10px;
  border: 1px dashed #1f2937;
  padding: 8px;
  min-height: 80px;
  background: radial-gradient(circle at top left, #020617 0, #020617 40%, #020617 100%);
}

.float-layer-title {
  font-size: 11px;
  opacity: 0.7;
  margin-bottom: 4px;
}

/* Imágenes flotantes */

.float-img {
  position: absolute;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #1f2937;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.55);
}

.float-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.float-resize-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  right: -7px;
  bottom: -7px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #020617;
  cursor: nwse-resize;
}

/* Imagen seleccionada para borrar con Supr */

.float-selected {
  outline: 2px solid #e5e7eb;
  outline-offset: 2px;
}

/* Ventanas de texto flotantes */

.text-box {
  position: absolute;
  border-radius: 12px;
  border: 1px solid #1f2937;
  background: rgba(15, 23, 42, 0.96);
  color: #e5e7eb;
  padding: 6px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.55);
  max-width: 640px;
  min-width: 200px;
  min-height: 100px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 60;
}

.text-box-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 2px;
}

.text-box-toolbar button {
  border-radius: 9999px;
  border: 1px solid #1f2937;
  padding: 2px 6px;
  background: #020617;
  color: #e5e7eb;
  font-size: 11px;
  cursor: pointer;
}

.text-box-toolbar input[type="color"],
.text-box-toolbar select {
  border-radius: 9999px;
  border: 1px solid #1f2937;
  padding: 1px 4px;
  background: #020617;
  color: #e5e7eb;
  font-size: 11px;
  cursor: pointer;
}

.text-box-content {
  min-height: 70px;
  font-size: 13px;
  line-height: 1.4;
  outline: none;
  border-radius: 8px;
  border: 1px solid #111827;
  padding: 6px 8px;
  background: rgba(15, 23, 42, 0.98);
  overflow: auto;
}

.text-box-selected {
  outline: 2px solid #e5e7eb;
  outline-offset: 2px;
}

/* Texto estático cuando no se edita */

.text-box-static {
  position: absolute;
  color: #e5e7eb;
  max-width: 640px;
  min-width: 200px;
  min-height: 30px;
  font-size: 13px;
  line-height: 1.4;
  z-index: 20;
}

.text-box-static-inner {
  pointer-events: none;
}

/* Handler de tamaño del editor */

.artist-resize-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  right: -7px;
  bottom: -7px;
  border-radius: 50%;
  border: 1px solid #e5e7eb;
  background: #020617;
  cursor: nwse-resize;
}

/* Vídeos en la capa de medios, también flotantes */

.video-list {
  position: relative;
  margin-top: 10px;
  min-height: 120px;
}

/* Solo en edición se marca como bloque de vídeos */

.video-list.editing {
  border-top: 1px solid #111827;
  padding-top: 8px;
}

.video-header {
  font-size: 13px;
  margin-bottom: 4px;
  opacity: 0.85;
}

.video-box {
  position: absolute;
  border-radius: 12px;
  border: 1px solid #111827;
  background: #020617;
  padding: 4px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.55);
}

.video-preview {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  border: 1px solid #111827;
  background: #020617;
}

.video-meta {
  font-size: 11px;
  margin-top: 4px;
}

.video-title-input {
  width: 100%;
  border-radius: 6px;
  border: 1px solid #111827;
  background: #020617;
  color: #e5e7eb;
  padding: 3px 6px;
  font-size: 12px;
}

.video-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.video-actions button {
  border-radius: 9999px;
  border: 1px solid #1f2937;
  padding: 2px 6px;
  background: #020617;
  color: #e5e7eb;
  font-size: 11px;
  cursor: pointer;
}

/* SLIM 500x500 flotante por artista */

.slim-box {
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 16px;
  border: 1px solid #1f2937;
  overflow: hidden;
  background: #020617;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.65);
}

.slim-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.slim-nav {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}

.slim-nav button {
  border-radius: 9999px;
  border: 1px solid #1f2937;
  padding: 2px 8px;
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  font-size: 11px;
  cursor: pointer;
}

/* Panel de letras */

.lyrics-panel {
  position: fixed;
  left: 40px;
  top: 140px;
  width: 360px;
  max-width: calc(100% - 40px);
  max-height: calc(100vh - 160px);
  background: #020617;
  border-radius: 12px;
  border: 1px solid #1f2937;
  box-shadow: 0 20px 40px rgba(0,0,0,0.7);
  display: flex;
  flex-direction: column;
  z-index: 40;
}

.lyrics-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px;
  border-bottom: 1px solid #111827;
  cursor: move;
}

.lyrics-title {
  font-size: 13px;
}

.lyrics-header-buttons {
  display: flex;
  gap: 4px;
}

.lyrics-header-buttons button {
  border-radius: 9999px;
  border: 1px solid #1f2937;
  padding: 2px 8px;
  background: #020617;
  color: #e5e7eb;
  font-size: 11px;
  cursor: pointer;
}

.lyrics-body {
  padding: 6px 8px 8px 8px;
  flex: 1;
}

#lyrics-text {
  width: 100%;
  height: 260px;
  border-radius: 8px;
  border: 1px solid #111827;
  background: #020617;
  color: #e5e7eb;
  padding: 6px 8px;
  font-size: 13px;
  resize: vertical;
}

/* Toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  background: rgba(15,23,42,0.95);
  border-radius: 9999px;
  border: 1px solid #1f2937;
  padding: 6px 14px;
  font-size: 12px;
  z-index: 50;
}

/* Responsive */

@media (max-width: 720px) {
  .artist-editor {
    left: 8px;
    top: 120px;
    width: calc(100% - 16px);
    max-height: calc(100vh - 130px);
  }

  #player-title {
    max-width: 180px;
  }

  .slim-box {
    width: 320px;
    height: 320px;
  }
}

/* Header spacing for subscribe button */
.app-header #subscribeButton{margin-left:8px}
