/* Componentes reutilizables: modal, toast, dropdown, img-zone. */

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, 0.4);
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-4);
  animation: fadeIn 120ms ease;
}
.modal {
  background: var(--bg);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  max-height: 90vh;
  animation: pop 160ms ease;
}
.modal-large { max-width: 720px; }
.modal-xl { max-width: 860px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; }
.modal-close {
  background: none; border: none; padding: 6px;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  display: inline-flex;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text); }
.modal-body { padding: var(--sp-5); overflow-y: auto; }
.modal-footer {
  display: flex; gap: var(--sp-2); justify-content: flex-end;
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--border);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }

/* Toast */
#toast-root {
  position: fixed; bottom: 16px; right: 16px; z-index: 200;
  display: flex; flex-direction: column; gap: var(--sp-2);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  min-width: 240px;
  max-width: 360px;
  padding: var(--sp-3) var(--sp-4);
  background: var(--text);
  color: var(--bg);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: var(--sp-2);
  animation: slideIn 180ms ease;
}
.toast-success { background: #1f8a3a; }
.toast-error { background: var(--red); }
.toast-warning { background: var(--orange); color: #fff; }
@keyframes slideIn { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Dropdown genérico */
.dropdown { position: relative; display: inline-block; }
.dropdown-trigger {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  height: 32px; padding: 0 var(--sp-3);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  transition: background var(--t);
}
.dropdown-trigger:hover { background: var(--bg-hover); }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  min-width: 220px;
  padding: var(--sp-2);
  z-index: 60;
  display: none;
}
.dropdown-menu.right { left: auto; right: 0; }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-item {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: var(--fs-sm);
  color: var(--text);
}
.dropdown-item:hover { background: var(--bg-hover); }

/* Image drop zone (la usarán F1/F2; estilos base aquí) */
.img-zone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  background: var(--bg-soft);
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color var(--t), background var(--t);
}
.img-zone:hover, .img-zone.dragover {
  border-color: var(--text);
  background: #fafafa;
  color: var(--text);
}
.img-zone-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--sp-3);
  margin-top: var(--sp-4);
}
.img-thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-hover);
  border: 1px solid var(--border);
}
.img-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Confirm dialog inline */
.confirm-text { color: var(--text-soft); margin-top: var(--sp-2); line-height: 1.5; }

/* Card genérica (paneles de detalle) */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
}
.card + .card { margin-top: var(--sp-4); }
.card-title {
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  font-weight: 600;
  margin-bottom: var(--sp-3);
}

/* Chip (etiquetas pequeñas: tipo de noticias contratadas, etc.) */
.chip {
  display: inline-flex; align-items: center;
  padding: 2px var(--sp-2);
  font-size: var(--fs-xs);
  border-radius: var(--r-pill);
  background: var(--bg-soft);
  border: 1px solid var(--border-strong);
  color: var(--text-soft);
  white-space: nowrap;
}

/* Idioma principal de la web del cliente: amarillo Páxinas Galegas. */
.chip-idioma-principal {
  background: var(--yellow);
  border-color: #e0a800;
  color: #3d2e00;
  font-weight: 600;
}

/* Falta la traducción a ese idioma (categorías multi-idioma). */
.chip-warn {
  background: var(--state-incomplete-bg);
  border-color: var(--state-incomplete-fg);
  color: var(--state-incomplete-fg);
}

/* Badge "enviada/compartida" (azul). */
.badge-shared { background: var(--state-shared-bg); color: var(--state-shared-fg); }

/* Campo de solo lectura con aspecto de input (p.ej. cliente fijado en un modal). */
.input-readonly {
  display: flex; align-items: center;
  background: var(--bg-soft);
  color: var(--text-soft);
}

/* Lightbox global (zoom de imágenes con fondo oscurecido). */
.lightbox-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0, 0, 0, 0.85);
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-6);
  cursor: zoom-out;
  animation: fadeIn 120ms ease;
}
.lightbox-img {
  max-width: 92vw; max-height: 92vh;
  object-fit: contain;
  border-radius: var(--r-sm);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
}

/* ---------------------------------------------------------------------------
   Logo del cliente (js/components/clientLogo.js)
   La URL es la de la web del cliente (no hay copia en el bucket), así que el
   <img> puede fallar: el componente lo sustituye por .client-logo-ph. Ambos
   comparten la clase de tamaño para que el hueco no salte.
--------------------------------------------------------------------------- */
.client-logo-ph {
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-soft);
  line-height: 1;
  overflow: hidden;
}

/* Tamaños. object-fit: contain porque los logos vienen en cualquier
   proporción (304 de los 342 son SVG apaisados). */
.client-logo-sm,
.client-logo-md {
  flex: none;
  object-fit: contain;
  border-radius: var(--r-sm);
  background: var(--bg-soft);
}
.client-logo-sm { width: 28px; height: 28px; font-size: var(--fs-xs); }
.client-logo-md { width: 44px; height: 44px; font-size: var(--fs-sm); }

/* Cabecera de la ficha de cliente: logo + <h1> en la misma línea. */
.cd-title { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.cd-title h1 { margin: 0; }

/* Cabecera de la card de cliente en el aside del editor de noticia. */
.noticia-client-head {
  display: flex; align-items: center; gap: var(--sp-2);
  margin-bottom: var(--sp-2);
  min-width: 0;
}
.noticia-client-head .card-title { min-width: 0; overflow-wrap: anywhere; }

/* Centinela del render por lotes (js/utils/chunkedRender.js): invisible, solo
   sirve de disparador para el IntersectionObserver. */
.chunk-sentinel { height: 1px; }
