/*
 * Email Preview Component Styles
 *
 * Styles for the Email tab in the campaign content editor.
 * Matches Figma design specifications.
 */

/* ============================================
   LAYOUT
   ============================================ */

.email-preview-layout {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 56px;
  min-height: 560px;
  padding: 32px 0;
  padding-bottom: 0px;
  position: relative;
  overflow: hidden;
}

/* Email-only layout (no SMS tab) - prevent left clipping */
.email-preview-layout--email-only {
  justify-content: flex-start;
  padding-left: 40px;
}

/* ============================================
   LEFT SIDE - FADED iPHONE PREVIEW
   ============================================ */

.email-preview-hint--left {
  opacity: 0.4;
  pointer-events: none;
  flex-shrink: 0;
  width: 215px;
  overflow: hidden;
  align-self: center;
}

.email-preview-hint--left .email-iphone-wrapper {
  margin-left: -84px;
}

/* iPhone mockup for email tab */
.email-iphone-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.email-iphone {
  width: 299px;
  background: #e4e4e7;
  border-radius: 40px;
  padding: 8px;
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(0, 0, 0, 0.05);
}

.email-iphone-frame {
  background: #fff;
  border-radius: 32px;
  overflow: hidden;
  position: relative;
}

.email-iphone-notch {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 90px;
  height: 24px;
  background: #1c1c1e;
  border-radius: 16px;
  z-index: 10;
}

.email-iphone-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 44px 16px 12px;
  background: #fafafa;
  border-bottom: 1px solid #eceff0;
}

.email-iphone-back {
  color: #000b14;
}

.email-iphone-avatar {
  width: 28px;
  height: 28px;
  background: #eceff0;
  border-radius: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #52595f;
}

.email-iphone-business {
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #000b14;
}

.email-iphone-content {
  height: 400px;
  padding: 16px;
  background: #fff;
  overflow: hidden;
}

.email-iphone-bubble {
  padding: 16px;
  background: #fafafa;
  border-radius: 12px;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
  color: #000b14;
}

.email-iphone-home-indicator {
  width: 120px;
  height: 4px;
  background: #000;
  border-radius: 2px;
  margin: 16px auto 12px;
}

/* ============================================
   CENTER - MAIN iPAD EMAIL PREVIEW
   ============================================ */

.email-ipad-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.email-ipad-container {
  position: relative;
}

.email-ipad {
  width: 844px;
  background: #e4e4e7;
  border-radius: 32px;
  padding: 12px;
}

.email-ipad-frame {
  background: #fafafa;
  border-radius: 24px;
  border: 1px solid #eceff0;
  overflow: hidden;
}

/* Gmail Action Menu */
.email-gmail-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #fff;
}

.email-gmail-toolbar-icon {
  color: #52595f;
  flex-shrink: 0;
}

.email-gmail-toolbar-icons {
  display: flex;
  gap: 10px;
  flex: 1;
}

.email-gmail-toolbar-dot {
  width: 22px;
  height: 22px;
  background: #d6d8d9;
  border-radius: 4px;
}

.email-gmail-toolbar-pagination {
  font-family: "Roboto", system-ui, sans-serif;
  font-size: 14px;
  color: rgba(0, 0, 0, 0.54);
}

.email-gmail-toolbar-arrow {
  color: #52595f;
  flex-shrink: 0;
}

/* Subject row */
.email-gmail-subject-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px;
  background: #fafafa;
  min-height: 69px;
  box-sizing: border-box;
}

.email-gmail-subject-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}

.email-gmail-subject-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  margin-left: 16px;
  align-self: center;
}

.email-gmail-subject-icon {
  color: rgba(0, 0, 0, 0.54);
  flex-shrink: 0;
}

