/* =========================================================================
   Panel de administración
   ========================================================================= */

:root {
  --fondo:       #0c0c0d;
  --tarjeta:     #151517;
  --tarjeta-alt: #1c1c1f;
  --texto:       #e8e6e3;
  --tenue:       #8d8a86;
  --linea:       rgba(232, 230, 227, 0.13);
  --verde:       #5fd39a;
  --rojo:        #ff6b6b;
  --margen:      clamp(1.1rem, 3.5vw, 3rem);
  --suave:       cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: inherit; }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

input, textarea, select { font: inherit; }

:focus-visible { outline: 2px solid var(--texto); outline-offset: 2px; }

.etiqueta {
  margin: 0;
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--tenue);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.86em;
  background: var(--tarjeta-alt);
  padding: 0.12em 0.4em;
  border-radius: 4px;
}

/* ------------------------------------------------- Pantalla de entrada */
.entrada {
  display: grid;
  place-items: center;
  min-height: 100svh;
  padding: 2rem 1.25rem;
}

.tarjeta {
  width: 100%;
  max-width: 420px;
  background: var(--tarjeta);
  border: 1px solid var(--linea);
  border-radius: 18px;
  padding: clamp(1.75rem, 5vw, 2.75rem);
}

.tarjeta h1 {
  margin: 0.9rem 0 0.6rem;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.ayuda {
  margin: 0 0 1.75rem;
  font-size: 0.88rem;
  color: var(--tenue);
  line-height: 1.6;
}

.volver {
  margin: 1.75rem 0 0;
  font-size: 0.85rem;
  color: var(--tenue);
}
.volver a { text-decoration: none; }
.volver a:hover { color: var(--texto); }

/* --------------------------------------------------- Campos y botones */
label {
  display: block;
  margin-bottom: 1.1rem;
  font-size: 0.86rem;
  font-weight: 500;
}
label small {
  font-weight: 400;
  color: var(--tenue);
}

input[type="text"], input[type="password"], input[type="email"], textarea {
  display: block;
  width: 100%;
  margin-top: 0.45rem;
  padding: 0.7rem 0.85rem;
  background: var(--fondo);
  border: 1px solid var(--linea);
  border-radius: 10px;
  color: var(--texto);
  font-size: 0.92rem;
  font-weight: 400;
  transition: border-color 0.25s var(--suave), background 0.25s var(--suave);
}
input:focus, textarea:focus {
  border-color: rgba(232, 230, 227, 0.45);
  outline: none;
}
textarea { resize: vertical; line-height: 1.6; }

::placeholder { color: rgba(141, 138, 134, 0.7); }

.boton {
  display: inline-block;
  padding: 0.72rem 1.5rem;
  background: var(--texto);
  color: var(--fondo);
  border-radius: 100px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: transform 0.25s var(--suave), opacity 0.25s var(--suave);
}
.boton:hover { transform: translateY(-1px); opacity: 0.9; }
.boton:disabled { opacity: 0.45; pointer-events: none; }

.enlace {
  padding: 0;
  color: var(--texto);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ------------------------------------------------------------- Avisos */
.aviso {
  margin: 0 0 1.25rem;
  padding: 0.8rem 1rem;
  border-radius: 10px;
  font-size: 0.86rem;
  line-height: 1.55;
}
.aviso--mal  { background: rgba(255, 107, 107, 0.12); color: #ffb3b3; border: 1px solid rgba(255,107,107,0.3); }
.aviso--bien { background: rgba(95, 211, 154, 0.12);  color: #a8e9c9; border: 1px solid rgba(95,211,154,0.3); }
.aviso--ancho { margin: 0 var(--margen) 1.25rem; }

.estado {
  font-size: 0.84rem;
  color: var(--tenue);
  transition: color 0.25s var(--suave);
}
.estado--bien { color: var(--verde); }
.estado--mal  { color: var(--rojo); }

/* ------------------------------------------------------------ Cabecera */
.cabecera {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: 2rem var(--margen) 1.5rem;
}
.cabecera h1 {
  margin: 0.35rem 0 0;
  font-size: clamp(1.5rem, 3.5vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}
.cabecera__acciones {
  display: flex;
  gap: 1.5rem;
  font-size: 0.88rem;
  color: var(--tenue);
}
.cabecera__acciones a { text-decoration: none; }
.cabecera__acciones a:hover { color: var(--texto); }

/* ------------------------------------------------------------ Pestañas */
.pestanas {
  display: flex;
  gap: 0.4rem;
  padding: 0 var(--margen);
  border-bottom: 1px solid var(--linea);
  overflow-x: auto;
}

.pestana {
  padding: 0.7rem 1rem;
  font-size: 0.9rem;
  color: var(--tenue);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.25s var(--suave), border-color 0.25s var(--suave);
}
.pestana:hover { color: var(--texto); }
.pestana.activa { color: var(--texto); border-bottom-color: var(--texto); }

.panel-seccion {
  display: none;
  padding: clamp(1.5rem, 4vw, 2.5rem) var(--margen) 5rem;
  max-width: 1100px;
}
.panel-seccion.activa { display: block; }

/* --------------------------------------------------- Zona para soltar */
.soltar {
  display: grid;
  place-items: center;
  min-height: 210px;
  padding: 2rem 1.25rem;
  border: 1.5px dashed var(--linea);
  border-radius: 16px;
  text-align: center;
  transition: border-color 0.25s var(--suave), background 0.25s var(--suave);
}
.soltar.encima {
  border-color: var(--texto);
  background: rgba(232, 230, 227, 0.05);
}

.soltar__titulo {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.soltar__ayuda { margin: 0 0 0.9rem; font-size: 0.9rem; color: var(--tenue); }
.soltar__nota {
  margin: 0;
  max-width: 52ch;
  font-size: 0.78rem;
  line-height: 1.55;
  color: rgba(141, 138, 134, 0.75);
}

/* ------------------------------------------------------ Cola de subida */
.cola {
  display: grid;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.subiendo {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.7rem 0.95rem;
  background: var(--tarjeta);
  border: 1px solid var(--linea);
  border-radius: 10px;
  font-size: 0.85rem;
}
.subiendo__nombre {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.subiendo__estado { color: var(--tenue); font-size: 0.8rem; white-space: nowrap; }
.subiendo__estado.mal  { color: var(--rojo); white-space: normal; }
.subiendo__estado.bien { color: var(--verde); }
.subiendo__barra {
  grid-column: 1 / -1;
  height: 3px;
  border-radius: 3px;
  background: rgba(232, 230, 227, 0.12);
  overflow: hidden;
}
.subiendo__barra i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--texto);
  transition: width 0.2s linear;
}

/* --------------------------------------------------------- Lista fotos */
.barra-herramientas {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--linea);
}

.lista-fotos { display: grid; gap: 0.6rem; }

.ficha {
  display: grid;
  grid-template-columns: 26px 128px minmax(0, 1fr) auto;
  align-items: start;
  gap: 1rem;
  padding: 0.85rem;
  background: var(--tarjeta);
  border: 1px solid var(--linea);
  border-radius: 12px;
  transition: border-color 0.2s var(--suave), opacity 0.2s var(--suave),
              background 0.2s var(--suave);
}
.ficha:hover { border-color: rgba(232, 230, 227, 0.28); }
.ficha.arrastrando { opacity: 0.35; }
.ficha.destino { border-color: var(--texto); background: var(--tarjeta-alt); }
.ficha.saliendo {
  opacity: 0;
  transform: translateX(-12px);
  transition: opacity 0.25s var(--suave), transform 0.25s var(--suave);
}

.ficha__arrastre {
  align-self: center;
  color: var(--tenue);
  font-size: 1.1rem;
  text-align: center;
  cursor: grab;
  user-select: none;
}
.ficha__arrastre:active { cursor: grabbing; }

.ficha__miniatura {
  width: 128px;
  height: 96px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--tarjeta-alt);
}

.ficha__campos { display: grid; gap: 0.45rem; min-width: 0; }

.campo {
  width: 100%;
  margin: 0;
  padding: 0.5rem 0.65rem;
  background: var(--fondo);
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--texto);
  font-size: 0.86rem;
}
.campo:hover { border-color: var(--linea); }
.campo:focus { border-color: rgba(232, 230, 227, 0.45); outline: none; }
.campo--corto { max-width: 260px; }

.ficha__botones {
  display: grid;
  grid-template-columns: auto auto;
  gap: 0.4rem;
  align-content: start;
}
/* Los botones de "Portada" y "Borrar" ocupan el ancho de las dos flechas. */
.ficha__botones .mini:nth-child(n + 3) { grid-column: 1 / -1; }

.mini {
  padding: 0.42rem 0.75rem;
  border: 1px solid var(--linea);
  border-radius: 8px;
  font-size: 0.78rem;
  color: var(--tenue);
  white-space: nowrap;
  transition: color 0.2s var(--suave), border-color 0.2s var(--suave), background 0.2s var(--suave);
}
.mini:hover { color: var(--texto); border-color: rgba(232, 230, 227, 0.4); }
.mini--activo {
  background: var(--texto);
  border-color: var(--texto);
  color: var(--fondo);
}
.mini--peligro:hover { color: var(--rojo); border-color: rgba(255, 107, 107, 0.5); }

.vacio-lista {
  margin: 2rem 0;
  color: var(--tenue);
  font-size: 0.9rem;
}

/* ---------------------------------------------------------- Formularios */
.formulario { max-width: 720px; }
.formulario--angosto { max-width: 420px; }

.formulario__par {
  display: grid;
  gap: 0 1rem;
  grid-template-columns: 1fr;
}

.formulario__pie {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;
}

.separador-form {
  margin: 2rem 0 1.75rem;
  border: 0;
  border-top: 1px solid var(--linea);
}

.formulario select {
  display: block;
  width: 100%;
  margin-top: 0.45rem;
  padding: 0.7rem 0.85rem;
  background: var(--fondo);
  border: 1px solid var(--linea);
  border-radius: 10px;
  color: var(--texto);
  font-size: 0.92rem;
  cursor: pointer;
}

@media (min-width: 640px) {
  .formulario__par { grid-template-columns: 1fr 1fr; }
}

/* ------------------------------------------- Año / ubicación / serie */
.ficha__trio {
  display: grid;
  grid-template-columns: 88px minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 0.45rem;
}

/* ===================================================================
   BLOG — lista de entradas y editor
   =================================================================== */

.entradas { display: grid; gap: 0.6rem; }

.tarjeta-entrada {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 1rem;
  padding: 1.1rem 1.15rem;
  background: var(--tarjeta);
  border: 1px solid var(--linea);
  border-radius: 12px;
  transition: border-color 0.2s var(--suave);
}
.tarjeta-entrada:hover { border-color: rgba(232, 230, 227, 0.28); }

.tarjeta-entrada h3 {
  margin: 0.45rem 0 0.35rem;
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.tarjeta-entrada__resumen {
  margin: 0;
  font-size: 0.86rem;
  color: var(--tenue);
  line-height: 1.55;
}

.tarjeta-entrada__botones {
  display: grid;
  gap: 0.4rem;
  align-content: start;
}
.tarjeta-entrada__botones .mini { text-align: center; text-decoration: none; }

.estado-pub { color: var(--tenue); letter-spacing: 0.22em; }
.estado-pub--si { color: var(--verde); }

/* -------------------------------------------------- Campos del editor */
.campo-editor {
  display: block;
  margin-bottom: 1.35rem;
  font-size: 0.86rem;
  font-weight: 500;
}
.campo-editor small { font-weight: 400; color: var(--tenue); }

.campo-editor__nombre { display: block; margin-bottom: 0.45rem; }

.campo-editor input[type="text"],
.campo-editor input[type="date"],
.campo-editor select,
.campo-editor textarea {
  display: block;
  width: 100%;
  margin-top: 0.45rem;
  padding: 0.7rem 0.85rem;
  background: var(--fondo);
  border: 1px solid var(--linea);
  border-radius: 10px;
  color: var(--texto);
  font-size: 0.92rem;
}
.campo-editor select { cursor: pointer; }

#entradaTitulo {
  font-size: 1.25rem !important;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.editor__fila {
  display: grid;
  gap: 0 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .editor__fila { grid-template-columns: 1fr 1fr; }
}

/* ----------------------------------------------------- Barra de formato */
.herramientas {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  padding: 0.4rem 0.5rem;
  background: var(--tarjeta);
  border: 1px solid var(--linea);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  position: sticky;
  top: 0;
  z-index: 5;
}

.herramienta {
  min-width: 34px;
  height: 30px;
  padding: 0 0.5rem;
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--tenue);
  transition: color 0.15s var(--suave), background 0.15s var(--suave);
}
.herramienta:hover { color: var(--texto); background: rgba(232, 230, 227, 0.08); }

.herramientas__sep {
  width: 1px;
  height: 18px;
  margin: 0 0.3rem;
  background: var(--linea);
}

/* ------------------------------------------------- Área de escritura */
.editor {
  min-height: 320px;
  padding: 1.4rem 1.5rem;
  background: var(--fondo);
  border: 1px solid var(--linea);
  border-radius: 0 0 10px 10px;
  font-size: 1rem;
  line-height: 1.75;
  outline: none;
  overflow-wrap: break-word;
}
.editor:focus { border-color: rgba(232, 230, 227, 0.4); }

.editor--vacio::before {
  content: attr(data-marcador);
  color: rgba(141, 138, 134, 0.6);
  pointer-events: none;
}

.editor > *:first-child { margin-top: 0; }
.editor p { margin: 0 0 1em; }
.editor h2 {
  margin: 1.6em 0 0.5em;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.editor h3 {
  margin: 1.4em 0 0.45em;
  font-size: 1.13rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.editor blockquote {
  margin: 1.4em 0;
  padding-left: 1.1rem;
  border-left: 2px solid var(--linea);
  color: var(--tenue);
  font-style: italic;
}
.editor ul, .editor ol { margin: 0 0 1em; padding-left: 1.4rem; }
.editor li { margin-bottom: 0.35em; }
.editor a { color: var(--texto); text-decoration: underline; text-underline-offset: 3px; }
.editor hr { margin: 2em 0; border: 0; border-top: 1px solid var(--linea); }

.editor__cuenta {
  margin: 0.55rem 0 0;
  font-size: 0.78rem;
  color: var(--tenue);
  font-variant-numeric: tabular-nums;
}

.herramienta--ancha { font-size: 0.8rem; padding: 0 0.7rem; }

/* Las fotos, dentro del editor, se ven como se verán en el sitio. */
.editor img {
  display: block;
  max-width: 100%;
  max-height: 60vh;
  width: auto;
  height: auto;
  margin: 1.5em auto;
  border-radius: 4px;
}

/* ------------------------------------------------- Selector de fotos */
body.sin-scroll { overflow: hidden; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: rgba(8, 8, 9, 0.8);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal[hidden] { display: none; }

.modal__caja {
  width: 100%;
  max-width: 780px;
  max-height: 86vh;
  overflow-y: auto;
  padding: clamp(1.25rem, 3vw, 1.85rem);
  background: var(--tarjeta);
  border: 1px solid var(--linea);
  border-radius: 16px;
}

.modal__cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.modal__cabecera h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.modal__cerrar {
  width: 36px;
  height: 36px;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--tenue);
  border-radius: 8px;
  transition: color 0.2s var(--suave), background 0.2s var(--suave);
}
.modal__cerrar:hover { color: var(--texto); background: rgba(232, 230, 227, 0.08); }

.modal__subir {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem 1rem;
  padding-bottom: 1.35rem;
  border-bottom: 1px solid var(--linea);
}
.modal__nota {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--tenue);
}

.modal__titulo-lista { margin: 1.35rem 0 0.85rem; }

.modal__rejilla {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 0.55rem;
}

.modal__foto {
  position: relative;
  padding: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--linea);
  border-radius: 8px;
  background: var(--tarjeta-alt);
  cursor: pointer;
  transition: border-color 0.2s var(--suave), transform 0.2s var(--suave);
}
.modal__foto:hover { border-color: var(--texto); transform: translateY(-2px); }
.modal__foto img { width: 100%; height: 100%; object-fit: cover; }

/* ------------------------------------------- Foto de portada del blog */
.portada-elegida {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.55rem;
}

.portada-elegida__vista {
  position: relative;
  max-width: 420px;
  border: 1px solid var(--linea);
  border-radius: 10px;
  overflow: hidden;
  background: var(--tarjeta-alt);
}
.portada-elegida__vista img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
/* Se simula el degradado del sitio para que veas cómo va a quedar. */
.portada-elegida__vista::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top,
    rgba(12,12,13,0.96) 0%, rgba(12,12,13,0.72) 26%,
    rgba(12,12,13,0.34) 55%, rgba(12,12,13,0.55) 100%);
  pointer-events: none;
}

.portada-elegida__botones { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.aviso-suave {
  margin: 0 0 1.35rem;
  padding: 0.7rem 0.9rem;
  background: var(--tarjeta);
  border: 1px solid var(--linea);
  border-radius: 10px;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--tenue);
}
.aviso-suave strong { color: var(--texto); }

/* -------------------------------------------------- Libros en el panel */
.libros-panel { margin-top: 2rem; }
.libros-panel__titulo { margin: 0 0 0.75rem; }
.libros-panel__lista { display: grid; gap: 0.5rem; }

.tarjeta-libro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.1rem;
  background: var(--tarjeta);
  border: 1px solid var(--linea);
  border-radius: 12px;
  transition: border-color 0.2s var(--suave);
}
.tarjeta-libro:hover { border-color: rgba(232, 230, 227, 0.28); }

