/* panel-archivos.css: Archivos y música: the upload cards, the audio manager's
   list, drag and drop, the crop editor and the background video.

   GENERATED: do not edit public/panel-archivos.css by hand. It is the files of
   estilos/panel/archivos/ joined in name order by scripts/unir-estilos.mjs, so
   the dashboard still loads one file and the cascade keeps this order. */

/* Media Upload Styling Grid */
.upload-card-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(13, 15, 23, 0.45);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 20px;
  backdrop-filter: blur(8px);
}

/* The card's title with an "ⓘ" holding its size advice (kept out of sight
   so the card is not a wall of text). */
.upload-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding-bottom: 6px;
  margin-bottom: 4px;
}

.upload-title-row .upload-title {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.upload-title {
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding-bottom: 6px;
  margin-bottom: 4px;
}

.upload-preview-card {
  height: 120px;
  border: 2px dashed rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.25);
  transition: all 0.25s;
}

.upload-preview-card:hover {
  border-color: var(--accent-color);
  background: rgba(255, 255, 255, 0.02);
  box-shadow: 0 0 15px rgba(var(--accent-color), 0.03);
}

.upload-preview-card.uploading {
  border-color: #eab308;
  background: rgba(234, 179, 8, 0.02);
  cursor: wait;
}

.upload-card-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  transition: color 0.2s;
  text-align: center;
  padding: 10px;
  z-index: 2;
}

.upload-preview-card:hover .upload-card-content {
  color: var(--text-primary);
}

.upload-card-icon {
  width: 28px;
  height: 28px;
}

.upload-card-text {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.upload-img-preview {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

/* True-size previews: each card shows the image the way the profile does
   (functions/profile.html + the profile rules above), so the user sees the
   real crop before saving. */
/* Once an image is loaded, the upload label only shows on hover or focus,
   so it does not cover the preview. */
.upload-preview-card:has(.upload-img-preview:not(.hidden)) .upload-card-content {
  position: absolute;
  inset: 0;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.2s;
}

.upload-preview-card:has(.upload-img-preview:not(.hidden)):hover .upload-card-content,
.upload-preview-card:has(.upload-img-preview:not(.hidden)):focus-visible .upload-card-content {
  opacity: 1;
}

/* Avatar: the profile's 96px circle (.avatar-container / #profile-avatar),
   in a round card that leaves no empty space around it. */
#upload-preview-avatar {
  width: 112px;
  height: 112px;
  /* auto on every side: centered in the space the taller card next to it
     leaves (#tab-files stretches the two cards of a row to one height). */
  margin: auto;
  border-radius: 50%;
}

#upload-preview-avatar .upload-img-preview {
  top: 50%;
  left: 50%;
  width: 96px;
  height: 96px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid var(--card-border);
}

/* Banner: the card's width (capped like the profile card) by 120px, cover. */
#upload-preview-banner {
  width: min(100%, var(--card-max-width, 480px));
  margin: 0 auto;
}

/* Background: a desktop viewport. */
#upload-preview-bg,
#upload-preview-bgvideo {
  height: auto;
  aspect-ratio: 16 / 9;
  /* Capped so the card (and the avatar card next to it) stays compact. */
  width: min(100%, 320px);
  margin: 0 auto;
}

/* Link preview image: the 1.91:1 card social networks show. */
#upload-preview-metaImage {
  height: auto;
  aspect-ratio: 1.91 / 1;
  width: min(100%, 344px);
  margin: 0 auto;
}

/* Cursor: natural size, centered, never stretched. */
#upload-preview-cursor .upload-img-preview {
  top: 50%;
  left: 50%;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  transform: translate(-50%, -50%);
  object-fit: contain;
}

.upload-delete-btn {
  background: none;
  border: none;
  color: var(--accent-color, #e11d48);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.upload-delete-btn.hidden {
  display: none;
}

.upload-delete-btn svg {
  width: 14px;
  height: 14px;
}

.upload-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  margin-top: 4px;
}

