/* ============================================
   Meal Plan Builder — Additional Styles
   ============================================ */

.builder-section { padding: 64px 0 80px; }

.builder-step {
  margin-bottom: 56px;
}

.step-label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 500;
  color: var(--charcoal);
  margin-bottom: 24px;
}
.step-num {
  width: 30px; height: 30px;
  background: var(--sage);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  font-weight: 500;
  flex-shrink: 0;
}
.step-hint { font-size: 14px; font-weight: 400; color: var(--text-muted); }
.step-desc { color: var(--text-muted); margin-bottom: 24px; max-width: 600px; }

/* ---- FASTING WINDOW ---- */
.window-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.window-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 24px;
  background: white;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  min-width: 110px;
}
.window-btn:hover { border-color: var(--sage); background: var(--sage-light); }
.window-btn.selected {
  border-color: var(--sage);
  background: var(--sage);
  color: white;
}
.window-ratio {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 24px;
  color: inherit;
}
.window-sub { font-size: 12px; color: rgba(0,0,0,0.5); }
.window-btn.selected .window-sub { color: rgba(255,255,255,0.7); }

/* ---- DIET CHIPS ---- */
.diet-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.diet-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.diet-chip:hover { border-color: var(--sage); background: var(--sage-light); }
.diet-chip input[type="checkbox"] { display: none; }
.diet-chip:has(input:checked) {
  background: var(--sage);
  border-color: var(--sage);
  color: white;
}
.chip-icon { font-size: 16px; }
.chip-label { font-size: 14px; font-weight: 500; }

/* ---- GENERATE ACTIONS ---- */
.generate-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-generate { min-width: 200px; justify-content: center; }
.btn-download { min-width: 180px; justify-content: center; }
.btn-download-top { min-width: 180px; justify-content: center; }

/* ---- PREVIEW SECTION ---- */
.preview-section {
  padding: 0 0 80px;
  background: var(--section-alt);
  border-top: 1px solid var(--border);
}
.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 32px 0 24px;
  flex-wrap: wrap;
  gap: 16px;
}
.preview-title {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 26px;
  color: var(--charcoal);
}

/* ---- PLAN DOCUMENT (rendered output) ---- */
.plan-document {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.plan-doc-header {
  background: var(--sage);
  padding: 40px 48px 32px;
  color: white;
}
.plan-doc-header h1 {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 32px;
  margin-bottom: 8px;
}
.plan-doc-meta {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  font-size: 14px;
  opacity: 0.85;
}
.plan-doc-meta span {
  background: rgba(255,255,255,0.18);
  padding: 4px 12px;
  border-radius: 20px;
}

.plan-doc-tips {
  padding: 28px 48px;
  background: var(--amber-light);
  border-bottom: 1px solid var(--border);
}
.plan-doc-tips h3 {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 17px;
  color: var(--charcoal);
  margin-bottom: 12px;
}
.plan-doc-tips ul {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 6px;
}
.plan-doc-tips li {
  font-size: 13px;
  color: var(--text);
  padding-left: 16px;
  position: relative;
}
.plan-doc-tips li::before { content: '→'; position: absolute; left: 0; color: var(--amber); }

.plan-days { padding: 32px 48px 48px; }
.plan-day { margin-bottom: 40px; }
.plan-day-title {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 22px;
  color: var(--charcoal);
  padding-bottom: 10px;
  border-bottom: 2px solid var(--sage-light);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.plan-day-badge {
  font-size: 11px;
  font-family: 'DM Sans', sans-serif;
  background: var(--sage-light);
  color: var(--sage-dark);
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 500;
}

.plan-meals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.plan-meal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.plan-meal-type {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sage);
  margin-bottom: 6px;
}
.plan-meal-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--charcoal);
  margin-bottom: 6px;
}
.plan-meal-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.plan-meal-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.plan-meal-tag {
  font-size: 11px;
  background: var(--sage-light);
  color: var(--sage-dark);
  padding: 2px 8px;
  border-radius: 10px;
}

.plan-shopping {
  padding: 32px 48px;
  background: var(--section-alt);
  border-top: 1px solid var(--border);
}
.plan-shopping h2 {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 24px;
  color: var(--charcoal);
  margin-bottom: 20px;
}
.shopping-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}
.shopping-cat h4 {
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sage);
  margin-bottom: 10px;
}
.shopping-cat ul { list-style: none; }
.shopping-cat li {
  font-size: 14px;
  color: var(--text);
  padding: 4px 0;
  border-bottom: 1px dashed var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.shopping-cat li::before {
  content: '';
  width: 14px; height: 14px;
  border: 1.5px solid var(--border);
  border-radius: 3px;
  flex-shrink: 0;
  display: inline-block;
}

.plan-disclaimer {
  padding: 20px 48px;
  border-top: 1px solid var(--border);
  background: #fafaf8;
}
.plan-disclaimer p {
  font-size: 12px;
  color: var(--text-muted);
}

/* ---- LOADING STATE ---- */
.generating-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 0;
  gap: 16px;
}
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--sage-light);
  border-top-color: var(--sage);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .plan-doc-header { padding: 28px 24px; }
  .plan-doc-tips { padding: 20px 24px; }
  .plan-days { padding: 24px 24px 40px; }
  .plan-shopping { padding: 24px; }
  .plan-disclaimer { padding: 16px 24px; }
  .window-grid { gap: 8px; }
  .window-btn { min-width: 80px; padding: 12px 16px; }
}

@media print {
  .nav, .builder-section, .preview-toolbar, .footer, .plan-disclaimer { display: none !important; }
  .plan-document { box-shadow: none; border: none; }
  .preview-section { padding: 0; background: white; }
}