.tarjeta-libro h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.35;
}

.tarjeta-libro__autor {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: var(--tenue);
}

.tarjeta-libro__botones { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tarjeta-libro__botones .mini { text-decoration: none; text-align: center; }

@media (max-width: 700px) {
  .tarjeta-libro { grid-template-columns: minmax(0, 1fr); }
}

.modal__marca {
  position: absolute;
  right: 5px;
  bottom: 5px;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: rgba(8, 8, 9, 0.75);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--texto);
}

/* --------------------------------------------------------------- Móvil */
@media (max-width: 760px) {
  .ficha__trio { grid-template-columns: 76px minmax(0, 1fr); }
  .ficha__trio .campo:last-child { grid-column: 1 / -1; }

  .tarjeta-entrada { grid-template-columns: minmax(0, 1fr); }
  .tarjeta-entrada__botones { grid-auto-flow: column; justify-content: start; }

  .editor { padding: 1.1rem 1rem; }
}

@media (max-width: 760px) {
  .ficha {
    grid-template-columns: 26px 88px minmax(0, 1fr);
    grid-template-areas:
      "mover imagen campos"
      "botones botones botones";
  }
  .ficha__arrastre  { grid-area: mover; }
  .ficha__miniatura { grid-area: imagen; width: 88px; height: 70px; }
  .ficha__campos    { grid-area: campos; }
  .ficha__botones   { grid-area: botones; grid-auto-flow: column; justify-content: start; }
  .campo--corto     { max-width: none; }
}