.upload-status {
  color: var(--text-muted);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* Full Width Media Upload row */
.upload-row-full {
  background: rgba(13, 15, 23, 0.45);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  grid-column: span 2;
  width: 100%;
  backdrop-filter: blur(8px);
}

@media (max-width: 992px) {
  .upload-row-full {
    grid-column: span 1;
  }
}

/* Audio manager (public/gestor-audio.js) */
.audio-open-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 18px 20px;
  border: 1px dashed var(--card-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-secondary);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.audio-open-card:hover,
.audio-open-card:focus-visible {
  border-color: var(--accent-color);
  background: rgba(255, 255, 255, 0.04);
}

.audio-open-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  color: var(--accent-color);
}

.audio-open-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.audio-open-text strong {
  color: var(--text-primary);
  font-size: 0.95rem;
}

.audio-open-text span {
  font-size: 0.8rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audio-open-chevron {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--text-muted);
}

.audio-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 0.9rem;
  font-weight: 600;
}

.audio-count {
  color: var(--text-muted);
  font-weight: 500;
}

.audio-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.audio-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 6px;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.2s;
}

.audio-item:hover {
  border-color: rgba(255, 255, 255, 0.16);
}

.audio-item.active {
  border-color: color-mix(in srgb, var(--accent-color) 60%, transparent);
  background: color-mix(in srgb, var(--accent-color) 8%, transparent);
}

.audio-item-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  padding: 4px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.audio-item-cover {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: 9px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-secondary);
}

.audio-item-cover svg {
  width: 22px;
  height: 22px;
}

.audio-item-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.audio-item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.audio-item-text strong {
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audio-item-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audio-item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.audio-active-tag {
  margin-right: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.16);
  color: #4ade80;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.audio-icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  min-width: 32px;
  padding: 0 7px;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.audio-icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

.audio-icon-btn svg {
  width: 17px;
  height: 17px;
}

.audio-icon-btn.danger {
  color: #f87171;
}

.audio-icon-btn.danger:hover,
.audio-icon-btn.danger.armed {
  background: rgba(239, 68, 68, 0.18);
}

/* Drag and drop on an upload card (public/soltar-archivo.js). */
.upload-preview-card.is-dragover {
  border-color: var(--accent-color, #e11d48);
  border-style: solid;
  background: rgba(225, 29, 72, 0.12);
}

.upload-preview-card.is-dragover::after {
  content: "Suelta aquí";
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
}

/* "Recortar imagen" (public/recortar-imagen.js). */
.crop-dialog {
  margin: auto;
  width: min(600px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 20px;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  background: #111218;
  color: var(--text-primary);
}

.crop-dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
}

.crop-head h3 {
  margin: 0 0 12px;
  font-size: 1.1rem;
}

.crop-note {
  margin: 0 0 12px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.crop-stage {
  position: relative;
  height: min(360px, 55vh);
  overflow: hidden;
  border-radius: 12px;
  background: #050608;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.crop-stage.is-dragging {
  cursor: grabbing;
}

.crop-stage:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.35);
  outline-offset: 2px;
}

.crop-dialog.is-animated .crop-stage {
  cursor: default;
}

.crop-img {
  position: absolute;
  top: 50%;
  left: 50%;
  max-width: none;
  pointer-events: none;
  transform-origin: center;
}

/* The frame: everything outside it is dimmed. */
.crop-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid #fff;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.crop-frame.is-round {
  border-radius: 50%;
}

.crop-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.crop-zoom {
  flex: 1;
  accent-color: var(--accent-color, #e11d48);
}

.crop-zoom-icon {
  width: 22px;
  height: 22px;
  flex: none;
  color: var(--text-secondary);
}

.crop-zoom-icon.small {
  width: 15px;
  height: 15px;
}

.crop-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: none;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  cursor: pointer;
}

.crop-icon-btn svg {
  width: 20px;
  height: 20px;
}

.crop-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.crop-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.crop-actions-gap {
  flex: 1;
}

.crop-link-btn {
  padding: 6px 2px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-weight: 600;
  cursor: pointer;
}

.crop-link-btn:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

/* Archivos → Video de fondo: "Ajustes" next to "Eliminar", and the
   settings window (public/video-fondo-panel.js). */
.upload-footer-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.upload-settings-btn {
  color: var(--text-secondary);
}

.bgvideo-sound {
  display: grid;
  gap: 8px;
}

