/* ============================================================
   MAIN STYLES
   Layout, components, forms, product grid, campaigns, modals
   ============================================================ */

@font-face {
  font-family: 'Lexi';
  src:
    url('../fonts/Lexi-Regular-0.1.0.ttf') format('truetype'),
    url('https://cdn.shopify.com/s/files/1/0729/0817/7625/files/Lexi.ttf') format('truetype'),
    url('https://cdn.shopify.com/s/files/1/0729/0817/7625/files/lexi.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Lexy';
  src:
    local('Lexi'),
    url('../fonts/Lexi-Regular-0.1.0.ttf') format('truetype'),
    url('https://cdn.shopify.com/s/files/1/0729/0817/7625/files/Lexi.ttf') format('truetype'),
    url('https://cdn.shopify.com/s/files/1/0729/0817/7625/files/lexi.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --ps-orange: #F16722;
  --ps-orange-hover: #d55a1d;
  --ps-dark: #3D3D3D;
  --ps-gray: #868686;
  --ps-light-gray: #B2B2B2;
  --ps-bg: #f5f5f5;
  --ps-white: #ffffff;
  --ps-border: #e0e0e0;
}

/* Utility Classes */
.container-sm { max-width: 400px; margin: 0 auto; }
.container-md { max-width: 500px; margin: 0 auto; }
.container-lg { max-width: 600px; margin: 0 auto; }
.card { background: var(--ps-white); border-radius: 12px; padding: 24px; }
.card-warning { background: #fff3e0; border-radius: 8px; padding: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: 8px; }
.gap-md { gap: 12px; }
.gap-lg { gap: 16px; }
.mt-md { margin-top: 24px; }
.mb-md { margin-bottom: 24px; }
.text-center { text-align: center; }
.hidden { display: none !important; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--ps-bg);
  color: var(--ps-dark);
  min-height: 100vh;
}

.header {
  background: var(--ps-white);
  border-bottom: 1px solid var(--ps-border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo { height: 32px; }

.header-right { display: flex; align-items: center; gap: 16px; }

.my-campaigns-btn {
  background: var(--ps-white);
  border: 1px solid var(--ps-border);
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ps-orange);
  cursor: pointer;
  transition: all 0.2s;
}

.my-campaigns-btn:hover {
  border-color: var(--ps-orange);
  color: var(--ps-orange);
}

.main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 24px;
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.page-subtitle {
  color: var(--ps-gray);
  font-size: 16px;
  margin-bottom: 32px;
}

/* Campaign Type Cards */
.campaign-types {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 40px;
}

@media (max-width: 768px) {
  .campaign-types { grid-template-columns: 1fr; }
}

.campaign-type-card {
  background: var(--ps-white);
  border: 2px solid var(--ps-border);
  border-radius: 12px;
  padding: 32px 24px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.campaign-type-card:hover {
  border-color: var(--ps-orange);
}

.campaign-type-card.selected {
  border-color: var(--ps-orange);
  background: linear-gradient(135deg, rgba(241, 103, 34, 0.05) 0%, rgba(241, 103, 34, 0.02) 100%);
}

.campaign-type-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.campaign-type-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.campaign-type-desc {
  font-size: 14px;
  color: var(--ps-gray);
}

/* Steps indicator */
.steps-row {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  margin-bottom: 32px;
  min-height: 40px;
}

.steps {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 0;
}

.step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ps-border);
}

.step-dot.active { background: var(--ps-orange); }
.step-dot.completed { background: var(--ps-orange); opacity: 0.5; }

.my-campaigns-inline {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

/* Recipient Banner */
.recipient-banner {
  background: linear-gradient(135deg, var(--ps-orange) 0%, #e55a15 100%);
  color: white;
  padding: 20px 24px;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.recipient-count {
  font-size: 32px;
  font-weight: 700;
}

.recipient-label {
  font-size: 14px;
  opacity: 0.9;
}

/* Category Tabs */
.category-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.category-tab {
  padding: 8px 16px;
  border: 1px solid var(--ps-border);
  border-radius: 20px;
  background: var(--ps-white);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.category-tab:hover {
  border-color: var(--ps-orange);
  color: var(--ps-orange);
}

.category-tab.active {
  background: var(--ps-orange);
  color: white;
  border-color: var(--ps-orange);
}

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.product-card {
  background: var(--ps-white);
  border: 2px solid var(--ps-border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.product-card:hover {
  border-color: var(--ps-orange);
  box-shadow: 0 4px 12px rgba(241, 103, 34, 0.15);
}

.product-card.selected {
  border-color: var(--ps-orange);
  box-shadow: 0 0 0 3px rgba(241, 103, 34, 0.2);
}

.product-card.hidden { display: none; }

.product-image {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  background: #f9f9f9;
}

.product-info {
  padding: 14px 16px 16px;
}

.product-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
  line-height: 1.3;
}

.product-type {
  font-size: 12px;
  color: var(--ps-gray);
  margin-bottom: 8px;
}

.product-price {
  font-weight: 700;
  color: var(--ps-orange);
}

/* Preview Container - Proof System */
.preview-container {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 32px;
  align-items: start;
}

@media (max-width: 992px) {
  .preview-container {
    grid-template-columns: 1fr;
  }
}

.preview-image-container {
  background: var(--ps-white);
  border-radius: 12px;
  padding: 24px;
  position: relative;
}

.preview-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.preview-tab {
  padding: 8px 16px;
  border: 1px solid var(--ps-border);
  border-radius: 6px;
  background: var(--ps-white);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}

.preview-tab:hover { border-color: var(--ps-orange); }
.preview-tab.active {
  background: var(--ps-orange);
  color: white;
  border-color: var(--ps-orange);
}

/* Proof Preview with Overlays */
.proof-preview-wrapper {
  position: relative;
  width: 100%;
  container-type: inline-size;
}

.preview-image {
  width: 100%;
  border-radius: 8px;
  display: block;
}

.proof-preview-wrapper.proof-postcard-back-border .preview-image {
  border: 1px solid #000;
}

.proof-preview-wrapper.proof-letter-insert-placeholder {
  aspect-ratio: 6.75 / 5;
  background: #fff;
  border: 1px solid #000;
  border-radius: 8px;
  overflow: hidden;
}

.proof-preview-wrapper.proof-letter-insert-placeholder .preview-image {
  display: none;
}

/* Overlay elements positioned on the preview */

/* ============================================================
   COMPONENT STYLES (campaigns, customize, modals, etc.)
   ============================================================ */

   TEMPLATE: Flip With Rick
   Products: Flip With Rick series
   Has property value offer calculation
   ---------------------------------------- */
.template-flipwithrick .overlay-full-name {
  top: 3%;
  left: 4%;
  width: 45%;
  height: 5%;
  font-family: 'Lexi', 'Dancing Script', cursive;
  color: #000;
  display: flex;
  font-size: clamp(6px, 2cqw, 11px);
}

.template-flipwithrick .overlay-rma {
  top: 8%;
  left: 4%;
  width: 48%;
  height: 8%;
  font-family: 'Lexi', 'Dancing Script', cursive;
  color: #000;
  display: flex;
  align-items: flex-start;
  font-size: clamp(6px, 1.8cqw, 10px);
  line-height: 1.2;
}

.template-flipwithrick .overlay-custom-message {
  top: 28%;
  left: 4%;
  width: 44%;
  height: 60%;
  font-family: 'Lexi', 'Dancing Script', cursive;
  color: #000;
  display: flex;
  align-items: flex-start;
  font-size: clamp(6px, 2.3cqw, 13px);
  line-height: 1.4;
}

.template-flipwithrick .overlay-recipient-name {
  top: 38%;
  left: 53%;
  width: 44%;
  height: 5%;
  font-family: 'Lexi', 'Dancing Script', cursive;
  color: #000;
  display: flex;
  font-size: clamp(6px, 2cqw, 12px);
}

.template-flipwithrick .overlay-recipient-address {
  top: 43%;
  left: 53%;
  width: 44%;
  height: 20%;
  font-family: 'Lexi', 'Dancing Script', cursive;
  color: #000;
  display: flex;
  align-items: flex-start;
  font-size: clamp(6px, 1.9cqw, 11px);
  line-height: 1.3;
}

.template-flipwithrick .overlay-offer {
  top: 18%;
  left: 53%;
  width: 44%;
  height: 18%;
  font-family: 'Impact', Arial, sans-serif;
  color: #2e7d32;
  display: flex !important;
  align-items: center;
  justify-content: center;
  font-size: clamp(14px, 7cqw, 38px);
  font-weight: bold;
}

.template-flipwithrick .overlay-website,
.template-flipwithrick .overlay-phone {
  display: none;
}

.template-flipwithrick .overlay-logo {
  top: 2%;
  left: 55%;
  width: 18%;
  height: 14%;
}

/* Default template classes (backwards compatible) */
.overlay-full-name {
  top: 2.1875%;
  left: 3.875%;
  width: 47%;
  height: 6%;
  font-family: 'Lexi', 'Dancing Script', cursive;
  color: #000;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  text-align: left;
  font-size: clamp(6px, 2cqw, 12px);
}

.overlay-rma {
  top: 8.1875%;
  left: 3.875%;
  width: 51.36%;
  height: 6.25%;
  font-family: 'Lexi', 'Dancing Script', cursive;
  color: #000;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  font-size: clamp(6px, 2cqw, 12px);
  line-height: 1.2;
}

.overlay-website {
  top: 14.4375%;
  left: 3.875%;
  width: 47%;
  height: 7.25%;
  font-family: Arial, sans-serif;
  color: #000;
  display: flex;
  justify-content: flex-start;
  text-align: left;
  font-size: clamp(6px, 2cqw, 10px);
  word-break: break-all;
}

.overlay-custom-message {
  top: 27.4375%;
  left: 3.875%;
  width: 46%;
  height: 65%;
  font-family: 'Lexi', 'Dancing Script', cursive;
  color: #000;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  font-size: clamp(6px, 2.5cqw, 14px);
  line-height: 1.4;
}

.overlay-recipient-name {
  top: 38.2%;
  left: 52.7083%;
  width: 45.5%;
  height: 5.5%;
  font-family: 'Lexi', 'Dancing Script', cursive;
  color: #000;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  font-size: clamp(6px, 1.9cqw, 14px);
}

.overlay-recipient-address {
  top: 43.1875%;
  left: 52.7083%;
  width: 45.5%;
  height: 24.75%;
  font-family: 'Lexi', 'Dancing Script', cursive;
  color: #000;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  font-size: clamp(6px, 2cqw, 13px);
  line-height: 1.3;
}

.overlay-barcode {
  top: 91.5%;
  left: 55.708%;
  width: 42.5%;
  height: 8.5%;
  display: none;
}

.overlay-offer {
  font-family: 'ITC-Avant-Garde-Bold', Arial, sans-serif;
  font-weight: bold;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.overlay-phone {
  font-family: 'ITC-Avant-Garde-Bold', Arial, sans-serif;
  font-weight: bold;
  display: none;
  align-items: center;
}

.overlay-logo {
  display: none;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 3px;
}

.overlay-logo.visible {
  display: flex;
}

.overlay-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Customize Panel */
.customize-panel {
  background: var(--ps-white);
  border-radius: 12px;
  padding: 24px;
}

.panel-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--ps-border);
}

.panel-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.panel-section-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--ps-dark);
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--ps-dark);
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--ps-border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--ps-orange);
}

.form-input.input-missing {
  border-color: #c62828;
  background: #fff5f5;
}

textarea.form-input {
  min-height: 100px;
  resize: vertical;
}

/* Character Counter */
.char-counter-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 6px;
  font-size: 13px;
}

.char-counter {
  color: var(--ps-gray);
}

.char-counter span#char-count {
  font-weight: 600;
  color: var(--ps-dark);
}

