/* WondarCore — código propio, no generado. Se puede modificar libremente. */
/* Tarjetas de "Publicacion" (foto/video/nota) y su modal de detalle — compartido entre /red
   (red-publico.css/js) y "Mis publicaciones" en Perfil (composer-publico.css/js), para no duplicar
   el render en dos archivos. Reusa .search-dropdown/.search-result (layout.css) y .perfil-input/
   .perfil-label (perfil-publico.css) donde corresponde. Sin imágenes ni contenido hardcodeado: las
   fotos de portada/galería se setean desde JS con datos reales de la API. */

/* ── GRILLA ── */
.pub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 1.25rem;
}

.pub-empty {
  grid-column: 1 / -1;
  padding: 1.5rem 1rem;
  text-align: center;
  color: #999;
  font-size: 0.9rem;
}

/* ── TARJETA ── */
.pub-card {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
}

.pub-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.1);
}

.pub-card-img {
  position: relative;
  height: 200px;
  background-size: cover;
  background-position: center;
  background-color: #eef1f6;
  flex-shrink: 0;
}

.pub-card-img--empty {
  background: linear-gradient(135deg, #eef2ff, #f5f3ff);
}

.pub-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 0.68rem;
  font-weight: 700;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pub-badge--foto  { background: #2563eb; }
.pub-badge--video { background: #e53e3e; }
.pub-badge--nota  { background: #1a1a2e; }

.pub-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pub-delete-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  min-height: 0;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}

.pub-delete-btn:hover { background: #e53e3e; }

.pub-edit-btn {
  position: absolute;
  top: 10px;
  right: 50px;
  width: 30px;
  height: 30px;
  min-height: 0;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}
.pub-edit-btn:hover { background: #2563eb; }

.pub-photo-count {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 50px;
  padding: 4px 10px;
}

.pub-links-note {
  font-size: 0.76rem;
  color: #888;
  margin: 0.2rem 0 0;
  display: flex;
  align-items: center;
  gap: 5px;
}

.pub-card-body {
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.pub-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1a1a2e;
}

.pub-card-excerpt {
  font-size: 0.85rem;
  color: #666;
  line-height: 1.45;
}

/* ── AUTOR ── */
.pub-author {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pub-author-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  background-size: cover;
  background-position: center;
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pub-author-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: #444;
}

/* Estado de moderación en "Mis publicaciones" — misma paleta que .perfil-opinion-estado (perfil-publico.css). */
.pub-estado-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 50px;
  white-space: nowrap;
  margin-bottom: 6px;
}
.pub-estado-badge--pendiente { background: #fef3c7; color: #92400e; }
.pub-estado-badge--aprobado  { background: #dcfce7; color: #166534; }
.pub-estado-badge--rechazado { background: #fee2e2; color: #991b1b; }

/* ── ETIQUETAS / LUGARES ── */
.pub-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pub-tag {
  background: #1a1a2e;
  color: #fff;
  border-radius: 5px;
  padding: 5px 10px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.pub-lugares {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pub-lugar-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 50px;
  padding: 5px 12px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}

.pub-lugar-tag:hover { opacity: 0.85; }

.pub-lugar-tag--destino   { background: #7c3aed; }
.pub-lugar-tag--atraccion { background: #16a34a; }
.pub-lugar-tag--pais      { background: #d97706; }

/* ── FOOTER (likes / comentarios) ── */
.pub-card-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.1rem;
  border-top: 1px solid #f0f1f5;
}

.pub-like-btn,
.pub-comment-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 50px;
  border: none;
  background: #f4f5f7;
  color: #666;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.pub-like-btn--active { background: #dbeafe; color: #2563eb; }
.pub-comment-btn:hover { background: #e5e7eb; }

/* ── MODAL DE DETALLE (medio fijo a la izquierda, panel scrolleable a la derecha en desktop) ── */
.pub-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,10,20,0.6);
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
}

.pub-modal-overlay--open { display: flex; }

.pub-modal {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 980px;
  max-height: 92vh;
  overflow: hidden;
  position: relative;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
}

.pub-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  min-height: 0;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.9);
  color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
}

.pub-modal-media {
  background: #0a0a14;
  min-height: 220px;
  max-height: 46vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.pub-modal-photo {
  width: 100%;
  height: 100%;
  min-height: 220px;
  background-size: cover;
  background-position: center;
}

.pub-modal-photo[data-photo-index] { cursor: pointer; }

.pub-modal-photo--empty {
  background: linear-gradient(135deg, #1a1a2e, #2d1b4e);
}

.pub-modal-video {
  width: 100%;
  aspect-ratio: 16 / 9;
}

.pub-modal-video iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.pub-modal-panel {
  overflow-y: auto;
  padding: 1.5rem 1.5rem 1rem;
}

.pub-modal-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #1a1a2e;
  margin-bottom: 0.75rem;
}

/* En la tarjeta, .pub-card-body separa tags/lugares con flex gap — la modal arma el contenido como
   HTML plano concatenado (ver pubRenderModalBody en publicaciones-shared.js) y no tiene ese gap, así
   que sin esto quedan pegados uno debajo del otro. */
.pub-modal-content .pub-tags {
  margin-bottom: 0.75rem;
}

.pub-modal-content .pub-lugares {
  margin-bottom: 0.75rem;
}

.pub-modal-byline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.pub-modal-fecha {
  font-size: 0.78rem;
  color: #999;
}

.pub-modal-caption {
  font-size: 0.95rem;
  color: #333;
  margin-bottom: 0.75rem;
}

.pub-modal-body-text {
  font-size: 0.95rem;
  color: #333;
  line-height: 1.7;
  margin: 0.75rem 0;
}
.pub-modal-body-text p { margin-bottom: 0.85rem; }

/* ── Carrusel de fotos (portada + resto, cuando hay más de una) — reemplaza la vieja "portada
   grande + galería chica sin navegar". Motor de arrastre/flechas en wireCarousel (carousel-shared.js,
   visible=1); acá solo el layout visual. ── */
.pub-modal-carousel {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 220px;
  overflow: hidden;
}

.pub-modal-carousel-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.25s ease;
  cursor: grab;
}

.pub-modal-carousel-slide {
  flex: 0 0 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-color: #eef1f6;
}

.pub-modal-carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  min-height: 0;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 1.3rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}
.pub-modal-carousel-nav:hover:not(:disabled) { background: rgba(0, 0, 0, 0.7); }
.pub-modal-carousel-nav:disabled { opacity: 0.35; cursor: default; }
.pub-modal-carousel-prev { left: 10px; }
.pub-modal-carousel-next { right: 10px; }

.pub-modal-carousel-counter {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 50px;
  padding: 3px 10px;
}

/* ── LIGHTBOX de fotos (mismo patrón que .op-lightbox en opiniones-publico.css) ── */
.pub-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  align-items: center;
  justify-content: center;
}
.pub-lightbox--open { display: flex; }

.pub-lightbox-bg {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(4px);
}

.pub-lightbox-img {
  position: relative;
  max-width: 90vw;
  max-height: 88vh;
  border-radius: 10px;
  object-fit: contain;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

.pub-lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.pub-lightbox-close:hover { background: rgba(255,255,255,0.3); }

.pub-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 1.6rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 1;
}
.pub-lightbox-nav:hover { background: rgba(255,255,255,0.3); }
.pub-lightbox-nav:disabled { opacity: 0.2; cursor: default; }
.pub-lightbox-prev { left: 20px; }
.pub-lightbox-next { right: 20px; }

.pub-lightbox-counter {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.7);
  font-size: 0.8rem;
  font-weight: 600;
}

.pub-modal-links ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0.5rem 0 0.75rem;
}

.pub-modal-links a {
  font-size: 0.85rem;
  color: #2563eb;
  word-break: break-all;
}

/* ── COMENTARIOS ── */
.pub-comments {
  margin-top: 1rem;
  border-top: 1px solid #f0f1f5;
  padding-top: 1rem;
}

.pub-comments-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.pub-comments-empty {
  font-size: 0.85rem;
  color: #999;
  font-style: italic;
}

.pub-comment {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.pub-comment-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  background-size: cover;
  background-position: center;
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pub-comment-body { flex: 1; min-width: 0; }

.pub-comment-autor {
  font-size: 0.8rem;
  font-weight: 700;
  color: #1a1a2e;
  display: block;
}

.pub-comment-texto {
  font-size: 0.85rem;
  color: #444;
  word-break: break-word;
}

.pub-comment-remove {
  width: 26px;
  height: 26px;
  min-height: 0;
  border-radius: 50%;
  border: none;
  background: #f4f5f7;
  color: #999;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.pub-comment-remove:hover { background: #fee2e2; color: #dc2626; }

.pub-comment-form {
  display: flex;
  gap: 8px;
}

.pub-comment-input {
  flex: 1;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 50px;
  border: 1.5px solid #ddd;
  font-size: 0.85rem;
  font-family: inherit;
}
.pub-comment-input:focus { outline: none; border-color: #2563eb; }

.pub-comment-submit {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 50px;
  border: none;
  background: #2563eb;
  color: white;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.pub-comment-submit:disabled { opacity: 0.6; cursor: default; }

.pub-comment-error {
  color: #dc2626;
  font-size: 0.78rem;
  margin-top: 6px;
}

/* ── DESKTOP: medio fijo a la izquierda, panel scrolleable a la derecha ── */
@media (min-width: 768px) {
  .pub-modal {
    flex-direction: row;
    max-height: 88vh;
  }
  .pub-modal-media {
    flex: 0 0 46%;
    max-height: none;
    min-height: 0;
  }
  .pub-modal-panel {
    flex: 1;
    max-height: 88vh;
  }
}

/* ── MOBILE ── */
@media (max-width: 767px) {
  .pub-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
  .pub-card-img { height: 150px; }
}

@media (max-width: 480px) {
  .pub-grid { grid-template-columns: 1fr; }
}
