/* ─── App Layout ─── */
.app {
  display: flex;
  height: 100dvh;
}

/* ─── Main Canvas ─── */
.canvas {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(232,85,61,.04) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(232,85,61,.03) 0%, transparent 50%),
    var(--surface);
}

.canvas-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 40px;
  flex-shrink: 0;
}

.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-warm);
  border-radius: 10px;
  padding: 4px;
}

.tab {
  padding: 8px 14px;
  border: none;
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 7px;
  transition: all .2s;
  white-space: nowrap;
}

.tab-label {
  font-size: 13px;
  font-weight: 500;
}

.tab:hover { color: var(--ink); }

.tab.active {
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.canvas-meta {
  font-size: 13px;
  color: var(--ink-muted);
  font-weight: 400;
}

/* ─── Preview Area ─── */
.preview-scroll {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.preview-area {
  flex: 1;
  display: flex;
  align-items: safe center;
  justify-content: center;
  padding: 0 40px 30px;
}

.preview-area > * {
  transform: scale(0.95);
  transform-origin: center center;
}

/* ─── Facebook Ad Card ─── */
.fb-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  width: 500px;
  overflow: hidden;
  transition: box-shadow .3s;
  animation: cardIn .4s ease-out;
}

.fb-card:hover {
  box-shadow: var(--card-shadow-hover);
}

/* Card header */
.fb-card-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 10px;
}

.fb-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--fb-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
  overflow: hidden;
}

.fb-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fb-page-info {
  flex: 1;
  min-width: 0;
}

.fb-page-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--fb-text);
  line-height: 1.2;
}

.fb-sponsored {
  font-size: 12px;
  color: var(--fb-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.fb-sponsored svg { flex-shrink: 0; }

.fb-card-dots {
  color: var(--fb-secondary);
  font-size: 20px;
  letter-spacing: 1px;
  line-height: 1;
}

/* Primary text */
.fb-primary-text {
  padding: 0 16px 12px;
  font-size: 15px;
  line-height: 1.35;
  color: var(--fb-text);
  word-wrap: break-word;
}

.fb-see-more {
  color: var(--fb-secondary);
  cursor: pointer;
  font-weight: 400;
}

.fb-see-more:hover { text-decoration: underline; }

.ellipsis {
  color: rgba(150,150,150,0.9);
  font-weight: 700;
}

.stories-see-more {
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  font-weight: 400;
  white-space: nowrap;
}

.stories-see-more:hover { text-decoration: underline; }

/* Creative area */
.fb-creative {
  width: 100%;
  position: relative;
  overflow: hidden;
  background: var(--fb-bg);
}

.fb-creative img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.fb-creative-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--fb-secondary);
  gap: 8px;
  background:
    repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(0,0,0,.02) 10px, rgba(0,0,0,.02) 20px),
    var(--fb-bg);
}

.fb-creative-placeholder svg { opacity: .4; }
.fb-creative-placeholder span { font-size: 13px; opacity: .6; }

/* CTA bar */
.fb-cta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--fb-separator);
  background: var(--fb-bg);
}

.fb-cta-left {
  min-width: 0;
  flex: 1;
}

.fb-cta-domain {
  font-size: 12px;
  color: var(--fb-secondary);
  text-transform: uppercase;
  letter-spacing: .02em;
}

.fb-cta-headline {
  font-size: 15px;
  font-weight: 600;
  color: var(--fb-text);
  line-height: 1.3;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fb-cta-description {
  font-size: 14px;
  color: var(--fb-secondary);
  line-height: 1.3;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fb-cta-button {
  padding: 8px 16px;
  background: var(--fb-bg);
  border: 1px solid var(--fb-separator);
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--fb-text);
  cursor: default;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 12px;
}

/* Reactions bar */
.fb-reactions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  font-size: 14px;
  color: var(--fb-secondary);
}

.fb-reactions-left {
  display: flex;
  align-items: center;
  gap: 4px;
}

.fb-reaction-icons {
  display: flex;
}

.fb-reaction-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  margin-right: -3px;
  border: 2px solid white;
}

.fb-reaction-icon.like { background: var(--fb-blue); }
.fb-reaction-icon.love { background: #f33e58; }

.fb-reactions-text {
  margin-left: 4px;
  font-size: 15px;
  color: var(--fb-secondary);
}

.fb-reactions-right {
  font-size: 15px;
  color: var(--fb-secondary);
}

.fb-actions {
  display: flex;
  border-top: 1px solid var(--fb-separator);
  padding: 4px 16px;
}

.fb-action {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--fb-secondary);
  border-radius: 4px;
  cursor: default;
}

/* ─── Stories Preview ─── */
.stories-card {
  width: 420px;
  height: 748px;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  background: #000;
  box-shadow: var(--card-shadow);
  animation: cardIn .4s ease-out;
}

.stories-card:hover {
  box-shadow: var(--card-shadow-hover);
}

.stories-creative {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stories-creative-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.5);
  gap: 8px;
  background:
    repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,.03) 10px, rgba(255,255,255,.03) 20px),
    #1a1a1a;
}

.stories-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}

.stories-top {
  padding: 16px 16px 0;
  background: linear-gradient(to bottom, rgba(0,0,0,.4), transparent);
}

.stories-progress {
  height: 2px;
  background: rgba(255,255,255,.3);
  border-radius: 2px;
  margin-bottom: 12px;
}

.stories-progress-fill {
  height: 100%;
  width: 30%;
  background: white;
  border-radius: 2px;
}

.stories-header {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.stories-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--fb-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 13px;
  overflow: hidden;
  flex-shrink: 0;
}

