/* ============================================================
   preview.css — Preview App (PDF, Embed, YouTube viewer)
   macOS Desktop Website
   ============================================================ */

/* ── Window sizing ─────────────────────────────────────────── */
.preview-window {
  min-width: 400px;
  min-height: 300px;
}

/* ── Content area ──────────────────────────────────────────── */
.preview-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  height: 0; /* force flex-basis so flex:1 fills parent */
  background: var(--surface-primary, #fff);
}

.preview-body iframe {
  flex: 1;
  width: 100%;
  height: 100%;
  border: none;
  min-height: 0;
  background: var(--surface-secondary, #f5f5f5);
}

/* ── Loading state ─────────────────────────────────────────── */
.preview-loading {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-tertiary, #888);
  font-family: var(--font-system);
  font-size: 13px;
}

.preview-spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--border-secondary, rgba(0,0,0,0.1));
  border-top-color: var(--accent, #007AFF);
  border-radius: 50%;
  animation: preview-spin 0.7s linear infinite;
}

@keyframes preview-spin {
  to { transform: rotate(360deg); }
}

/* ── Error / fallback state ────────────────────────────────── */
.preview-error {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px;
  text-align: center;
  color: var(--text-tertiary, #888);
  font-family: var(--font-system);
  font-size: 13px;
}

.preview-error-icon {
  font-size: 36px;
  opacity: 0.5;
}

.preview-error a {
  color: var(--accent, #007AFF);
  text-decoration: none;
  font-weight: 500;
}

.preview-error a:hover {
  text-decoration: underline;
}

/* ── Toolbar (bottom) ──────────────────────────────────────── */
.preview-toolbar {
  height: 28px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-secondary, rgba(244, 244, 244, 0.9));
  border-top: 1px solid var(--border-secondary, rgba(0, 0, 0, 0.09));
  flex-shrink: 0;
  font-family: var(--font-system);
  font-size: 10.5px;
  color: var(--text-tertiary, #888);
}

.preview-toolbar a {
  color: var(--accent, #007AFF);
  text-decoration: none;
  font-size: 10.5px;
}

.preview-toolbar a:hover {
  text-decoration: underline;
}

/* ── Reduced motion ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .preview-spinner { animation: none; }
  .preview-window { animation: none; }
}
