/* Runa Chat — Link Preview CSS (Lazy) */

/* ── Container ───────────────────────────────────────────────────────────── */
.msg-og {
  margin-top: 8px;
  max-width: 100%;
}

.msg-og.lp-ready {
  animation: lpFadeIn 200ms ease-out;
}

@keyframes lpFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Loading State ───────────────────────────────────────────────────────── */
.lp-loading {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  border-left: 3px solid var(--accent-cyan);
}

.lp-loading-shimmer {
  width: 60px;
  height: 60px;
  border-radius: 6px;
  background: linear-gradient(90deg, 
    rgba(255,255,255,0.04) 0%, 
    rgba(255,255,255,0.08) 50%, 
    rgba(255,255,255,0.04) 100%);
  background-size: 200% 100%;
  animation: lpShimmer 1.5s infinite;
  flex-shrink: 0;
}

.lp-loading-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lp-loading-line {
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(90deg, 
    rgba(255,255,255,0.04) 0%, 
    rgba(255,255,255,0.08) 50%, 
    rgba(255,255,255,0.04) 100%);
  background-size: 200% 100%;
  animation: lpShimmer 1.5s infinite;
}

.lp-loading-title { width: 80%; }
.lp-loading-desc { width: 100%; }
.lp-loading-domain { width: 40%; height: 10px; }

@keyframes lpShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Standard OG Card ────────────────────────────────────────────────────── */
.lp-card {
  display: block;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  border-left: 3px solid var(--accent-cyan);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: background var(--transition-fast);
}

.lp-card:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* Large card with image */
.lp-card-large .lp-image {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  display: block;
}

.lp-card-body {
  padding: 10px 12px;
}

.lp-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: 4px;
}

.lp-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lp-domain {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.lp-favicon {
  width: 16px;
  height: 16px;
  border-radius: 2px;
  object-fit: contain;
  flex-shrink: 0;
}

.lp-favicon-small {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  object-fit: contain;
}

.lp-favicon-placeholder {
  width: 16px;
  height: 16px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Compact card (no image) */
.lp-card-compact {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
}

.lp-card-compact .lp-card-body {
  padding: 0;
  flex: 1;
  min-width: 0;
}

.lp-card-compact .lp-favicon {
  margin-top: 2px;
}

/* ── YouTube Embed ───────────────────────────────────────────────────────── */
.lp-youtube {
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}

.lp-youtube-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  cursor: pointer;
}

.lp-youtube-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lp-youtube-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 68px;
  height: 48px;
  opacity: 0.9;
  transition: opacity 150ms;
}

.lp-youtube-thumb:hover .lp-youtube-play {
  opacity: 1;
}

.lp-youtube-play svg {
  width: 100%;
  height: 100%;
}

.lp-youtube-title {
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.lp-youtube-iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
  display: block;
}

/* ── Vimeo Embed ─────────────────────────────────────────────────────────── */
.lp-vimeo {
  border-radius: 8px;
  overflow: hidden;
  background: #1ab7ea;
}

.lp-vimeo-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  cursor: pointer;
  background: linear-gradient(135deg, #1ab7ea 0%, #0d9fd9 100%);
}

.lp-vimeo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lp-vimeo-placeholder {
  width: 100%;
  height: 100%;
}

.lp-vimeo-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: #1ab7ea;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 4px;
  transition: transform 150ms;
}

.lp-vimeo-thumb:hover .lp-vimeo-play {
  transform: translate(-50%, -50%) scale(1.05);
}

.lp-vimeo-title {
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.lp-vimeo-iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
  display: block;
}

/* ── Twitter/X Card ──────────────────────────────────────────────────────── */
.lp-twitter {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.lp-twitter:hover {
  background: rgba(255, 255, 255, 0.07);
}

.lp-twitter-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.lp-twitter-icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.lp-twitter-body {
  padding: 0 12px 10px;
}

.lp-twitter-body p {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-primary);
  margin: 0;
}

.lp-twitter-body .lp-muted {
  color: var(--text-muted);
}

.lp-twitter-img {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  display: block;
}

/* ── Mobile Optimizations ────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .lp-card-large .lp-image {
    max-height: 140px;
  }
  
  .lp-youtube-thumb,
  .lp-vimeo-thumb {
    aspect-ratio: 16 / 10;
  }
  
  .lp-twitter-img {
    max-height: 150px;
  }
}

/* ── Own Message Adjustments ─────────────────────────────────────────────── */
.msg-own .lp-card {
  border-left-color: rgba(255, 255, 255, 0.3);
}

.msg-own .lp-loading {
  border-left-color: rgba(255, 255, 255, 0.3);
}

.msg-own .lp-twitter {
  border-color: rgba(255, 255, 255, 0.15);
}