.email-gmail-subject-wrapper {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.email-gmail-subject {
  font-family: "Roboto", system-ui, sans-serif;
  font-size: 22px;
  font-weight: 400;
  color: #202124;
  outline: none;
  min-height: 26px;
  line-height: 32px;
}

/* Align smart field chips vertically within subject */
.email-gmail-subject .smart-field-chip {
  vertical-align: middle;
  line-height: 1;
  padding: 4px 8px;
  font-size: 14px;
}

.email-gmail-subject:empty::before {
  content: attr(data-placeholder);
  color: #858a8e;
  pointer-events: none;
}

.email-gmail-subject:focus {
  outline: none;
}

/* Smart field button for subject */
.email-subject-smart-btn {
  flex-shrink: 0;
  opacity: 1 !important;
  z-index: 10;
  position: static;
  transform: none;
  order: -1;
  margin-right: 8px;
  margin-top: 4px;
}

.email-gmail-important-icon {
  color: #f4b400;
  flex-shrink: 0;
}

.email-gmail-badge {
  font-family: "Roboto", system-ui, sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.6);
  background: rgba(0, 0, 0, 0.05);
  padding: 4px 8px;
  border-radius: 4px;
}

/* Sender row */
.email-gmail-sender-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  background: #fafafa;
  border-bottom: 1px solid #eceff0;
}

.email-gmail-sender-avatar {
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 50%;
  flex-shrink: 0;
}

.email-gmail-sender-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.email-gmail-sender-line1 {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
}

.email-gmail-sender-line2 {
  display: flex;
  align-items: center;
  gap: 4px;
}

.email-gmail-sender-name {
  font-family: "Roboto", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #202124;
}

.email-gmail-sender-email {
  font-family: "Roboto", system-ui, sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.54);
}

.email-gmail-unsubscribe {
  font-family: "Roboto", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.54);
}

.email-gmail-to {
  font-family: "Roboto", system-ui, sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.54);
}

.email-gmail-dropdown-arrow {
  color: rgba(0, 0, 0, 0.54);
}

.email-gmail-timestamp-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.email-gmail-time {
  font-family: "Roboto", system-ui, sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.6);
  white-space: nowrap;
}

.email-gmail-star,
.email-gmail-reply,
.email-gmail-more {
  color: rgba(0, 0, 0, 0.54);
  flex-shrink: 0;
}

/* Email content area */
.email-gmail-content {
  padding: 24px 16px;
  background: #fafafa;
  min-height: 400px;
}

.email-gmail-content-inner {
  max-width: 754px;
  margin: 0 auto;
}

.email-gmail-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #000b14;
  margin-bottom: 24px;
}

.email-gmail-body-wrapper {
  position: relative;
}

.email-gmail-headline {
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.35;
  color: #000b14;
  margin: 0 0 24px 0;
  outline: none;
  min-height: 32px;
  white-space: pre-wrap; /* Preserve line breaks and wrap text */
  word-wrap: break-word; /* Break long words if needed */
}

/* Ensure multiple consecutive <br> tags are all visible */
.email-gmail-headline br {
  display: block;
  margin: 0;
  padding: 0;
  line-height: 1.35;
}

/* Use ::after to add actual height to each <br> tag */
.email-gmail-headline br::after {
  content: "";
  display: block;
  height: 1.35em;
  line-height: 1.35;
}

/* Add extra spacing between consecutive <br> tags */
.email-gmail-headline br + br {
  margin-top: 0;
}

.email-gmail-headline br + br::after {
  height: 1.35em; /* Ensure consecutive br tags each create a line break */
}

/* Empty divs used for multiple line breaks */
.email-gmail-headline .line-break-spacer {
  height: 1.35em;
  min-height: 1.35em;
  margin: 0;
  padding: 0;
  display: block;
}

.email-gmail-headline:empty::before {
  content: attr(data-placeholder);
  color: #858a8e;
  pointer-events: none;
}

.email-gmail-headline:focus {
  outline: none;
}

.email-gmail-body {
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #858a8e;
  margin: 0 0 32px 0;
  outline: none;
  min-height: 48px;
  white-space: pre-wrap; /* Preserve line breaks and wrap text */
  word-wrap: break-word; /* Break long words if needed */
}

