/* ── Cards View — Spoonfull Crash Companion™ ─────────────────────────────── */
.cards-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Search bar */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.search-icon { font-size: 15px; color: var(--text-faint); }

.search-bar input {
  flex: 1;
  font-size: 15px;
  color: var(--text);
  background: transparent;
  min-height: 44px;
}
.search-bar input::placeholder { color: var(--text-faint); }

.clear-search {
  font-size: 12px;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  transition: background var(--transition-fast);
}
.clear-search:hover { background: var(--bg-hover); }
.clear-search svg { display: block; }

/* Category tabs */
.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  flex-shrink: 0;
  background: var(--bg);
}

.cat-tab {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-elevated);
  white-space: nowrap;
  transition: all var(--transition-fast);
  min-height: 36px;
}
.cat-tab-icon { display: flex; align-items: center; justify-content: center; }
.cat-tab-icon svg { width: 16px; height: 16px; display: block; }
.cat-tab:hover { background: var(--bg-hover); color: var(--text); }
.cat-tab.active { background: var(--accent-dim); color: var(--accent); }

/* ── Bateman Horne Cards Grid ────────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  padding: 10px 12px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  align-content: start;
  min-height: 0;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 12px 10px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  text-align: left;
  transition: all var(--transition-fast);
  cursor: pointer;
  min-height: 80px;
  animation: fadeIn 0.1s ease;
}

.card:hover {
  border-color: var(--card-color, var(--accent));
  background: var(--bg-elevated);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.card.selected {
  background: var(--card-selected-bg);
  border-color: var(--card-selected-border);
}

.card-icon { display: flex; align-items: center; line-height: 1; }
.card-icon svg { width: 18px; height: 18px; flex-shrink: 0; }

.card-text {
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text);
  font-weight: 500;
}

.card-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-check svg { width: 12px; height: 12px; display: block; }

/* Custom card indicator */
.card-custom-badge {
  position: absolute;
  bottom: 6px;
  right: 8px;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Add custom card button in category tabs */
.cat-tab-add {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1.5px dashed var(--accent);
  white-space: nowrap;
  transition: all var(--transition-fast);
  cursor: pointer;
}
.cat-tab-add:hover { background: rgba(66,95,204,0.25); }
.cat-tab-add svg { width: 14px; height: 14px; }

/* ── Spoonfull Tap Cards (PRD) ───────────────────────────────────────────── */
.tap-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 8px;
  border-radius: var(--radius-md);
  background: rgba(36,53,118,0.4);
  border: 2px solid var(--dark-blue);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 90px;
  min-width: 0;
}
.tap-card:hover {
  border-color: var(--accent);
  background: rgba(36,53,118,0.6);
}
.tap-card.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.tap-card[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.tap-card-icon { display: flex; align-items: center; justify-content: center; color: var(--periwinkle); }
.tap-card.selected .tap-card-icon { color: white; }
.tap-card-icon svg { width: 28px; height: 28px; }
.tap-card-label {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--off-white);
}
.tap-card.selected .tap-card-label { color: white; }

/* Energy status cards */
.energy-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 12px;
  border-radius: var(--radius-md);
  background: rgba(29,29,29,0.5);
  border: 2px solid var(--dark-blue);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 100px;
}
.energy-card:hover {
  border-color: var(--accent);
  background: rgba(36,53,118,0.3);
}
.energy-card.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.energy-card-icon { display: flex; align-items: center; justify-content: center; color: var(--periwinkle); }
.energy-card.selected .energy-card-icon { color: white; }
.energy-card-icon svg { width: 28px; height: 28px; }
.energy-card-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--off-white);
}
.energy-card.selected .energy-card-label { color: white; }
.energy-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.3;
}
.energy-card.selected .energy-card-desc { color: rgba(255,255,255,0.8); }

/* Symptom cards */
.symptom-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: var(--radius-md);
  background: rgba(29,29,29,0.5);
  border: 2px solid var(--dark-blue);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 80px;
}
.symptom-card:hover {
  border-color: var(--accent);
  background: rgba(36,53,118,0.3);
}
.symptom-card.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.symptom-card-icon { display: flex; align-items: center; justify-content: center; color: var(--periwinkle); }
.symptom-card.selected .symptom-card-icon { color: white; }
.symptom-card-icon svg { width: 24px; height: 24px; }
.symptom-card-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--off-white);
  line-height: 1.2;
}
.symptom-card.selected .symptom-card-label { color: white; }

/* ── Spoonfull Grid Layouts ──────────────────────────────────────────────── */
.grid-needs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 12px;
}

.grid-energy {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 12px;
}

.grid-symptoms {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px;
}

@media (min-width: 640px) {
  .grid-needs { grid-template-columns: repeat(4, 1fr); }
  .grid-symptoms { grid-template-columns: repeat(4, 1fr); }
}

/* ── Step Flow ───────────────────────────────────────────────────────────── */
.step-header {
  padding: 16px 16px 8px;
  font-family: var(--font-heading);
}
.step-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}
.step-header p {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

.step-nav {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  justify-content: space-between;
}

/* ── Collapsible Section ─────────────────────────────────────────────────── */
.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  min-height: 44px;
}
.collapsible-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.collapsible-header svg {
  transition: transform var(--transition-fast);
  color: var(--text-muted);
}
.collapsible-header[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

@media (max-width: 480px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    padding: 8px 10px 16px;
  }
  .grid-needs { gap: 8px; padding: 8px; }
  .grid-symptoms { gap: 6px; padding: 8px; }
}

@media (min-width: 640px) {
  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
  .cards-view {
    max-width: 700px;
    margin: 0 auto;
    width: 100%;
  }
}