.char-counter-wrap.warning {
  background: #fff8e1;
}

.char-counter-wrap.warning .char-counter span#char-count {
  color: #f57c00;
}

.char-counter-wrap.over {
  background: #ffebee;
}

.char-counter-wrap.over .char-counter span#char-count {
  color: #c62828;
}

.char-status {
  font-size: 12px;
  font-weight: 500;
}

.char-status.optimal {
  color: #2e7d32;
}

.char-status.warning {
  color: #f57c00;
}

.char-status.over {
  color: #c62828;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* File Upload */
.file-upload {
  border: 2px dashed var(--ps-border);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.file-upload:hover {
  border-color: var(--ps-orange);
  background: rgba(241, 103, 34, 0.02);
}

.file-upload.has-file {
  border-color: var(--ps-orange);
  background: rgba(241, 103, 34, 0.05);
}

.file-upload input[type="file"] {
  display: none;
}

.file-upload-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.file-upload-text {
  font-size: 13px;
  color: var(--ps-gray);
}

.logo-preview {
  max-width: 100px;
  max-height: 60px;
  margin-top: 8px;
}

/* Price Summary */
.price-summary {
  background: #f9f9f9;
  border-radius: 8px;
  padding: 16px;
}

.price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 14px;
}

.price-row:last-child { margin-bottom: 0; }

.price-row.total {
  font-weight: 700;
  font-size: 18px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--ps-border);
}

