/* =============================================
   LETTERHEAD GENERATOR — STYLES
   ============================================= */

/* Layout */
.lh-layout {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 2rem;
  align-items: start;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

.lh-form-panel {
  min-width: 0;
}

.lh-preview-panel {
  position: sticky;
  top: calc(var(--nav-h, 64px) + 1rem);
}

/* Section titles */
.lh-section-title {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--navy);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}

/* Industry selector */
.lh-industry-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.lh-industry-card {
  padding: 0.75rem;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  background: #fff;
}
.lh-industry-card:hover { border-color: var(--green); }
.lh-industry-card.active {
  border-color: var(--green);
  background: var(--green-pale);
}
.lh-industry-card .lh-ic-icon { font-size: 1.4rem; display: block; margin-bottom: 0.25rem; }
.lh-industry-card .lh-ic-label { font-size: 0.72rem; font-weight: 500; color: var(--navy); line-height: 1.3; }

/* Style selector */
.lh-style-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.lh-style-card {
  padding: 0.6rem 0.5rem;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  background: #fff;
}
.lh-style-card:hover { border-color: var(--green); }
.lh-style-card.active {
  border-color: var(--green);
  background: var(--green-pale);
}
.lh-style-card .lh-sc-name { font-size: 0.78rem; font-weight: 600; color: var(--navy); }
.lh-style-card .lh-sc-desc { font-size: 0.65rem; color: var(--muted); margin-top: 2px; }

/* Color picker */
.lh-color-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1.5rem;
}

.lh-color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.lh-color-swatch:hover { transform: scale(1.15); }
.lh-color-swatch.active {
  border-color: var(--navy);
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--navy);
}

.lh-custom-hex {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 0.5rem;
}
.lh-custom-hex label { font-size: 0.72rem; color: var(--muted); }
.lh-custom-hex input[type="text"] {
  width: 80px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 0.78rem;
  font-family: monospace;
}

/* Form fields */
.lh-form-group {
  margin-bottom: 1rem;
}
.lh-form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--navy);
  margin-bottom: 0.25rem;
}
.lh-form-group .lh-hint {
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 2px;
}
.lh-form-group input[type="text"],
.lh-form-group input[type="tel"],
.lh-form-group input[type="email"],
.lh-form-group input[type="number"],
.lh-form-group textarea,
.lh-form-group select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  background: #fff;
  transition: border-color 0.2s;
}
.lh-form-group input:focus,
.lh-form-group textarea:focus,
.lh-form-group select:focus {
  outline: none;
  border-color: var(--green);
}
.lh-form-group textarea { resize: vertical; min-height: 60px; }

.lh-form-group.invalid input,
.lh-form-group.invalid textarea {
  border-color: #C8102E;
}
.lh-form-group .lh-error {
  font-size: 0.65rem;
  color: #C8102E;
  margin-top: 2px;
  display: none;
}
.lh-form-group.invalid .lh-error { display: block; }

