/* =============================================================================
 * WI-227 — Hybrid Email Composer styles
 *
 * Modal shell that opens over the inquiry drawer with a two-pane layout:
 *   LEFT  — form (template picker, subject, section toggles, body)
 *   RIGHT — live preview (sandboxed iframe rendering the rendered HTML)
 *
 * Visual language matches ops-drawer / services-modal — pale surface, blue
 * accents, compact controls, generous spacing around the iframe so the
 * preview doesn't feel claustrophobic. Uses booking-links.css tokens
 * (--color-primary, --color-bg-page etc.) already loaded on every admin page.
 * ============================================================================= */

.hec-root {
  position: fixed;
  inset: 0;
  z-index: 5200; /* above side-panel (5000-ish) so composer wins when opened from drawer */
  display: none;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 28px 16px;
}

.hec-root.hec-open {
  display: flex;
}

.hec-dialog {
  width: min(1180px, 100%);
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.35);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 56px);
}

.hec-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 22px;
  background: #1a365d;
  color: #ffffff;
}

.hec-title {
  font-family: "Inter", sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.hec-subtitle {
  font-size: 12px;
  opacity: 0.85;
  margin-top: 2px;
  font-family: "Inter", sans-serif;
}

.hec-close-btn {
  background: transparent;
  border: 0;
  color: #ffffff;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 6px;
}

.hec-close-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.hec-body {
  display: grid;
  grid-template-columns: minmax(340px, 460px) 1fr;
  min-height: 480px;
  flex: 1 1 auto;
  overflow: hidden;
}

@media (max-width: 880px) {
  .hec-body {
    grid-template-columns: 1fr;
  }
}

.hec-form {
  padding: 18px 20px;
  overflow-y: auto;
  background: #f7fafc;
  border-right: 1px solid #e2e8f0;
}

.hec-preview {
  background: #edf2f7;
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.hec-preview-label {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #4a5568;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hec-preview-status {
  font-size: 11px;
  color: #4a5568;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

.hec-preview-frame-wrap {
  flex: 1 1 auto;
  background: #ffffff;
  border: 1px solid #cbd5e0;
  border-radius: 8px;
  overflow: hidden;
  min-height: 420px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.7);
}

.hec-preview-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

.hec-form-group {
  margin-bottom: 14px;
}

.hec-label {
  display: block;
  font-family: "Inter", sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 4px;
  letter-spacing: 0.01em;
}

.hec-input,
.hec-select,
.hec-textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  font-family: "Inter", sans-serif;
  font-size: 13px;
  background: #ffffff;
  color: #1a202c;
  box-sizing: border-box;
}

.hec-input:focus,
.hec-select:focus,
.hec-textarea:focus {
  outline: 2px solid #2b6cb0;
  outline-offset: 1px;
  border-color: #2b6cb0;
}

.hec-textarea {
  min-height: 180px;
  resize: vertical;
  font-family: "Merriweather", Georgia, serif;
  font-size: 14px;
  line-height: 1.55;
}

.hec-help {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  color: #718096;
  margin-top: 4px;
  line-height: 1.45;
}

.hec-section-toggles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}

.hec-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: "Inter", sans-serif;
  font-size: 12px;
  color: #2d3748;
  cursor: pointer;
  user-select: none;
}

.hec-toggle input[type="checkbox"] {
  margin: 0;
  accent-color: #2b6cb0;
}

.hec-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 22px;
  border-top: 1px solid #e2e8f0;
  background: #f7fafc;
}

.hec-footer-meta {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  color: #4a5568;
  line-height: 1.4;
}

.hec-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hec-btn {
  font-family: "Inter", sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  background: transparent;
}

.hec-btn-primary {
  background: #2b6cb0;
  color: #ffffff;
  border-color: #2b6cb0;
}

.hec-btn-primary:hover {
  background: #2c5282;
  border-color: #2c5282;
}

.hec-btn-primary:disabled {
  background: #a0aec0;
  border-color: #a0aec0;
  color: #ffffff;
  cursor: not-allowed;
}

.hec-btn-ghost {
  background: transparent;
  color: #2d3748;
  border-color: #cbd5e0;
}

.hec-btn-ghost:hover {
  background: #edf2f7;
}

.hec-cc-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.hec-cc-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px 2px 10px;
  background: #e2e8f0;
  border-radius: 999px;
  font-family: "Inter", sans-serif;
  font-size: 12px;
  color: #2d3748;
}

.hec-cc-chip-remove {
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 14px;
  color: #4a5568;
  padding: 0 2px;
  line-height: 1;
}

.hec-cc-chip-remove:hover {
  color: #c53030;
}

.hec-pill {
  display: inline-block;
  padding: 2px 10px;
  background: #e6fffa;
  color: #234e52;
  border-radius: 999px;
  font-family: "Inter", sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.hec-pill-error {
  background: #fff5f5;
  color: #742a2a;
}

.hec-pill-warn {
  background: #fefcbf;
  color: #744210;
}
