/*!
 * EaseAway · Conversational intake — modal styles (Sprint 1.3 Blocks 5+6+7)
 *
 * Uses design-system tokens from easeaway-polish.css. No hardcoded hex.
 * Mobile-first: full-screen takeover at ≤768px; centered modal on desktop.
 */

.eai-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(27, 46, 31, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: var(--space-md, 16px);
}

.eai-modal {
  background: var(--bg-card, #fffefb);
  border-radius: var(--radius-xl, 16px);
  box-shadow: var(--shadow-lg, 0 8px 40px rgba(45, 46, 40, 0.15));
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.eai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md, 16px) var(--space-lg, 24px);
  border-bottom: 1px solid var(--border-default, #e8e2d8);
  background: var(--bg-main, #faf7f2);
}

.eai-header h2 {
  margin: 0;
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--color-navy-mid, #2d5a3d);
}

.eai-header-sub {
  font-size: 11px;
  color: var(--text-muted, #718096);
  margin-top: 2px;
}

.eai-header-actions {
  display: flex;
  gap: var(--space-sm, 8px);
  align-items: center;
}

.eai-btn-close,
.eai-btn-restart {
  background: transparent;
  border: 1px solid var(--border-light, #e2e8f0);
  color: var(--text-secondary, #4a5568);
  border-radius: var(--radius-md, 10px);
  padding: 6px 12px;
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
}
.eai-btn-close { font-size: 16px; padding: 4px 10px; line-height: 1; }
.eai-btn-close:hover,
.eai-btn-restart:hover { background: var(--bg-muted, #f7fafc); }

.eai-history {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg, 24px);
  display: flex;
  flex-direction: column;
  gap: var(--space-md, 16px);
}

.eai-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--radius-lg, 12px);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.eai-msg-user {
  align-self: flex-end;
  background: var(--color-coral, #e8734a);
  color: #fff;
  border-bottom-right-radius: var(--radius-sm, 6px);
}

.eai-msg-assistant {
  align-self: flex-start;
  background: var(--bg-main, #faf7f2);
  color: var(--text-primary, #1a202c);
  border: 1px solid var(--border-default, #e8e2d8);
  border-bottom-left-radius: var(--radius-sm, 6px);
}

.eai-msg-system {
  align-self: center;
  background: transparent;
  color: var(--text-muted, #718096);
  font-size: 12px;
  font-style: italic;
}

.eai-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-md, 16px);
  padding-top: var(--space-md, 16px);
}

.eai-card {
  background: var(--bg-card, #fffefb);
  border: 1px solid var(--border-default, #e8e2d8);
  border-radius: var(--radius-lg, 12px);
  padding: var(--space-md, 16px);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm, 8px);
  box-shadow: var(--shadow-sm, 0 1px 4px rgba(0, 0, 0, 0.08));
  transition: transform 0.15s, box-shadow 0.15s;
}
.eai-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover, 0 12px 40px rgba(45, 46, 40, 0.12));
}

.eai-card-title {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 17px;
  color: var(--color-navy-mid, #2d5a3d);
  margin: 0;
}

.eai-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm, 8px);
  font-size: 12px;
  color: var(--text-secondary, #4a5568);
}

.eai-card-stat {
  background: var(--bg-main, #faf7f2);
  border: 1px solid var(--border-default, #e8e2d8);
  border-radius: var(--radius-sm, 6px);
  padding: 3px 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.eai-card-stat:hover { background: var(--bg-muted, #f7fafc); }

.eai-card-rationale {
  font-size: 13px;
  color: var(--text-secondary, #4a5568);
  line-height: 1.5;
  margin: 0;
}

.eai-card-cta {
  align-self: flex-start;
  background: linear-gradient(135deg, var(--color-coral, #e8734a), var(--color-coral-light, #ed8936));
  color: #fff;
  border: none;
  border-radius: var(--radius-lg, 12px);
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
}
.eai-card-cta:hover { transform: translateY(-1px); box-shadow: 0 4px 15px rgba(232, 115, 74, 0.4); }

.eai-input-row {
  display: flex;
  gap: var(--space-sm, 8px);
  padding: var(--space-md, 16px) var(--space-lg, 24px);
  border-top: 1px solid var(--border-default, #e8e2d8);
  background: var(--bg-main, #faf7f2);
}

.eai-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border-default, #e8e2d8);
  border-radius: var(--radius-md, 10px);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  background: var(--bg-card, #fffefb);
  resize: none;
}
.eai-input:focus { outline: 2px solid var(--border-focus, #4299e1); outline-offset: -1px; }

.eai-btn-send {
  background: linear-gradient(135deg, var(--color-navy-mid, #2d5a3d), var(--color-navy, #1b2e1f));
  color: #fff;
  border: none;
  border-radius: var(--radius-md, 10px);
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.eai-btn-send:disabled { opacity: 0.5; cursor: not-allowed; }

.eai-footnote {
  padding: 6px var(--space-lg, 24px) 10px;
  font-size: 11px;
  color: var(--text-muted, #718096);
  text-align: center;
  background: var(--bg-main, #faf7f2);
  border-top: 1px solid var(--border-default, #e8e2d8);
}

.eai-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--border-light, #e2e8f0);
  border-top-color: var(--color-coral, #e8734a);
  border-radius: 50%;
  animation: eai-spin 0.8s linear infinite;
  margin-right: 6px;
  vertical-align: middle;
}
@keyframes eai-spin { to { transform: rotate(360deg); } }

.eai-validator-badge {
  font-size: 10px;
  background: var(--color-success-bg, #f0fff4);
  color: var(--color-success-text, #276749);
  border-radius: var(--radius-sm, 6px);
  padding: 2px 6px;
  margin-left: 6px;
}
.eai-validator-badge.fallback {
  background: var(--color-warning-bg, #fffbeb);
  color: var(--color-warning-text, #92400e);
}

.eai-consent {
  background: var(--bg-main, #faf7f2);
  border: 1px solid var(--border-default, #e8e2d8);
  border-radius: var(--radius-lg, 12px);
  padding: var(--space-md, 16px);
  margin-top: var(--space-md, 16px);
}
.eai-consent h3 {
  font-family: 'Fraunces', serif;
  margin: 0 0 8px;
  font-size: 15px;
  color: var(--color-navy-mid, #2d5a3d);
}
.eai-consent-actions {
  display: flex;
  gap: var(--space-sm, 8px);
  margin-top: var(--space-sm, 8px);
  flex-wrap: wrap;
}
.eai-consent-actions button {
  border: 1px solid var(--border-default, #e8e2d8);
  background: var(--bg-card, #fffefb);
  color: var(--text-secondary, #4a5568);
  border-radius: var(--radius-md, 10px);
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
}
.eai-consent-actions .eai-consent-yes {
  background: var(--color-navy-mid, #2d5a3d);
  color: #fff;
  border-color: var(--color-navy-mid, #2d5a3d);
}

.eai-locked {
  padding: var(--space-lg, 24px);
  text-align: center;
}

@media (max-width: 768px) {
  .eai-modal-backdrop { padding: 0; }
  .eai-modal {
    max-width: 100%;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
  }
  .eai-header { padding: var(--space-sm, 8px) var(--space-md, 16px); }
  .eai-history { padding: var(--space-md, 16px); }
  .eai-card-cta { width: 100%; text-align: center; }
}
