/* ---------- PREVIEW PAGE ---------- */

.preview-layout{
  height: calc(100vh - 220px);
  min-height: 400px;
  display: flex;
  flex-direction: column;
}

.preview-toolbar-extra{
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.preview-frame-wrap{
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  position: relative;
  display: flex;
  transition: box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}

.preview-frame{
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

/* the backend's own words about what went wrong, kept apart from the
   plain-language explanation above it */
.preview-reason{
  display: block;
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--danger);
  word-break: break-word;
}

.preview-empty{
  margin: auto;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  max-width: 340px;
  padding: 20px;
}

.preview-empty .preview-empty-icon{
  font-family: var(--mono);
  font-size: 26px;
  color: var(--border);
  margin-bottom: 12px;
}

.preview-empty a{
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s var(--ease);
}

.preview-empty a:hover{ text-decoration: underline; color: var(--accent-2); }

.preview-loading{
  margin: auto;
  text-align: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  animation: statusPulse 1.4s ease infinite;
}

.preview-url-bar{
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface2) 0%, var(--bg) 100%);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- LIVE INDICATOR ---------- */

.live-indicator{
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ok);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  flex-shrink: 0;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  background: rgba(61,217,167,0.08);
  border: 1px solid rgba(61,217,167,0.25);
}

.live-dot{
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 6px var(--ok);
  animation: livePulse 1.6s ease infinite;
}

@keyframes livePulse{
  0%, 100%{ opacity: 1; transform: scale(1); }
  50%{ opacity: 0.5; transform: scale(0.85); }
}

.preview-frame-wrap.flash::after{
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  opacity: 0;
  pointer-events: none;
  animation: previewFlash 0.5s ease;
}

@keyframes previewFlash{
  0%{ opacity: 0.12; }
  100%{ opacity: 0; }
}