.lh-required::after { content: ' *'; color: #C8102E; }

/* Logo upload */
.lh-logo-upload {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.lh-logo-upload .lh-logo-preview {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  border: 1.5px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg);
  flex-shrink: 0;
}
.lh-logo-upload .lh-logo-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.lh-logo-upload .lh-logo-info { font-size: 0.72rem; color: var(--muted); }
.lh-logo-upload .lh-logo-info strong { color: var(--navy); display: block; margin-bottom: 2px; }
.lh-logo-upload input[type="file"] { display: none; }
.lh-logo-btn {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.2s;
}
.lh-logo-btn:hover { border-color: var(--green); color: var(--green); }

/* Generate button */
.lh-generate-btn {
  width: 100%;
  padding: 0.85rem;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 1rem;
}
.lh-generate-btn:hover { background: #257a57; }

/* ── Preview ── */
.lh-preview-frame {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.lh-preview-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.lh-a4-wrap {
  padding: 0.75rem;
  background: #f0f0f0;
}

.lh-a4 {
  aspect-ratio: 210 / 297;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
  overflow: hidden;
  position: relative;
  font-size: 6.5px; /* scaled down for preview */
  line-height: 1.5;
  padding: 3em;
  display: flex;
  flex-direction: column;
}

.lh-a4 * { box-sizing: border-box; }

/* Preview header area */
.lh-prev-header {
  padding-bottom: 1.5em;
  margin-bottom: 1.5em;
}

/* Classic style header */
.lh-prev-header.style-classic {
  text-align: center;
}
.lh-prev-header.style-classic .lh-prev-banner {
  padding: 1.2em 1.5em;
  margin: -3em -3em 1.5em -3em;
  color: #fff;
}
.lh-prev-header.style-classic .lh-prev-company {
  font-size: 2.4em;
  font-weight: 700;
  margin-bottom: 0.15em;
}
.lh-prev-header.style-classic .lh-prev-tagline {
  font-size: 1em;
  opacity: 0.85;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.lh-prev-header.style-classic .lh-prev-contact-row {
  display: flex;
  justify-content: center;
  gap: 1.5em;
  font-size: 0.85em;
  color: #555;
  flex-wrap: wrap;
}

/* Modern style header */
.lh-prev-header.style-modern {
  text-align: left;
  border-left-width: 4px;
  border-left-style: solid;
  padding-left: 1.5em;
}
.lh-prev-header.style-modern .lh-prev-company {
  font-size: 2.2em;
  font-weight: 700;
  margin-bottom: 0.15em;
}
.lh-prev-header.style-modern .lh-prev-tagline {
  font-size: 0.95em;
  opacity: 0.7;
  margin-bottom: 0.8em;
}
.lh-prev-header.style-modern .lh-prev-contact-row {
  display: flex;
  gap: 1.5em;
  font-size: 0.8em;
  color: #555;
  flex-wrap: wrap;
}

/* Minimal style header */
.lh-prev-header.style-minimal {
  text-align: left;
  border-bottom-width: 0.5px;
  border-bottom-style: solid;
  border-bottom-color: #ddd;
  padding-bottom: 1.2em;
}
.lh-prev-header.style-minimal .lh-prev-company {
  font-size: 1.8em;
  font-weight: 300;
  letter-spacing: 0.05em;
  margin-bottom: 0.3em;
}
.lh-prev-header.style-minimal .lh-prev-tagline {
  font-size: 0.8em;
  color: #999;
  margin-bottom: 0.6em;
}
.lh-prev-header.style-minimal .lh-prev-contact-row {
  display: flex;
  gap: 1.5em;
  font-size: 0.75em;
  color: #888;
  flex-wrap: wrap;
}

/* Bold style header */
.lh-prev-header.style-bold .lh-prev-banner {
  padding: 1.8em 2em;
  margin: -3em -3em 1.5em -3em;
  color: #fff;
}
.lh-prev-header.style-bold .lh-prev-company {
  font-size: 3em;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.1em;
}
.lh-prev-header.style-bold .lh-prev-tagline {
  font-size: 1em;
  opacity: 0.85;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.lh-prev-header.style-bold .lh-prev-contact-row {
  display: flex;
  gap: 1.5em;
  font-size: 0.8em;
  color: #555;
  flex-wrap: wrap;
  margin-top: 0.5em;
}

/* Logo in header */
.lh-prev-logo {
  margin-bottom: 0.8em;
}
.lh-prev-logo img {
  max-height: 5em;
  max-width: 12em;
  object-fit: contain;
}
.style-classic .lh-prev-logo { text-align: center; }
.style-classic .lh-prev-logo img { margin: 0 auto; display: block; }
.style-bold .lh-prev-logo img { filter: brightness(0) invert(1); }

/* Preview body */
.lh-prev-body {
  flex: 1;
  font-size: 0.9em;
  color: #444;
}
.lh-prev-body .lh-prev-date { margin-bottom: 1.5em; color: #888; }
.lh-prev-body .lh-prev-to { margin-bottom: 1em; }
.lh-prev-body .lh-prev-subject { font-weight: 600; margin-bottom: 1em; }
.lh-prev-body .lh-prev-salutation { margin-bottom: 1em; }
.lh-prev-body .lh-prev-placeholder {
  border: 1px dashed #ccc;
  padding: 1.5em;
  text-align: center;
  color: #bbb;
  font-style: italic;
  border-radius: 4px;
  margin-bottom: 2em;
}
.lh-prev-body .lh-prev-closing { margin-top: 2em; }
.lh-prev-body .lh-prev-signatory { margin-top: 3em; font-weight: 600; }
.lh-prev-body .lh-prev-designation { font-size: 0.85em; color: #666; }

/* Preview footer */
.lh-prev-footer {
  border-top: 0.5px solid #ddd;
  padding-top: 0.8em;
  margin-top: auto;
  font-size: 0.7em;
  color: #999;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5em;
}

/* Extra fields section */
.lh-extra-fields {
  margin-top: 0.5rem;
}
.lh-extra-fields:empty { display: none; }

/* ── Email Gate Modal ── */
.lh-modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}
.lh-modal-overlay.active { display: flex; }

.lh-modal {
  background: #fff;
  border-radius: 12px;
  padding: 2rem;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
.lh-modal h3 {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  color: var(--navy);
  margin-bottom: 0.5rem;
}
.lh-modal .lh-modal-sub {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}
.lh-modal .lh-form-group { margin-bottom: 0.75rem; }
.lh-modal .lh-consent-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.75rem 0;
}
.lh-modal .lh-consent-row input[type="checkbox"] { margin-top: 3px; }
.lh-modal .lh-consent-row label { font-size: 0.72rem; color: var(--muted); cursor: pointer; }
.lh-modal .lh-modal-btn {
  width: 100%;
  padding: 0.75rem;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.lh-modal .lh-modal-btn:hover { background: #257a57; }
.lh-modal .lh-modal-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.lh-modal .lh-modal-footer {
  font-size: 0.65rem;
  color: var(--muted);
  text-align: center;
  margin-top: 0.75rem;
}
.lh-modal .lh-modal-close {
  float: right;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  line-height: 1;
}

/* Success state */
.lh-modal-success {
  text-align: center;
  padding: 1rem 0;
}
.lh-modal-success .lh-success-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}
.lh-modal-success h3 { text-align: center; }
.lh-modal-success .lh-wa-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  background: #25D366;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  margin-top: 1rem;
}

/* Mobile preview toggle */
.lh-preview-toggle {
  display: none;
  width: 100%;
  padding: 0.6rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--navy);
  cursor: pointer;
  text-align: center;
  margin-bottom: 1rem;
}

/* SEO content */
.lh-seo-section {
  max-width: 800px;
  margin: 3rem auto;
  padding: 0 1.25rem;
}
.lh-seo-section h2 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: var(--navy);
  margin-bottom: 0.75rem;
}
.lh-seo-section p {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.8;
  margin-bottom: 1rem;
}

/* FAQ section */
.lh-faq { max-width: 800px; margin: 2rem auto; padding: 0 1.25rem; }
.lh-faq h2 { font-family: var(--font-serif); font-size: 1.5rem; color: var(--navy); margin-bottom: 1rem; }
.lh-faq details {
  border-bottom: 1px solid var(--line);
  padding: 0.75rem 0;
}
.lh-faq summary {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--navy);
  cursor: pointer;
  list-style: none;
}
.lh-faq summary::-webkit-details-marker { display: none; }
.lh-faq summary::before { content: '+ '; font-weight: 600; color: var(--green); }
.lh-faq details[open] summary::before { content: '− '; }
.lh-faq details p {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.7;
  margin-top: 0.5rem;
  padding-left: 1rem;
}

/* ── Toast ── */
.lh-toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--navy);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.82rem;
  z-index: 1100;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s;
  pointer-events: none;
}
.lh-toast.show { opacity: 1; transform: translateY(0); }
.lh-toast.error { background: #C8102E; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .lh-layout {
    grid-template-columns: 1fr;
  }
  .lh-preview-panel {
    position: static;
    order: -1;
  }
  .lh-preview-toggle { display: block; }
  .lh-preview-frame.collapsed { display: none; }
  .lh-industry-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .lh-layout { padding: 1rem; }
  .lh-style-grid { grid-template-columns: repeat(2, 1fr); }
  .lh-a4 { font-size: 5px; }
}