/* Buttons */
.btn-primary {
  background: var(--ps-orange);
  color: white;
  border: none;
  padding: 14px 28px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover { background: var(--ps-orange-hover); }
.btn-primary:disabled {
  background: var(--ps-light-gray);
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--ps-white);
  color: var(--ps-dark);
  border: 1px solid var(--ps-border);
  padding: 14px 28px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  border-color: var(--ps-orange);
  color: var(--ps-orange);
}

.back-btn {
  background: none;
  border: none;
  color: var(--ps-gray);
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 24px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.back-btn:hover { color: var(--ps-dark); }

.continue-section {
  display: flex;
  justify-content: center;
  padding-top: 24px;
}

/* Pages */
.page { display: block; }
.page.hidden { display: none; }

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: white;
  padding: 40px;
  border-radius: 16px;
  text-align: center;
  max-width: 400px;
}

.modal-icon { font-size: 64px; margin-bottom: 16px; }
.modal-title { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.modal-text { color: var(--ps-gray); margin-bottom: 24px; }

/* Campaign List */
.campaign-list { display: flex; flex-direction: column; gap: 16px; }

.campaign-item {
  background: var(--ps-white);
  border: 1px solid var(--ps-border);
  border-radius: 12px;
  padding: 20px;
}

.campaign-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.campaign-name { font-weight: 600; margin-bottom: 4px; }
.campaign-meta { font-size: 13px; color: var(--ps-gray); }

.campaign-status {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.status-delivered { background: #e8f5e9; color: #2e7d32; }
.status-transit { background: #fff3e0; color: #ef6c00; }
.status-production { background: #e3f2fd; color: #1976d2; }

.campaign-progress {
  height: 4px;
  background: var(--ps-border);
  border-radius: 2px;
  overflow: hidden;
}

.campaign-progress-bar {
  height: 100%;
  background: var(--ps-orange);
  border-radius: 2px;
}

/* Mailing List Section */
.mailing-list-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--ps-border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 8px;
}

.mailing-list-option:hover {
  border-color: var(--ps-orange);
}

.mailing-list-option.selected {
  border-color: var(--ps-orange);
  background: rgba(241, 103, 34, 0.05);
}

.mailing-list-option input[type="radio"] {
  accent-color: var(--ps-orange);
}

/* CSV Upload Section */
.csv-upload-section {
  display: none;
  margin-top: 16px;
  padding: 16px;
  background: #f9f9f9;
  border-radius: 8px;
}

.csv-upload-section.visible {
  display: block;
}

.csv-preview {
  margin-top: 12px;
  padding: 12px;
  background: white;
  border: 1px solid var(--ps-border);
  border-radius: 6px;
  font-size: 13px;
}

.csv-preview-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid var(--ps-border);
}

.csv-preview-row:last-child {
  border-bottom: none;
}

/* Style Selector */
.style-selector {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.style-option {
  flex: 1;
  padding: 16px;
  border: 2px solid var(--ps-border);
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.style-option:hover {
  border-color: var(--ps-orange);
}

.style-option.selected {
  border-color: var(--ps-orange);
  background: rgba(241, 103, 34, 0.05);
}

.style-option-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.style-option-desc {
  font-size: 12px;
  color: var(--ps-gray);
}

/* Helper text */
.help-text {
  font-size: 12px;
  color: var(--ps-gray);
  margin-top: 4px;
}

.sender-required-callout {
  display: none;
  margin: 0 0 12px;
  color: #c62828;
  font-size: 13px;
  font-weight: 600;
}

.sender-required-callout.visible {
  display: block;
}

.panel-section.sender-info-invalid {
  border-color: #f2a7a7;
}

/* Merge fields hint */
.merge-fields-hint {
  background: #e3f2fd;
  border-radius: 6px;
  padding: 12px;
  font-size: 12px;
  margin-bottom: 12px;
}

.merge-fields-hint strong {
  display: block;
  margin-bottom: 4px;
}

.merge-tag {
  display: inline-block;
  background: white;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: monospace;
  margin: 2px;
  cursor: pointer;
  border: 1px solid #90caf9;
}

.merge-tag:hover {
  background: #e3f2fd;
}

/* Split Test Slider */
.split-test-config {
  max-width: 600px;
  margin: 0 auto;
}

#split-slider {
  -webkit-appearance: none;
  appearance: none;
  height: 10px;
  border-radius: 5px;
  outline: none;
}

#split-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: white;
  border: 3px solid var(--ps-dark);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

#split-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: white;
  border: 3px solid var(--ps-dark);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* Campaign Builder Styles */
.campaign-builder-config {
  max-width: 700px;
  margin: 0 auto;
}

.interval-btn {
  padding: 10px 16px;
  border: 2px solid var(--ps-border);
  border-radius: 8px;
  background: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.interval-btn:hover {
  border-color: var(--ps-orange);
  color: var(--ps-orange);
}

.interval-btn.active {
  border-color: var(--ps-orange);
  background: var(--ps-orange);
  color: white;
}

/* Campaign Timeline */
.campaign-timeline {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  padding: 8px 0;
}

.timeline-piece {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 70px;
}

.timeline-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--ps-orange);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.timeline-circle.empty {
  background: #e0e0e0;
  color: var(--ps-gray);
}

.timeline-circle.scheduled {
  background: #4caf50;
}

.timeline-date {
  font-size: 11px;
  color: var(--ps-gray);
  margin-top: 6px;
  text-align: center;
}

.timeline-connector {
  flex: 1;
  height: 2px;
  background: #e0e0e0;
  min-width: 20px;
  position: relative;
}

.timeline-connector::after {
  content: attr(data-days);
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--ps-gray);
  white-space: nowrap;
}

/* Campaign Review Page */
.campaign-review {
  max-width: 900px;
  margin: 0 auto;
}

.piece-card {
  background: white;
  border: 2px solid var(--ps-border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  transition: all 0.2s;
}

.piece-card:hover {
  border-color: var(--ps-orange);
}

.piece-card.selected {
  border-color: var(--ps-orange);
  background: rgba(241, 103, 34, 0.03);
}

.piece-card.scheduled {
  border-color: #4caf50;
  background: rgba(76, 175, 80, 0.05);
}

.piece-card .piece-image {
  width: 120px;
  height: 80px;
  object-fit: contain;
  background: #f5f5f5;
  border-radius: 6px;
}

.piece-card .piece-info {
  flex: 1;
}

.piece-card .piece-number {
  font-size: 12px;
  color: var(--ps-gray);
  margin-bottom: 4px;
}

.piece-card .piece-name {
  font-weight: 600;
  margin-bottom: 4px;
}

.piece-card .piece-date {
  font-size: 13px;
  color: var(--ps-gray);
}

.piece-card .piece-status {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 500;
}

.piece-card .piece-status.pending {
  background: #fff3e0;
  color: #e65100;
}

.piece-card .piece-status.scheduled {
  background: #e8f5e9;
  color: #2e7d32;
}

/* Split Test Review */
.split-review {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 24px;
  align-items: start;
  max-width: 900px;
  margin: 0 auto;
}

.split-variant-card {
  background: white;
  border: 2px solid var(--ps-border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}

.split-variant-card.variant-a {
  border-color: var(--ps-orange);
}

.split-variant-card.variant-b {
  border-color: #2196F3;
}

.split-variant-card .variant-label {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}

.split-variant-card.variant-a .variant-label {
  color: var(--ps-orange);
}

.split-variant-card.variant-b .variant-label {
  color: #2196F3;
}

.split-variant-card .variant-image {
  width: 100%;
  max-width: 200px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.split-vs {
  font-size: 24px;
  font-weight: 700;
  color: var(--ps-gray);
  padding-top: 80px;
}

/* Exit Intent Modal */
.exit-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.exit-modal-overlay.show {
  display: flex;
}

.exit-modal {
  background: white;
  border-radius: 16px;
  padding: 32px;
  max-width: 480px;
  text-align: center;
}

.exit-modal-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.exit-modal-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
}

.exit-modal-text {
  color: var(--ps-gray);
  margin-bottom: 24px;
  line-height: 1.5;
}

.exit-modal-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* My Campaigns - Hierarchical View */
.campaign-group {
  background: white;
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
}

.campaign-group-header {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  border-bottom: 1px solid var(--ps-border);
}

.campaign-group-header:hover {
  background: #fafafa;
}

.campaign-group-title {
  font-weight: 600;
  font-size: 16px;
}

.campaign-group-meta {
  font-size: 13px;
  color: var(--ps-gray);
  margin-top: 4px;
}

.campaign-group-toggle {
  font-size: 18px;
  color: var(--ps-gray);
  transition: transform 0.2s;
}

.campaign-group.expanded .campaign-group-toggle {
  transform: rotate(180deg);
}

.campaign-group-content {
  display: none;
  padding: 0 20px 16px;
}

.campaign-group.expanded .campaign-group-content {
  display: block;
}

.campaign-order-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}

.campaign-order-item:last-child {
  border-bottom: none;
}

.order-piece-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.order-piece-thumb {
  width: 50px;
  height: 35px;
  object-fit: contain;
  background: #f5f5f5;
  border-radius: 4px;
}

.order-piece-name {
  font-weight: 500;
  font-size: 14px;
}

.order-piece-date {
  font-size: 12px;
  color: var(--ps-gray);
}

.order-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.order-status-badge {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 10px;
  font-weight: 500;
}

.order-status-badge.upcoming {
  background: #e3f2fd;
  color: #1565c0;
}

.order-status-badge.sent {
  background: #e8f5e9;
  color: #2e7d32;
}

.order-status-badge.cancelled {
  background: #ffebee;
  color: #c62828;
}

.cancel-order-btn {
  font-size: 12px;
  color: #c62828;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
}

.cancel-order-btn:hover {
  text-decoration: underline;
}

/* Upcoming Section */
.upcoming-section {
  background: #e3f2fd;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}

.upcoming-title {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 16px;
  color: #1565c0;
}

.upcoming-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 8px;
}

.upcoming-item:last-child {
  margin-bottom: 0;
}

.campaigns-context-warning {
  background: #fff8e1;
  border: 1px solid #ffe08a;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 20px;
  color: #7c5a00;
  font-size: 14px;
  line-height: 1.45;
}

.campaigns-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 36px 16px;
  margin-bottom: 24px;
  border-radius: 12px;
  background: #f8fbff;
  border: 1px solid #e3f2fd;
}

.campaigns-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid #d7e9fb;
  border-top-color: #1565c0;
  animation: campaigns-spin 0.8s linear infinite;
}

.campaigns-loading-text {
  color: #1565c0;
  font-size: 14px;
  font-weight: 500;
}

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


/* ============================================================
   RESPONSIVE + IFRAME STYLES
   ============================================================ */

/* ========== RESPONSIVE STYLES ========== */

/* Tablet (768px and below) */
@media (max-width: 768px) {
  .header {
    padding: 12px 16px;
  }
  
  .logo {
    height: 32px;
  }
  
  .my-campaigns-btn {
    padding: 8px 12px;
    font-size: 13px;
  }
  
  .main {
    padding: 16px;
  }
  
  .page-title {
    font-size: 24px;
  }
  
  .page-subtitle {
    font-size: 14px;
  }
  
  .campaign-types {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .campaign-type-card {
    padding: 20px 16px;
  }
  
  .campaign-type-icon {
    font-size: 36px;
  }
  
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .product-card {
    padding: 0;
  }

  .product-info {
    padding: 12px;
  }
  
  .product-name {
    font-size: 12px;
  }
  
  .category-tabs {
    flex-wrap: wrap;
    gap: 6px;
  }
  
  .category-tab {
    padding: 8px 12px;
    font-size: 12px;
  }
  
  .preview-container {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .preview-image-container {
    padding: 16px;
    order: -1; /* Show preview first on mobile */
  }
  
  .customize-panel {
    padding: 16px;
  }
  
  .panel-section {
    padding: 16px;
  }
  
  .form-row {
    flex-direction: column;
    gap: 12px;
  }
  
  .form-row .form-group {
    flex: none !important;
    width: 100%;
  }
  
  .btn-primary, .btn-secondary {
    padding: 14px 20px;
    font-size: 15px;
    min-height: 48px; /* Touch-friendly */
  }
  
  .merge-tag {
    padding: 6px 10px;
    font-size: 11px;
  }
  
  .interval-btn {
    padding: 10px 14px;
    font-size: 13px;
    min-height: 44px;
  }
  
  .campaign-builder-config {
    padding: 16px;
  }
  
  .campaign-timeline {
    gap: 8px;
    padding: 12px 0;
  }
  
  .timeline-piece {
    min-width: 50px;
  }
  
  .timeline-circle {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }
  
  .price-summary {
    padding: 16px;
  }
  
  .modal-content {
    margin: 16px;
    padding: 24px 20px;
    max-width: calc(100% - 32px);
  }
  
  .exit-modal {
    margin: 16px;
    padding: 24px 20px;
    max-width: calc(100% - 32px);
  }
  
  .split-review {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .split-vs {
    padding: 8px 0;
    font-size: 20px;
  }
  
  .campaign-review {
    padding: 16px;
  }
  
  .piece-card {
    flex-direction: column;
    text-align: center;
  }
  
  .piece-image {
    width: 100%;
    max-width: 200px;
    margin: 0 auto;
  }
  
  /* Campaign groups */
  .campaign-group-header {
    padding: 12px;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .campaign-order-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .upcoming-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  /* My Info section */
  .my-info-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
}

/* Small phones (480px and below) */
@media (max-width: 480px) {
  .main {
    padding: 12px;
  }
  
  .page-title {
    font-size: 20px;
  }
  
  .product-grid {
    grid-template-columns: 1fr;
  }
  
  .product-card {
    display: flex;
    flex-direction: row;
    gap: 12px;
    text-align: left;
  }
  
  .product-image {
    width: 80px;
    height: 60px;
    flex-shrink: 0;
  }
  
  .product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0;
  }
  
  .preview-tabs {
    flex-wrap: wrap;
  }
  
  .preview-tab {
    flex: 1;
    min-width: 80px;
    text-align: center;
    padding: 10px 8px;
  }
  
  .category-tabs {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
  }
  
  .category-tab {
    flex-shrink: 0;
  }
  
  .steps {
    gap: 8px;
  }
  
  .step-dot {
    width: 10px;
    height: 10px;
  }
  
  .interval-buttons {
    flex-wrap: wrap;
  }
  
  .interval-btn {
    flex: 1 1 calc(50% - 4px);
  }
  
  .exit-modal-buttons {
    flex-direction: column;
    gap: 8px;
  }
  
  .exit-modal-buttons button {
    width: 100%;
  }
}

/* Ensure touch targets are large enough */
@media (pointer: coarse) {
  .product-card,
  .category-tab,
  .interval-btn,
  .preview-tab,
  .merge-tag,
  .campaign-type-card,
  .campaign-group-header {
    min-height: 44px;
  }
  
  input[type="text"],
  input[type="tel"],
  input[type="date"],
  input[type="number"],
  textarea,
  select {
    min-height: 44px;
    font-size: 16px; /* Prevents iOS zoom on focus */
  }
}

/* Print styles (hide non-essential elements) */
@media print {
  .header,
  .steps,
  .btn-primary,
  .btn-secondary,
  .category-tabs {
    display: none !important;
  }
}

/* Toast Notification */
.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--ps-dark);
  color: white;
  padding: 16px 24px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  max-width: 90%;
}

.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.toast-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 2px;
}

.toast-subtitle {
  font-size: 13px;
  opacity: 0.8;
}

.toast-image {
  width: 48px;
  height: 36px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.1);
}

@media (max-width: 480px) {
  .toast {
    top: 70px;
    padding: 12px 16px;
    gap: 10px;
  }
  .toast-title {
    font-size: 14px;
  }
  .toast-subtitle {
    font-size: 12px;
  }
  .toast-image {
    width: 40px;
    height: 30px;
  }
}

/* ========== IFRAME MODE STYLES ========== */
body.iframe-mode {
  min-height: auto;
}

body.iframe-mode .header {
  display: none;
}

body.iframe-mode .main {
  padding-top: 20px;
}

body.iframe-mode .toast {
  top: 20px;
}

/* Compact header option for iframe */
body.iframe-mode.show-header .header {
  display: flex;
  padding: 12px 20px;
}

body.iframe-mode.show-header .header .logo {
  height: 24px;
}

body.iframe-mode.show-header .main {
  padding-top: 24px;
}

/* Hide My Campaigns in iframe - PropStream manages this */
body.iframe-mode .my-campaigns-btn {
  display: none;
}

body.iframe-mode #page-campaigns {
  display: none !important;
}

