/* ============================================
   Serena Health — Intake Modal
   Full-screen mobile-first, centered card desktop
   ============================================ */

/* ── Animations ── */
@keyframes serena-slide-in-right {
  from { transform: translateX(30px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes serena-slide-out-left {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(-30px); opacity: 0; }
}

@keyframes serena-slide-in-left {
  from { transform: translateX(-30px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes serena-slide-out-right {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(30px); opacity: 0; }
}

@keyframes serena-modal-enter {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Overlay ── */
.serena-intake-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 99999;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* ── Modal Container — full screen on mobile ── */
.serena-intake-modal {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #fefdfb;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: serena-modal-enter 0.3s ease;
}

/* ── Header ── */
.serena-intake-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  min-height: 48px;
  flex-shrink: 0;
}

.serena-intake-btn-back {
  background: none;
  border: none;
  font-size: 15px;
  color: var(--color-primary-purple);
  cursor: pointer;
  padding: 8px 4px;
  font-family: inherit;
  min-width: 60px;
  text-align: left;
}

.serena-intake-step-indicator {
  font-size: 13px;
  color: #9ca3af;
  font-weight: 500;
}

.serena-intake-btn-close {
  background: none;
  border: none;
  font-size: 20px;
  color: #6b7280;
  cursor: pointer;
  padding: 8px;
  line-height: 1;
  min-width: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Progress Bar ── */
.serena-intake-progress {
  height: 4px;
  background: #e5e7eb;
  flex-shrink: 0;
}

.serena-intake-progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  transition: width 0.4s ease;
  border-radius: 0 2px 2px 0;
}

/* ── Body (scrollable) ── */
.serena-intake-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px 20px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

/* ── Step Container ── */
.serena-intake-step {
  max-width: 420px;
  margin: 0 auto;
}

/* ── Logo ── */
.serena-intake-logo {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-primary-purple);
  letter-spacing: 0.5px;
  margin-bottom: 20px;
  text-transform: uppercase;
}

/* ── Title / Subtitle ── */
.serena-intake-title {
  font-size: 26px;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.2;
  margin: 0 0 8px;
}

.serena-intake-subtitle {
  font-size: 15px;
  color: #6b7280;
  margin: 0 0 24px;
  line-height: 1.4;
}

.serena-intake-subtitle strong {
  color: var(--color-primary-purple);
}

/* ── Form Fields ── */
.serena-intake-field {
  margin-bottom: 16px;
  flex: 1;
}

.serena-intake-field-row {
  display: flex;
  gap: 12px;
}

.serena-intake-input,
.serena-intake-select {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  font-size: 16px;
  font-family: inherit;
  border: 1.5px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
  color: #1a1a1a;
  transition: border-color 0.2s;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

.serena-intake-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1.4 0L6 4.6 10.6 0 12 1.4l-6 6-6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.serena-intake-input:focus,
.serena-intake-select:focus {
  outline: none;
  border-color: var(--color-primary-purple);
  box-shadow: 0 0 0 3px rgba(123, 63, 157, 0.1);
}

.serena-intake-input::placeholder {
  color: #9ca3af;
}

/* ── Error Messages ── */
.serena-intake-error {
  display: none;
  font-size: 13px;
  color: #dc2626;
  margin-top: 4px;
  padding-left: 2px;
}

/* ── Primary Button ── */
.serena-intake-btn-primary {
  display: block;
  width: 100%;
  height: 52px;
  background: var(--gradient-primary);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  margin-top: 8px;
  transition: opacity 0.2s, transform 0.1s;
  text-align: center;
  text-decoration: none;
  line-height: 52px;
}

.serena-intake-btn-primary:hover { opacity: 0.92; }
.serena-intake-btn-primary:active { transform: scale(0.98); }
.serena-intake-btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Secondary Button ── */
.serena-intake-btn-secondary {
  display: block;
  width: 100%;
  height: 48px;
  background: #fff;
  color: var(--color-primary-purple);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  border: 1.5px solid var(--color-primary-purple);
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  line-height: 48px;
  transition: background 0.2s;
}
.serena-intake-btn-secondary:hover { background: #f5f0fa; }

/* ── Trust Text ── */
.serena-intake-trust { text-align: center; margin-top: 16px; }
.serena-intake-trust p { font-size: 13px; color: #9ca3af; margin: 0; }

/* ── How It Works (Step 1) ── */
.serena-intake-how-it-works {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid #e5e7eb;
}
.serena-intake-how-it-works h4 { font-size: 15px; font-weight: 600; color: #374151; margin: 0 0 16px; }
.serena-intake-hiw-step { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.serena-intake-hiw-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary-pink) 0%, var(--color-primary-purple) 100%);
  color: #fff; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.serena-intake-hiw-step div { font-size: 14px; color: #374151; line-height: 1.4; }
.serena-intake-hiw-step strong { color: #1a1a1a; }

/* ── Tier Cards ── */
.serena-intake-tiers { display: flex; flex-direction: column; gap: 12px; margin-bottom: 8px; }
.serena-intake-tier-card {
  display: flex; align-items: center; gap: 14px; padding: 16px;
  border: 1.5px solid #d1d5db; border-radius: 12px; cursor: pointer;
  transition: border-color 0.2s, background 0.2s; background: #fff; position: relative;
}
.serena-intake-tier-card:hover { border-color: var(--color-primary-purple); }
.serena-intake-tier-card--selected {
  border-color: var(--color-primary-purple); background: #faf5ff;
  box-shadow: 0 0 0 1px var(--color-primary-purple);
}
.serena-intake-tier-card--best { border-color: var(--color-primary-purple); }
.serena-intake-tier-radio { flex-shrink: 0; }
.serena-intake-tier-dot {
  display: block; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid #d1d5db; position: relative; transition: border-color 0.2s;
}
.serena-intake-tier-dot--active { border-color: var(--color-primary-purple); }
.serena-intake-tier-dot--active::after {
  content: ''; position: absolute; top: 4px; left: 4px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--color-primary-purple);
}
.serena-intake-tier-info { flex: 1; }
.serena-intake-tier-name { font-size: 15px; font-weight: 600; color: #1a1a1a; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.serena-intake-tier-price { font-size: 14px; color: #374151; margin-top: 2px; }
.serena-intake-tier-detail { color: #9ca3af; font-size: 13px; }
.serena-intake-tier-badge {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 4px;
  background: linear-gradient(135deg, var(--color-primary-pink) 0%, var(--color-primary-purple) 100%);
  color: #fff; text-transform: uppercase; letter-spacing: 0.3px;
}
.serena-intake-tier-badge--save { background: #059669; }

/* ── Returning User State ── */
.serena-intake-returning { text-align: center; padding-top: 40px; }
.serena-intake-returning .serena-intake-title { margin-bottom: 16px; }
.serena-intake-returning .serena-intake-subtitle { max-width: 340px; margin-left: auto; margin-right: auto; }
.serena-intake-returning-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 24px; }

/* ── Mobile: hide how-it-works (button visible above fold), compact padding ── */
@media (max-width: 768px) {
  .serena-intake-how-it-works { display: none; }
  .serena-intake-title { font-size: 22px; }
  .serena-intake-body { padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px)); }
}

/* ── Desktop (>768px) — centered card ── */
@media (min-width: 769px) {
  .serena-intake-modal {
    width: 520px;
    max-height: 90vh;
    height: auto;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  }
  .serena-intake-body { padding: 32px 36px 32px; }
  .serena-intake-title { font-size: 28px; }
}
