/* ── Demo Modal v3 — Inline Calendar Layout ──
   Two-panel: Form (left) + ChiliPiper Scheduling (right). */

@keyframes demo-spin {
  to { transform: rotate(360deg); }
}
@keyframes demo-fade-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Modal Shell ── */
#demo-request-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.15s ease;
  font-family: var(--font-sans, 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif);
}
#demo-request-modal.hidden { display: none !important; }
#demo-request-modal.demo-modal-closing { opacity: 0; pointer-events: none; }

#demo-request-modal > div[data-demo-backdrop] {
  position: absolute;
  inset: 0;
  background: rgba(10,22,40,0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
#demo-request-modal > div[data-demo-wrapper] {
  position: relative;
  z-index: 10;
  min-height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

/* ── Card: two-panel split ── */
.demo-modal-card {
  width: 100%;
  max-width: 72rem;
  max-height: min(92vh, 52rem);
  background: #fff;
  border-radius: 1.25rem;
  overflow: hidden;
  display: grid;
  animation: demo-fade-in 0.22s ease;
}
.demo-v3-card {
  grid-template-columns: minmax(20rem, 1fr) minmax(26rem, 1.2fr);
  position: relative;
  box-shadow: 0 24px 80px rgba(10,22,40,0.28), 0 0 0 1px rgba(10,22,40,0.10);
}

/* ── Left Panel: Form ── */
.demo-form-panel {
  padding: 2.5rem 2rem 2rem;
  overflow-y: auto;
  max-height: 92vh;
}
.demo-form-panel-inner { max-width: 24rem; margin: 0; }

.demo-form-title {
  margin: 0 0 0.5rem;
  color: var(--text-primary, #0a1628);
  font-family: var(--font-serif, 'Source Serif 4', Georgia, serif);
  font-size: clamp(1.65rem, 2.5vw, 2rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.demo-form-subtitle {
  margin: 0 0 1.5rem;
  color: var(--text-secondary, #4B5563);
  font-size: 0.88rem;
  line-height: 1.55;
}

/* ── Form Fields ── */
.demo-form { display: flex; flex-direction: column; gap: 1rem; }
.demo-row-two { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.demo-field { display: flex; flex-direction: column; gap: 0.375rem; }
.demo-field-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary, #0a1628);
  letter-spacing: 0.01em;
}
.demo-required { color: #f59e0b; margin-left: 0.15rem; }
.demo-input {
  font-family: var(--font-sans, 'IBM Plex Sans', sans-serif);
  font-size: 0.9rem;
  color: var(--text-primary, #0a1628);
  background: var(--color-white, #fff);
  border: 1px solid var(--border-default, #D1D5DB);
  border-radius: 0.5rem;
  padding: 0.625rem 0.875rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
  box-sizing: border-box;
}
.demo-input::placeholder { color: #9CA3AF; }
.demo-input:focus {
  border-color: var(--brand-primary, #4a6fe8);
  box-shadow: 0 0 0 3px rgba(74,111,232,0.12);
}
.demo-input.error { border-color: #ef4444; }
.demo-input.error:focus { box-shadow: 0 0 0 3px rgba(239,68,68,0.12); }

.demo-error-text {
  font-size: 0.74rem;
  color: #ef4444;
  margin-top: 0.2rem;
}

/* ── Interest Pills ── */
.demo-interests-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.demo-interest-label { display: inline-block; cursor: pointer; }
.demo-interest-label input {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
.demo-interest-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border: 1px solid #E5E7EB;
  border-radius: 999px;
  padding: 0.375rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary, #4B5563);
  transition: all 0.15s ease;
  background: transparent;
  white-space: nowrap;
}
.demo-interest-pill:hover {
  border-color: rgba(74,111,232,0.4);
  background: rgba(74,111,232,0.05);
  color: var(--brand-primary, #4a6fe8);
}
.demo-interest-label input:checked ~ .demo-interest-pill {
  background: rgba(74,111,232,0.10);
  border-color: var(--brand-primary, #4a6fe8);
  color: var(--brand-primary, #4a6fe8);
  box-shadow: 0 1px 0 rgba(74,111,232,0.12);
}

/* ── Submit Button ── */
.demo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  border-radius: 999px;
  font-family: var(--font-sans, 'IBM Plex Sans', sans-serif);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
  padding: 0.8125rem 1.25rem;
}
.demo-btn-primary {
  background: var(--brand-primary, #4a6fe8);
  color: #fff;
}
.demo-btn-primary:hover {
  background: var(--brand-hover, #3658d4);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(74,111,232,0.28);
}
.demo-btn-primary:active { transform: translateY(0); }
.demo-btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.demo-btn .demo-spinner {
  width: 1rem; height: 1rem;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: demo-spin 0.6s linear infinite;
}
.demo-spinner-lg {
  width: 2rem; height: 2rem;
  border: 3px solid rgba(74,111,232,0.18);
  border-top-color: var(--brand-primary, #4a6fe8);
  border-radius: 50%;
  animation: demo-spin 0.7s linear infinite;
}

.demo-privacy-note {
  margin: 0.75rem 0 0;
  color: #9CA3AF;
  font-size: 0.74rem;
  line-height: 1.55;
}

/* ── Dismiss Button (shared corner of both panels) ── */
.demo-dismiss {
  position: absolute;
  top: 0.875rem;
  right: 0.875rem;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 50%;
  color: var(--text-primary, #0a1628);
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(10,22,40,0.08);
}
.demo-dismiss:hover {
  background: var(--brand-primary, #4a6fe8);
  border-color: var(--brand-primary, #4a6fe8);
  color: #fff;
  transform: scale(1.05);
}
.demo-dismiss svg { width: 12px; height: 12px; display: block; }

/* ── Right Panel: Calendar ── */
.demo-calendar-panel {
  display: flex;
  flex-direction: column;
  background: #f8faff;
  border-left: 1px solid #EBF0F7;
  min-height: 32rem;
  overflow: hidden;
}
.demo-calendar-container {
  flex: 1;
  display: flex;
}
.demo-cal-placeholder,
.demo-cal-loading {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 2rem;
  text-align: center;
}
.demo-cal-ph-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  background: rgba(74,111,232,0.08);
  color: var(--brand-primary, #4a6fe8);
  margin-bottom: 0.5rem;
}
.demo-cal-placeholder p,
.demo-cal-loading p {
  margin: 0;
}
.demo-cal-ph-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary, #0a1628);
}
.demo-cal-ph-text {
  font-size: 0.84rem;
  color: var(--text-secondary, #4B5563);
}
.demo-cal-loading {
  color: var(--brand-primary, #4a6fe8);
  font-size: 0.9rem;
}

/* ── Responsive ── */
@media (max-width: 52rem) {
  .demo-v3-card {
    grid-template-columns: 1fr !important;
    max-height: 95vh;
  }
  .demo-calendar-panel {
    border-left: none;
    border-top: 1px solid #EBF0F7;
    min-height: 28rem;
  }
  .demo-form-panel {
    padding: 2rem 1.5rem 1.5rem;
    max-height: none;
  }
}
@media (max-width: 32rem) {
  #demo-request-modal > div[data-demo-wrapper] { padding: 0.5rem; }
  .demo-v3-card { border-radius: 1rem; }
  .demo-form-panel { padding: 1.5rem 1rem 1rem; }
  .demo-form-title { font-size: 1.5rem; }
  .demo-row-two { grid-template-columns: 1fr; }
  .demo-interest-pill { font-size: 0.72rem; padding: 0.3rem 0.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  .demo-modal-card, .demo-btn, .demo-dismiss, .demo-interest-pill {
    animation: none !important;
    transition: none !important;
  }
}

/* Page lock */
html.overflow-hidden, body.overflow-hidden { overflow: hidden !important; }
