/**
 * Theme gallery — mini live eCard previews (token-driven via theme-tokens.css).
 */

.theme-card__preview-wrap,
.layout-card__preview-wrap {
  padding: 0;
  background: linear-gradient(165deg, #e8ecf4 0%, #dce3ef 50%, #cfd8e8 100%);
  overflow: hidden;
}

.theme-card__preview-stage,
.layout-card__preview-stage {
  display: flex;
  justify-content: center;
  padding: 20px 16px 12px;
  min-height: 0;
}

/* Full-card gallery viewport — scale entire mock eCard without clipping */
.ecard-preview-fit {
  width: 100%;
  /*
   * Wider preview frame so the card doesn't look overly tall/narrow.
   * Target is closer to the premium ratio shown in the eCard reference.
   */
  max-width: var(--ecard-preview-fit-max-w, 340px);
  height: var(--ecard-preview-fit-max-h, 620px);
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: hidden;
  --ecard-preview-fit-max-w: 340px;
  --ecard-preview-fit-max-h: 620px;
}

.ecard-preview-fit .theme-preview-device {
  flex-shrink: 0;
  transform-origin: top center;
  will-change: transform;
}

.ecard-preview-fit .theme-preview-shell.card-shell,
.ecard-preview-fit .layout-preview-shell.card-shell {
  min-height: unset;
  max-height: none;
  height: auto;
}

.ecard-preview-fit .theme-preview-shell .card-scroll,
.ecard-preview-fit .layout-preview-shell .card-scroll {
  overflow: visible;
  height: auto;
  max-height: none;
}

/* Phone bezel */
.theme-preview-device {
  width: 100%;
  max-width: var(--ecard-preview-device-max-w, 320px);
  margin: 0 auto;
}

.theme-preview-device__bezel {
  padding: 10px;
  border-radius: 32px;
  background: linear-gradient(160deg, #2a3142 0%, #0f1419 100%);
  box-shadow:
    0 20px 50px rgba(15, 23, 42, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.theme-preview-shell.card-shell {
  width: 100%;
  margin: 0;
  border-radius: 24px;
  overflow: hidden;
  min-height: 420px;
  max-height: 420px;
  box-shadow: var(--shadow-card);
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.theme-preview-shell .card-scroll {
  overflow: hidden;
  height: 100%;
  max-height: 420px;
}

/* ── Top bar ── */
.theme-preview-shell .top-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px 0;
}

.theme-preview-shell .top-bar-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--pill-border);
  color: var(--text-primary);
  font-size: 9px;
  font-weight: 500;
  max-width: 58%;
}

.theme-preview-shell .top-bar-status__text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.theme-preview-shell .top-bar-actions {
  flex-shrink: 0;
}

.theme-preview-shell .pill-btn--preview-share {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--pill-border);
  color: var(--text-primary);
  font-size: 9px;
  font-weight: 500;
}

.theme-preview-shell .pill-btn--preview-share svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.theme-preview-shell .online-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--status-online);
  box-shadow: 0 0 6px var(--status-online-glow);
  flex-shrink: 0;
}

/* ── Profile ── */
.theme-preview-shell .profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 16px 10px;
  text-align: center;
}

.theme-preview-shell .avatar-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  border-radius: 50%;
  overflow: hidden;
}

.theme-preview-shell .avatar-wrap::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--avatar-ring-start), var(--avatar-ring-end));
  box-shadow: 0 0 14px var(--avatar-ring-glow);
  z-index: 0;
}

.theme-preview-shell .avatar-placeholder {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--avatar-placeholder-text);
  background: linear-gradient(
    145deg,
    var(--avatar-placeholder-start),
    var(--avatar-placeholder-end)
  );
  border: 2px solid var(--avatar-border);
  box-sizing: border-box;
}

.theme-preview-shell .profile__name {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin: 0 0 4px;
}

.theme-preview-shell .profile__title {
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  margin: 0 0 2px;
}

.theme-preview-shell .profile__company {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
  margin: 0;
}

/* ── Contacts ── */
.theme-preview-shell .contacts {
  padding: 4px 14px 2px;
}

.theme-preview-shell .contact-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--divider);
  color: inherit;
}

.theme-preview-shell .contact-row:last-child {
  border-bottom: none;
}

.theme-preview-shell .contact-row__icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: linear-gradient(
    145deg,
    var(--contact-icon-bg-start),
    var(--contact-icon-bg-end)
  );
}

.theme-preview-shell .contact-row__icon svg {
  width: 15px;
  height: 15px;
  color: var(--contact-icon-color);
  stroke: var(--contact-icon-color);
}

.theme-preview-shell .contact-row__body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.theme-preview-shell .contact-row__label {
  font-size: 9px;
  color: var(--text-secondary);
}

.theme-preview-shell .contact-row__value {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.theme-preview-shell .theme-preview-chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.45;
  color: var(--text-secondary);
}

/* ── Actions ── */
.theme-preview-shell .actions {
  padding: 8px 14px 6px;
}

.theme-preview-shell .actions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.theme-preview-shell .action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--action-border);
  background: var(--button-bg);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 500;
  box-shadow: var(--shadow-button, none);
}

.theme-preview-shell .action-btn__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--icon-color, var(--accent));
  background: var(--icon-bg);
  border-radius: var(--icon-bg-radius, 0);
  width: var(--icon-size, 24px);
  height: var(--icon-size, 24px);
}

.theme-preview-shell .action-btn__icon svg {
  width: 14px;
  height: 14px;
}

.theme-preview-shell .action-btn__label {
  flex: 1;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Footer / social ── */
.theme-preview-shell .footer {
  padding: 10px 14px 14px;
  text-align: center;
}

.theme-preview-shell .social-divider {
  margin-bottom: 10px;
}

.theme-preview-shell .social-divider span {
  font-size: 9px;
  color: var(--text-secondary);
}

.theme-preview-shell .social-icons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}

.theme-preview-shell .social-icon-wrap {
  display: inline-flex;
}

.theme-preview-shell .social-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-preview-shell .social-icon svg {
  width: 16px;
  height: 16px;
  fill: #fff;
}

.theme-preview-shell .social-icon--snapchat svg {
  fill: var(--brand-icon-dark);
}

.theme-preview-shell .powered-by {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 4px;
}

.theme-preview-shell .footer-copyright {
  font-size: 8px;
  color: var(--text-secondary);
  opacity: 0.85;
  margin: 0;
}

/* Light themes — preview shell inherits token overrides from theme-tokens.css */

@media (max-width: 480px) {
  .theme-card__preview-stage,
  .layout-card__preview-stage {
    padding: 16px 12px 8px;
  }

  .theme-preview-device {
    max-width: 100%;
  }

  .ecard-preview-fit {
    --ecard-preview-fit-max-h: 560px;
    max-width: 100%;
  }
}