.bgvideo-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--card-border, rgba(255, 255, 255, 0.08));
  border-radius: 10px;
  cursor: pointer;
}

.bgvideo-option:has(input:checked) {
  border-color: var(--accent-color, #e11d48);
  background: rgba(225, 29, 72, 0.08);
}

.bgvideo-option input {
  margin-top: 3px;
  accent-color: var(--accent-color, #e11d48);
}

.bgvideo-option span {
  display: grid;
  gap: 2px;
}

.bgvideo-option small {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.bgvideo-title-field {
  margin: 4px 0 0;
  gap: 6px;
}

.bgvideo-title-field label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

#input-bgvideo-title {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.88rem;
  margin: 0;
}

#input-bgvideo-title:focus {
  border-color: var(--accent-color);
  outline: none;
  background: rgba(255, 255, 255, 0.05);
}

@keyframes chart-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes infoTipIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes search-hit {
  0%, 30% { box-shadow: 0 0 0 3px var(--accent-color, #e11d48); }
  100% { box-shadow: 0 0 0 3px transparent; }
}

/* Archivos y música as an even grid: every upload card the same size, its
   state ("Vacío", "✓ Subido") as a chip next to its title, the image area the
   same height in each, and the songs as one more card. */
#tab-files {
  container: archivos / inline-size;
}

/* Columns of at least 250 px (gap 28 px). With four, Cursor sits alone under
   the first row: Música takes the other three columns, so the row has no
   hole and the song names fit. */
#tab-files .settings-grid-layout {
  grid-template-columns: minmax(0, 1fr);
}

@container archivos (min-width: 528px) {
  #tab-files .settings-grid-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@container archivos (min-width: 806px) {
  #tab-files .settings-grid-layout {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@container archivos (min-width: 1084px) {
  #tab-files .settings-grid-layout {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  #tab-files .upload-music-card {
    grid-column: span 3;
  }
}

#tab-files .upload-card-wrapper {
  gap: 12px;
}

#tab-files .upload-title-row .upload-status {
  margin-left: auto;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  font-size: 0.72rem;
}

#tab-files .upload-title-row .upload-status:empty {
  display: none;
}

/* uploads.js and video-fondo-subida.js mark done/error chips with data-state. */
#tab-files .upload-title-row .upload-status[data-state="ok"] {
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
}

#tab-files .upload-title-row .upload-status[data-state="error"] {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
}

#tab-files .upload-preview-card {
  width: 100%;
  height: 150px;
  aspect-ratio: auto;
  margin: 0;
}

#tab-files #upload-preview-avatar {
  width: 128px;
  height: 128px;
  margin: 11px auto;
}

#tab-files #upload-preview-avatar .upload-img-preview {
  width: 112px;
  height: 112px;
}

#tab-files .upload-card-footer {
  margin-top: auto;
  justify-content: flex-end;
  gap: 8px;
}

#tab-files .upload-card-footer:not(:has(button:not(.hidden))) {
  display: none;
}

#tab-files .upload-delete-btn {
  padding: 6px 10px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  color: #f87171;
  text-transform: none;
  letter-spacing: normal;
}

#tab-files .upload-delete-btn:hover {
  background: rgba(239, 68, 68, 0.12);
}

#tab-files .upload-settings-btn {
  border-color: var(--card-border);
  color: var(--text-secondary);
}

#tab-files .upload-settings-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* The songs: the first few, then the button to the audio manager. */
.music-card-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.music-card-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 10px;
}

.music-card-item.active {
  background: rgba(255, 255, 255, 0.05);
}

.music-card-cover {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
}

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

.music-card-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

/* A long title gets two lines before it is cut. */
.music-card-text strong {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow-wrap: anywhere;
}

.music-card-artist {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-card-text strong {
  color: var(--text-primary);
  font-size: 0.85rem;
}

.music-card-artist {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.music-card-tag {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-weight: 600;
}

.music-card-tag.is-synced {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
}

.music-card-more {
  padding: 0 8px;
  color: var(--text-muted);
  font-size: 0.75rem;
}

#tab-files .upload-music-card .audio-open-card {
  margin-top: auto;
  padding: 12px 14px;
}