.stories-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stories-page-name {
  font-size: 13px;
  font-weight: 600;
  color: white;
}

.stories-sponsored {
  font-size: 11px;
  font-weight: 700;
  color: white;
  margin-top: 6px;
}

.stories-bottom {
  padding: 16px;
  background: linear-gradient(to top, rgba(0,0,0,.6), transparent);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  transition: background .2s;
}

.stories-bottom.expanded {
  background: rgba(0,0,0,.6);
}

.stories-cta {
  pointer-events: auto;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  background: white;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--fb-text);
  cursor: default;
}

.stories-primary-text {
  pointer-events: auto;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  color: white;
  font-size: 14px;
  line-height: 1.3;
  margin-bottom: 10px;
  text-shadow: 0 1px 3px rgba(0,0,0,.4);
}

.stories-text-expanded {
  display: none;
}

.stories-bottom.expanded .stories-text-collapsed {
  display: none;
}

.stories-bottom.expanded .stories-text-expanded {
  display: block;
}

/* ─── Responsive ─── */
@media (max-width: 960px) {
  .canvas-header { padding: 20px 24px; }
  .preview-area { padding: 0 24px 24px; }
}

@media (max-width: 600px) {
  html, body { height: auto; overflow: auto; }
  .app { height: auto; min-height: 100dvh; overflow: visible; }
  .canvas { height: auto; overflow: visible; }
  .preview-scroll { flex: none; overflow: visible; height: auto; }
  .preview-area { flex: none; overflow: visible; height: auto; padding: 16px 16px 30px; }
  .preview-area > * { transform: none; }
  .fb-card { max-width: calc(100vw - 32px); }
  .stories-card { width: calc(100vw - 32px); height: calc((100vw - 32px) * 16 / 9); }
}

/* ─── Amazon Product Preview (shared: builder + reviewer) ─── */
.amazon-product-preview {
  display: flex;
  flex-direction: column;
  background: white;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  width: 480px;
  max-height: 720px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,.12) transparent;
}

.amp-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 20px 10px;
  border-bottom: 1px solid var(--border);
}

.amp-brand-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.amp-brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.amp-brand-logo-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px dashed var(--border);
  flex-shrink: 0;
}

.amp-brand-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.amp-brand-name.amp-placeholder {
  color: var(--ink-muted);
  font-weight: 400;
  font-style: italic;
}

.amp-brand-rating {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.amp-rating-value {
  font-size: 13px;
  font-weight: 700;
  color: #007185;
}

.amp-stars {
  font-size: 17px;
  color: #e85c00;
  letter-spacing: -1px;
}

.amp-star-half {
  display: inline-block;
  overflow: hidden;
  width: 0.5em;
  vertical-align: -0.1em;
  color: #e85c00;
}

.amp-rating-count {
  font-size: 12px;
  color: #007185;
  white-space: nowrap;
}

.amp-cta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 20px 4px;
}

.amp-btn {
  width: 100%;
  padding: 10px 16px;
  border-radius: 20px;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: default;
  text-align: center;
}

.amp-btn-cart {
  background: #ffd814;
  color: #0f1111;
}

.amp-btn-buy {
  background: #ffa41c;
  color: #0f1111;
}

.amp-title {
  font-size: 14px;
  font-weight: 400;
  color: #0f1111;
  line-height: 1.5;
  padding: 20px 20px 0;
}

.amp-title .amp-placeholder {
  color: var(--ink-muted);
  font-weight: 400;
  font-style: italic;
}

.amp-price {
  font-size: 22px;
  font-weight: 700;
  color: #B12704;
  padding: 8px 20px 12px;
  border-bottom: 1px solid var(--border);
}

.amp-carousel {
  position: relative;
  padding: 16px 0;
}

.amp-carousel-track {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: #fafafa;
}

.amp-carousel-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
}

.amp-carousel-slide.active {
  opacity: 1;
  pointer-events: auto;
}

.amp-carousel-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 0 0;
}

.amp-carousel-nav-arrow {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,.15);
  background: white;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background .15s, border-color .15s;
}

.amp-carousel-nav-arrow:hover {
  background: rgba(0,0,0,.06);
  border-color: rgba(0,0,0,.3);
}

.amp-carousel-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(0,0,0,.15);
  cursor: pointer;
  transition: background .15s;
}

.amp-carousel-dot.active { background: var(--ink); }
.amp-carousel-dot:hover:not(.active) { background: rgba(0,0,0,.3); }

.amp-images-empty {
  padding: 24px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-muted);
  font-style: italic;
}

.amp-about-heading {
  margin-top: 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  padding: 0 20px 8px;
}

.amp-description {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-soft);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.amp-description-wrap {
  padding: 0 20px 12px;
}

.amp-description--clamped {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  overflow: hidden;
}

.amp-description-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  color: var(--accent);
  cursor: pointer;
  font-family: inherit;
}

.amp-description-toggle:hover { text-decoration: underline; }

.amp-toggle-chevron { transition: transform .2s; }
.amp-toggle-chevron--up { transform: rotate(180deg); }

.amp-link {
  display: block;
  font-size: 12px;
  color: var(--accent);
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  word-break: break-all;
  text-decoration: none;
}

.amp-link:hover { text-decoration: underline; }

.amp-link-empty {
  font-size: 12px;
  color: var(--ink-muted);
  font-style: italic;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}

/* Reviewer context: card fills split column, scrolls with page */
.rv-amazon-card {
  width: 100%;
  max-height: none;
  overflow-y: visible;
  box-shadow: 0 1px 6px rgba(0,0,0,.08);
}