/* Ensure multiple consecutive <br> tags are all visible */
.email-gmail-body br {
  display: block;
  margin: 0;
  padding: 0;
  line-height: 1.5;
}

/* Use ::after to add actual height to each <br> tag */
.email-gmail-body br::after {
  content: "";
  display: block;
  height: 1.5em;
  line-height: 1.5;
}

/* Add extra spacing between consecutive <br> tags */
.email-gmail-body br + br {
  margin-top: 0;
}

.email-gmail-body br + br::after {
  height: 1.5em; /* Ensure consecutive br tags each create a line break */
}

/* Empty divs used for multiple line breaks */
.email-gmail-body .line-break-spacer {
  height: 1.5em;
  min-height: 1.5em;
  margin: 0;
  padding: 0;
  display: block;
}

.email-gmail-body:empty::before {
  content: attr(data-placeholder);
  color: #c4c4c4;
  pointer-events: none;
}

.email-gmail-body:focus {
  outline: none;
}

/* Smart field buttons - Match playground design and always visible */
.gmail-smart-btn,
.email-body-smart-btn {
  position: absolute;
  right: 4px;
  width: 24px;
  height: 24px;
  background: #1a73e8 !important;
  border: none !important;
  border-radius: 50% !important;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1 !important;
  transition: transform 0.15s ease;
  color: #fff !important;
  z-index: 10;
}

/* Position for subject (single line) - centered vertically */
.gmail-smart-btn {
  top: 50% !important;
  transform: translateY(-50%);
}

/* Position for body (top right) */
.email-body-smart-btn {
  top: 8px;
  transform: none;
}

.gmail-smart-btn:hover {
  transform: translateY(-50%) scale(1.1);
}

.email-body-smart-btn:hover {
  transform: scale(1.1);
}

/* Ensure SVG icon is white */
.gmail-smart-btn svg,
.email-body-smart-btn svg {
  color: #fff !important;
  stroke: #fff !important;
}

/* Action buttons */
.email-gmail-actions {
  display: flex;
  gap: 8px;
  margin-top: 24px;
}

.email-gmail-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.16);
  border-radius: 4px;
  font-family: "Roboto", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.54);
  cursor: default;
}

/* ============================================
   RIGHT SIDE - FADED MACBOOK PREVIEW
   ============================================ */

.email-preview-hint--right {
  opacity: 0.4;
  pointer-events: none;
  flex-shrink: 0;
  width: 280px;
  overflow: hidden;
  align-self: center;
  margin-top: 100px;
}

.email-preview-hint--right .email-macbook-wrapper {
  /* No negative margin - show the left edge of the MacBook */
  margin-left: 0;
}

/* MacBook mockup for email tab */
.email-macbook-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.email-macbook {
  width: 270px;
  background: #e4e4e7;
  border-radius: 12px;
  padding: 8px;
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(0, 0, 0, 0.05);
}

.email-macbook--sms-offset {
  position: relative;
  left: 30px;
}

.email-macbook-frame {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
}

/* Safari header */
.email-safari-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: #f5f5f7;
  border-bottom: 1px solid #e5e7eb;
}

.email-safari-dots {
  display: flex;
  gap: 6px;
}

.email-safari-dot {
  width: 10px;
  height: 10px;
  background: #e4e4e4;
  border-radius: 50%;
}

.email-safari-url {
  flex: 1;
  text-align: center;
  font-family: "SF Pro Text", system-ui, sans-serif;
  font-size: 11px;
  color: #676767;
}

/* Safari content - Landing page preview */
.email-safari-content {
  padding: 32px 24px;
  background: #fff;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.email-landing-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #000b14;
  margin-bottom: 24px;
}

.email-landing-headline {
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #000b14;
  margin: 0 0 16px 0;
}

.email-landing-body {
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 10px;
  line-height: 1.5;
  color: #858a8e;
  margin: 0 0 24px 0;
  max-width: 254px;
}

.email-landing-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 24px;
  background: #000b14;
  color: #fff;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 9px;
  font-weight: 600;
  border-radius: 66px;
  border: none;
}
