/**
 * UNAMOS - Tarjeta de Vista Previa de Enlace / Noticia Relacionada
 * Compatible con .entry-content de Astra, WordPress, móviles y el editor CMS.
 */

.unamos-link-preview-wrapper {
  margin: 1.85rem 0 !important;
  display: block !important;
  clear: both !important;
  position: relative !important;
  user-select: text;
}

.unamos-link-preview {
  display: flex !important;
  flex-direction: row !important;
  align-items: stretch !important;
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 14px !important;
  overflow: hidden !important;
  text-decoration: none !important;
  color: inherit !important;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.04) !important;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.unamos-link-preview:hover {
  border-color: #f16421 !important;
  box-shadow: 0 10px 25px rgba(241, 100, 33, 0.12) !important;
  transform: translateY(-2px) !important;
  text-decoration: none !important;
}

.unamos-lp-content {
  flex: 1 1 auto !important;
  padding: 1.25rem 1.4rem !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

.unamos-lp-site {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  margin-bottom: 7px !important;
}

.unamos-lp-badge {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  font-size: 10.5px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.6px !important;
  background: #fff7ed !important;
  color: #ea580c !important;
  border: 1px solid #ffedd5 !important;
  padding: 2.5px 8px !important;
  border-radius: 6px !important;
  line-height: 1.2 !important;
}

.unamos-lp-domain {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  color: #64748b !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.unamos-lp-title {
  font-family: 'Montserrat', sans-serif, system-ui !important;
  font-size: 16.5px !important;
  font-weight: 700 !important;
  line-height: 1.35 !important;
  color: #0f172a !important;
  margin: 0 0 6px 0 !important;
  padding: 0 !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.unamos-link-preview:hover .unamos-lp-title {
  color: #f16421 !important;
}

.unamos-lp-desc {
  font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  font-size: 13.5px !important;
  line-height: 1.45 !important;
  color: #475569 !important;
  margin: 0 0 10px 0 !important;
  padding: 0 !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.unamos-lp-footer {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  color: #003399 !important;
  border-top: 1px solid #f1f5f9 !important;
  padding-top: 8px !important;
  margin-top: auto !important;
}

.unamos-lp-url {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: 90% !important;
  color: #003399 !important;
}

.unamos-lp-arrow {
  font-size: 14px !important;
  transition: transform 0.2s ease !important;
  color: #003399 !important;
}

.unamos-link-preview:hover .unamos-lp-arrow {
  transform: translateX(4px) !important;
  color: #f16421 !important;
}

.unamos-lp-image-wrapper {
  flex: 0 0 200px !important;
  width: 200px !important;
  min-height: 125px !important;
  background: #f8fafc !important;
  position: relative !important;
  overflow: hidden !important;
  border-left: 1px solid #f1f5f9 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.unamos-lp-image {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

/* En caso de que no haya imagen */
.unamos-link-preview.no-image .unamos-lp-image-wrapper {
  display: none !important;
}

/* ── Estilos específicos dentro del Editor CMS ── */
.unamos-lp-controls {
  display: none !important;
}

#editor .unamos-link-preview-wrapper {
  cursor: grab;
  user-select: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.2s ease;
}

#editor .unamos-link-preview-wrapper:active {
  cursor: grabbing;
}

#editor .unamos-link-preview-wrapper:hover {
  outline: 2px dashed #f16421;
  outline-offset: 4px;
  border-radius: 16px;
}

#editor .unamos-link-preview-wrapper .unamos-lp-controls {
  display: none;
  position: absolute;
  top: -14px;
  right: 12px;
  background: #0f172a;
  border-radius: 9999px;
  padding: 3px 8px;
  gap: 6px;
  align-items: center;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  z-index: 30;
}

#editor .unamos-link-preview-wrapper:hover .unamos-lp-controls {
  display: flex !important;
}

#editor .unamos-lp-btn {
  background: transparent;
  color: #f8fafc;
  border: none;
  border-radius: 9999px;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  line-height: 1;
}

#editor .unamos-lp-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

#editor .unamos-lp-remove-btn {
  display: inline-flex;
  background: transparent;
  color: #fca5a5;
  border: none;
  border-radius: 9999px;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  line-height: 1;
}

#editor .unamos-lp-remove-btn:hover {
  background: #ef4444;
  color: #ffffff;
}

/* ── Ajustes responsive (móviles) ── */
@media (max-width: 640px) {
  .unamos-link-preview {
    flex-direction: column-reverse !important;
  }
  .unamos-lp-image-wrapper {
    flex: none !important;
    width: 100% !important;
    height: 175px !important;
    border-left: none !important;
    border-bottom: 1px solid #f1f5f9 !important;
  }
  .unamos-lp-content {
    padding: 1.1rem !important;
  }
  .unamos-lp-title {
    font-size: 15px !important;
  }
}
