/**
 * preview-modal.css — Styles for the paystub preview modal
 * Two-column comparison: Premium (paid) vs Free version
 * Includes template selector sidebar + color swatch picker
 */

/* ============================================
   OVERLAY
   ============================================ */
.pm-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  overflow-y: auto;
  padding: 30px 16px;
}

/* ============================================
   MODAL CONTAINER
   ============================================ */
.pm-modal {
  position: relative;
  background: #fff;
  border-radius: 16px;
  max-width: 1240px;
  width: 100%;
  padding: 36px 32px 32px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
  animation: previewSlideIn 0.3s ease-out;
}

@keyframes previewSlideIn {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pm-modal > h2 {
  text-align: center;
  font-size: 1.5rem;
  color: #1B2A4A;
  margin: 0 0 4px;
}

.pm-modal > p {
  text-align: center;
  color: #666;
  font-size: 0.95rem;
  margin: 0 0 24px;
}

/* Close button */
.preview-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 28px;
  color: #999;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
}

.preview-close:hover {
  background: #f0f0f0;
  color: #333;
}

/* ============================================
   PM BODY — sidebar + previews side by side
   ============================================ */
.pm-body {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.pm-previews {
  flex: 1;
  min-width: 0;
}

/* ============================================
   CONTROLS SIDEBAR (desktop)
   ============================================ */
.pm-controls {
  flex: 0 0 180px;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: sticky;
  top: 0;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
}

.pm-ctrl-section {
  padding: 16px 14px;
}

.pm-ctrl-section + .pm-ctrl-section {
  border-top: 1.5px solid #e2e8f0;
}

.pm-ctrl-section h4 {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #64748b;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pm-ctrl-paid-tag {
  font-size: 0.62rem;
  font-weight: 700;
  background: linear-gradient(135deg, #fbbf24, #d97706);
  color: #fff;
  padding: 2px 7px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ---- Template list ---- */
.pm-template-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pm-tpl-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  color: #475569;
  transition: border-color 0.18s, background 0.18s, color 0.18s, box-shadow 0.18s;
  text-align: left;
  position: relative;
}

.pm-tpl-btn:hover {
  border-color: #94a3b8;
  background: #f1f5f9;
  color: #1e293b;
}

.pm-tpl-btn.active {
  border-color: #1B2A4A;
  background: #fff;
  color: #1B2A4A;
  box-shadow: 0 2px 8px rgba(27, 42, 74, 0.15);
}

/* Checkmark shown on active button */
.pm-tpl-btn.active::after {
  content: '✓';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  color: #1B2A4A;
  font-weight: 700;
}

/* Mini template thumbnail icon */
.pm-tpl-icon {
  flex-shrink: 0;
  width: 32px;
  height: 40px;
  border: 1.5px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 4px 3px 3px;
  overflow: hidden;
}

.pm-tpl-btn.active .pm-tpl-icon {
  border-color: #1B2A4A;
}

.tpl-bar {
  display: block;
  border-radius: 1px;
  width: 100%;
  flex-shrink: 0;
}

.tpl-bar--header        { height: 7px; background: #1B2A4A; }
.tpl-bar--header.tpl-bar--gradient { background: linear-gradient(90deg, #0f172a, #1e3a8a); }
.tpl-bar--header.tpl-bar--green    { height: 5px; background: #166534; }
.tpl-bar--header.tpl-bar--thin     { height: 4px; }
.tpl-bar--teal          { height: 2px; background: #0d9488; }
.tpl-bar--row           { height: 4px; background: #e2e8f0; }

/* ---- Color swatches ---- */
.pm-color-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pm-color-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  /* Inner white ring + outer dark ring = always visible regardless of color */
  border: 3px solid #fff;
  outline: 2px solid #d1d5db;
  cursor: pointer;
  transition: transform 0.15s, outline-color 0.15s, box-shadow 0.15s;
  padding: 0;
  display: block;
  flex-shrink: 0;
  appearance: none;
  -webkit-appearance: none;
}

.pm-color-btn:hover {
  transform: scale(1.2);
  outline-color: #64748b;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.pm-color-btn.active {
  outline-color: #1B2A4A;
  outline-width: 2.5px;
  transform: scale(1.18);
  box-shadow: 0 0 0 4px rgba(27, 42, 74, 0.18);
}

.pm-color-hint {
  margin: 8px 0 0;
  font-size: 0.72rem;
  color: #94a3b8;
  line-height: 1.4;
}

/* ============================================
   STUB NAVIGATION TABS (Paystub 1 / 2 / 3)
   ============================================ */
.pm-stub-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: #f0f4ff;
  border: 1.5px solid #c7d2fe;
  border-radius: 10px;
}

.pm-stub-nav-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #4b5563;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-right: 4px;
  white-space: nowrap;
}

.pm-stub-tab {
  padding: 6px 16px;
  border: 2px solid #c7d2fe;
  border-radius: 20px;
  background: #fff;
  color: #4338ca;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  line-height: 1.4;
}

.pm-stub-tab:hover {
  background: #e0e7ff;
  border-color: #818cf8;
}

.pm-stub-tab.active {
  background: #4338ca;
  border-color: #4338ca;
  color: #fff;
  box-shadow: 0 2px 8px rgba(67, 56, 202, 0.3);
}

.pm-stub-date {
  font-weight: 400;
  font-size: 0.78rem;
  opacity: 0.85;
}

/* Mobile: nav wraps neatly */
@media (max-width: 768px) {
  .pm-stub-nav {
    gap: 5px;
    padding: 8px 10px;
  }
  .pm-stub-tab {
    padding: 5px 12px;
    font-size: 0.78rem;
  }
}

/* ============================================
   TWO-COLUMN PREVIEW LAYOUT
   ============================================ */
.preview-columns {
  display: flex;
  gap: 24px;
  align-items: stretch;
}

.preview-col {
  flex: 1;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: border-color 0.2s;
}

.preview-col.premium {
  border-color: #d4a017;
}

.preview-col.premium:hover {
  border-color: #b8860b;
}

.preview-col.free {
  border-color: #d1d5db;
}

/* ============================================
   BADGES
   ============================================ */
.preview-badge {
  display: inline-block;
  padding: 4px 16px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 14px;
  text-align: center;
  align-self: center;
}

.premium-badge {
  background: linear-gradient(135deg, #f6d365, #d4a017);
  color: #5a3e00;
}

.free-badge {
  background: #e5e7eb;
  color: #6b7280;
}

/* ============================================
   PDF PREVIEW CONTAINER
   ============================================ */
.preview-pdf-container {
  width: 100%;
  aspect-ratio: 8.5 / 11;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  background: #f9fafb;
  margin-bottom: 14px;
}

.preview-pdf-container iframe,
.preview-pdf-container canvas,
.preview-pdf-container img {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  object-fit: contain;
}

/* ============================================
   WATERMARK NOTE
   ============================================ */
.preview-watermark-note {
  text-align: center;
  font-size: 0.82rem;
  color: #92400e;
  background: #fef3c7;
  border-radius: 6px;
  padding: 6px 12px;
  margin-bottom: 12px;
}

.lock-icon {
  margin-right: 4px;
}

/* ============================================
   FEATURE LIST
   ============================================ */
.preview-features {
  margin-bottom: 16px;
  flex: 1;
}

.feature-item {
  font-size: 0.88rem;
  color: #374151;
  padding: 4px 0;
  line-height: 1.5;
}

.feature-item.dimmed {
  color: #9ca3af;
}

.free-features .feature-item:last-child {
  font-size: 0.8rem;
  color: #6b7280;
  margin-top: 4px;
}

/* ============================================
   PRICING / CTA BUTTONS
   ============================================ */
.preview-pricing {
  text-align: center;
}

.btn-buy-preview {
  display: block;
  width: 100%;
  padding: 14px 24px;
  background: #1B2A4A;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  margin-bottom: 8px;
}

.btn-buy-preview:hover {
  background: #263a5e;
  transform: translateY(-1px);
}

.btn-buy-preview:active {
  transform: translateY(0);
}

.see-all-plans {
  display: inline-block;
  font-size: 0.88rem;
  color: #16a34a;
  font-weight: 600;
  text-decoration: none;
  padding: 8px 16px;
  border: 1.5px dashed #22C55E;
  border-radius: 8px;
  margin-top: 6px;
  transition: background 0.2s, color 0.2s;
}

.see-all-plans:hover {
  background: #f0fdf4;
  color: #15803d;
}

.see-all-plans .save-icon {
  color: #f59e0b;
  margin-right: 4px;
}

.btn-free-download {
  display: block;
  width: 100%;
  padding: 14px 24px;
  background: #fff;
  color: #374151;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.btn-free-download:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

/* ============================================
   EMAIL SUB-MODAL
   ============================================ */
.email-modal {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
}

.email-modal-content {
  position: relative;
  background: #fff;
  border-radius: 12px;
  max-width: 420px;
  width: 90%;
  padding: 32px 28px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
  text-align: center;
}

.email-modal-content h3 {
  margin: 0 0 8px;
  font-size: 1.2rem;
  color: #1B2A4A;
}

.email-modal-content p {
  margin: 0 0 20px;
  font-size: 0.9rem;
  color: #666;
}

.email-modal-content input[type="email"] {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  font-size: 1rem;
  margin-bottom: 14px;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.email-modal-content input[type="email"]:focus {
  border-color: #2563eb;
}

.email-modal-content .btn-primary {
  display: block;
  width: 100%;
  padding: 12px 24px;
  background: #1B2A4A;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  margin-bottom: 10px;
}

.email-modal-content .btn-primary:hover {
  background: #263a5e;
}

.email-modal-content .btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.email-disclaimer {
  font-size: 0.78rem;
  color: #9ca3af;
  margin: 0;
}

.email-success {
  color: #16a34a;
  font-weight: 600;
}

.email-error {
  color: #dc2626;
  font-size: 0.85rem;
  margin-top: 8px;
}

/* ============================================
   RESPONSIVE: TABLET (sidebar compresses)
   ============================================ */
@media (max-width: 960px) {
  .pm-controls {
    flex: 0 0 150px;
  }

  .pm-tpl-btn {
    padding: 8px 9px;
    font-size: 0.82rem;
  }
}

/* ============================================
   RESPONSIVE: MOBILE — controls become top bar
   ============================================ */
@media (max-width: 768px) {
  .pm-overlay {
    padding: 16px 8px;
  }

  .pm-modal {
    padding: 24px 14px 20px;
  }

  /* Stack body: controls on top, previews below */
  .pm-body {
    flex-direction: column;
    gap: 16px;
  }

  /* Controls become a compact top bar */
  .pm-controls {
    flex: none;
    width: 100%;
    flex-direction: column;
    gap: 10px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px 14px;
    position: static; /* remove sticky on mobile */
  }

  /* Each section is a horizontal row: label + scrollable options */
  .pm-ctrl-section {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .pm-ctrl-section h4 {
    flex-shrink: 0;
    margin: 0;
    min-width: 64px;
    font-size: 0.7rem;
  }

  /* Template buttons scroll horizontally */
  .pm-template-list {
    flex-direction: row;
    overflow-x: auto;
    gap: 7px;
    flex: 1;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .pm-template-list::-webkit-scrollbar { display: none; }

  .pm-tpl-btn {
    flex-shrink: 0;
    padding: 6px 12px;
    font-size: 0.82rem;
    white-space: nowrap;
  }

  /* Hide the mini icon thumbnail on mobile to save space */
  .pm-tpl-icon {
    display: none;
  }

  /* Color swatches stretch to a single row */
  .pm-color-list {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 6px;
    flex: 1;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .pm-color-list::-webkit-scrollbar { display: none; }

  .pm-color-btn {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
  }

  .pm-color-hint {
    display: none; /* hide hint on mobile */
  }

  /* Stack preview columns */
  .preview-columns {
    flex-direction: column;
    gap: 20px;
  }

  .preview-col {
    padding: 16px;
  }

  .pm-modal > h2 {
    font-size: 1.25rem;
  }

  .btn-buy-preview,
  .btn-free-download {
    padding: 12px 18px;
    font-size: 0.95rem;
  }
}