/* CSP inline-style replacements (auto-generated) */
.csp-inline-1 { background: var(--ps-white); border-radius: 12px; padding: 32px; margin-bottom: 24px; }
.csp-inline-2 { flex: 2; }
.csp-inline-3 { flex: 1; }
.csp-inline-4 { background: #e3f2fd; border-radius: 8px; padding: 16px; margin-bottom: 24px; display: flex; gap: 12px; align-items: flex-start; }
.csp-inline-5 { font-size: 20px; }
.csp-inline-6 { display: block; margin-bottom: 4px; }
.csp-inline-7 { font-size: 14px; color: var(--ps-gray); }
.csp-inline-8 { width: 100%; }
.csp-inline-9 { width: 100%; margin-top: 12px; }
.csp-inline-10 { text-align: right; }
.csp-inline-11 { font-size: 14px; opacity: 0.8; }
.csp-inline-12 { font-weight: 600; }
.csp-inline-13 { width: 100%; display: none; }
.csp-inline-14 { display: none; }
.csp-inline-15 { background: var(--ps-white); border-radius: 12px; padding: 24px; margin-bottom: 24px; }
.csp-inline-16 { font-size: 18px; font-weight: 600; margin-bottom: 16px; }
.csp-inline-17 { display: flex; justify-content: space-between; margin-bottom: 8px; }
.csp-inline-18 { font-weight: 600; color: var(--ps-orange); }
.csp-inline-19 { font-weight: 600; color: #2196F3; }
.csp-inline-20 { position: relative; margin-bottom: 8px; }
.csp-inline-21 { width: 100%; height: 8px; -webkit-appearance: none; background: linear-gradient(to right, var(--ps-orange) 50%, #2196F3 50%); border-radius: 4px; cursor: pointer; }
.csp-inline-22 { display: flex; justify-content: space-between; font-size: 13px; color: var(--ps-gray); }
.csp-inline-23 { background: #fff3e0; border-radius: 8px; padding: 16px; margin-top: 20px; display: flex; gap: 12px; align-items: flex-start; }
.csp-inline-24 { font-size: 18px; font-weight: 600; margin-bottom: 20px; }
.csp-inline-25 { margin-bottom: 24px; }
.csp-inline-26 { display: block; font-weight: 500; margin-bottom: 8px; }
.csp-inline-27 { display: flex; align-items: center; gap: 16px; }
.csp-inline-28 { flex: 1; height: 8px; -webkit-appearance: none; background: linear-gradient(to right, var(--ps-orange) 25%, #e0e0e0 25%); border-radius: 4px; cursor: pointer; }
.csp-inline-29 { font-size: 24px; font-weight: 700; color: var(--ps-orange); min-width: 40px; text-align: center; }
.csp-inline-30 { display: flex; gap: 8px; flex-wrap: wrap; }
.csp-inline-31 { display: none; margin-top: 12px; }
.csp-inline-32 { width: 100px; }
.csp-inline-33 { background: #f9f9f9; border-radius: 8px; padding: 16px; margin-bottom: 20px; }
.csp-inline-34 { font-size: 13px; color: var(--ps-gray); margin-bottom: 12px; }
.csp-inline-35 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 16px; background: #fff3e0; border-radius: 8px; }
.csp-inline-36 { font-size: 12px; color: var(--ps-gray); }
.csp-inline-37 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.csp-inline-38 { background: #f9f9f9; border-radius: 12px; padding: 20px; margin-top: 24px; }
.csp-inline-39 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; text-align: center; }
.csp-inline-40 { font-size: 24px; font-weight: 700; }
.csp-inline-41 { font-size: 24px; font-weight: 700; color: var(--ps-orange); }
.csp-inline-42 { margin-top: 24px; }
.csp-inline-43 { text-align: center; font-size: 13px; color: var(--ps-gray); margin-top: 12px; }
.csp-inline-44 { font-weight: 500; margin-bottom: 4px; }
.csp-inline-45 { font-size: 13px; color: var(--ps-gray); }
.csp-inline-46 { max-width: 500px; margin: 32px auto; background: var(--ps-white); border-radius: 12px; padding: 24px; }
.csp-inline-47 { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.csp-inline-48 { max-width: 500px; margin: 0 auto 24px; background: #fff3e0; border-radius: 8px; padding: 16px; display: flex; gap: 12px; align-items: flex-start; }
.csp-inline-49 { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.csp-inline-50 { margin-bottom: 0; }
.csp-inline-51 { background: none; border: none; color: var(--ps-orange); font-size: 14px; font-weight: 500; cursor: pointer; }
.csp-inline-52 { background: #f9f9f9; border-radius: 8px; padding: 12px; font-size: 13px; line-height: 1.5; }
.csp-inline-53 { color: var(--ps-gray); }
.csp-inline-54 { color: var(--ps-gray); margin-top: 4px; }
.csp-inline-55 { margin-left: 8px; color: #999; font-size: 12px; }
.csp-inline-56 { background: #e8f5e9; border-radius: 8px; padding: 12px; margin-top: 12px; display: flex; gap: 10px; align-items: flex-start; }
.csp-inline-57 { font-size: 16px; }
.csp-inline-58 { font-size: 13px; }
.csp-inline-59 { background: #f0f7ff; border: 1px solid #c2d9f2; border-radius: 8px; padding: 16px; }
.csp-inline-60 { display: flex; align-items: center; gap: 12px; }
.csp-inline-61 { font-size: 24px; }
.csp-inline-62 { font-weight: 600; margin-bottom: 2px; }
.csp-inline-63 { color: var(--ps-gray); font-size: 13px; }
.csp-inline-64 { width: 100%; margin-top: 16px; }
.csp-inline-65 { display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px; }
.csp-inline-66 { margin-top: 48px; }
.csp-inline-67 { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.csp-inline-68 { font-size: 20px; font-weight: 600; }
.csp-inline-69 { background: var(--ps-white); border-radius: 12px; padding: 20px; }
.csp-inline-70 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.csp-inline-71 { font-size: 12px; color: var(--ps-gray); margin-bottom: 4px; }
.csp-inline-72 { font-weight: 500; }
.csp-inline-73 { font-weight: 500; white-space: pre-line; }
.csp-inline-74 { display: none; background: var(--ps-white); border-radius: 12px; padding: 24px; }
.csp-inline-75 { display: flex; gap: 12px; margin-top: 16px; }
.csp-inline-76 { max-width: 400px; }
.csp-inline-77 { display: flex; gap: 12px; justify-content: center; margin-top: 20px; }
.csp-inline-78 { background: #c62828; }
.csp-inline-79 { max-width: 480px; }
.csp-inline-80 { background: #fff8e1; border-radius: 8px; padding: 16px; margin: 16px 0; text-align: left; }
.csp-inline-81 { font-weight: 600; margin-bottom: 8px; color: #f57c00; }
.csp-inline-82 { margin: 0; padding-left: 20px; font-size: 14px; color: #666; line-height: 1.6; }
.csp-inline-83 { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.csp-inline-84 { background: var(--ps-orange); }
.csp-inline-85 { background: none; border: none; color: #999; font-size: 13px; cursor: pointer; padding: 8px; }
