/* ==========================================================================
   styles.css
   Kondate (献立) Generator — Neon Dark theme, mirroring pachislot CSS vars.
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties
   -------------------------------------------------------------------------- */
:root {
  color-scheme: dark;
  --bg: #0e0f18;
  --card: rgba(23, 25, 40, 0.85);
  --accent: #ff2d75;
  --accent-soft: rgba(255, 45, 117, 0.15);
  --accent-gradient: linear-gradient(135deg, #ff2d75, #7a5cff);
  --text: #f5f7ff;
  --text-muted: #9ba1c7;
  --border: rgba(255, 255, 255, 0.08);
  --success: #22c55e;
  --warning: #f59e0b;
  --info: #3b82f6;

  /* Additional kondate-specific tokens */
  --card-hover: rgba(30, 33, 55, 0.95);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(255, 45, 117, 0.25);
  --transition: 0.2s ease;
}

/* --------------------------------------------------------------------------
   Reset & Base
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  font-size: 15px;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  outline: none;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  outline: none;
}

ul, ol {
  list-style: none;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: rgba(14, 15, 24, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.branding h1 {
  font-size: 1.25rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.branding .subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 1px;
  font-weight: 400;
}

.back-link {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  transition: color var(--transition), border-color var(--transition);
}

.back-link:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
}

/* --------------------------------------------------------------------------
   Main Layout
   -------------------------------------------------------------------------- */
main {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

/* --------------------------------------------------------------------------
   Tab Navigation
   -------------------------------------------------------------------------- */
.tab-section {
  margin-bottom: 24px;
}

.tab-nav {
  display: flex;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 5px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow-x: auto;
  scrollbar-width: none;
}

.tab-nav::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  padding: 9px 16px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border-radius: var(--radius-md);
  transition: background var(--transition), color var(--transition);
}

.tab-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 2px 12px rgba(255, 45, 117, 0.4);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* --------------------------------------------------------------------------
   Menu Type Selector
   -------------------------------------------------------------------------- */
.menu-type-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.type-btn {
  padding: 7px 16px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  transition: all var(--transition);
  backdrop-filter: blur(8px);
}

.type-btn:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.18);
}

.type-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 10px rgba(255, 45, 117, 0.2);
}

/* --------------------------------------------------------------------------
   Conflict Rules Panel
   -------------------------------------------------------------------------- */
.conflict-rules-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0;
  margin-bottom: 20px;
  backdrop-filter: blur(12px);
  overflow: hidden;
}

.conflict-rules-panel summary {
  padding: 14px 18px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color var(--transition);
  user-select: none;
}

.conflict-rules-panel summary::before {
  content: '▶';
  font-size: 0.65rem;
  transition: transform var(--transition);
  color: var(--accent);
}

.conflict-rules-panel[open] summary::before {
  transform: rotate(90deg);
}

.conflict-rules-panel summary:hover {
  color: var(--text);
}

.conflict-rules-panel::-webkit-details-marker {
  display: none;
}

.rules-grid {
  padding: 4px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid var(--border);
}

.rules-grid label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
}

.rules-grid input[type="checkbox"],
.rules-grid input[type="radio"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.protein-level-toggle {
  margin-left: 25px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.03);
  border-left: 2px solid var(--accent-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.protein-level-toggle label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.history-rule-label {
  align-items: center !important;
}

.inline-number {
  width: 48px;
  text-align: center;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.85rem;
  margin: 0 4px;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 24px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent-gradient);
  border-radius: var(--radius-pill);
  transition: opacity var(--transition), box-shadow var(--transition), transform var(--transition);
  box-shadow: 0 2px 16px rgba(255, 45, 117, 0.35);
}

.btn-primary:hover {
  opacity: 0.9;
  box-shadow: 0 4px 24px rgba(255, 45, 117, 0.5);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 20px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.btn-secondary:active {
  transform: translateY(0);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 20px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #ff4d6d;
  background: rgba(255, 77, 109, 0.1);
  border: 1px solid rgba(255, 77, 109, 0.25);
  border-radius: var(--radius-pill);
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.btn-danger:hover {
  background: rgba(255, 77, 109, 0.2);
  border-color: rgba(255, 77, 109, 0.4);
  transform: translateY(-1px);
}

.btn-danger:active {
  transform: translateY(0);
}

.btn-small {
  padding: 6px 14px;
  font-size: 0.78rem;
}

.btn-generate {
  width: 100%;
  margin-bottom: 24px;
  padding: 14px;
  font-size: 1rem;
}

/* --------------------------------------------------------------------------
   Menu Result Cards
   -------------------------------------------------------------------------- */
.menu-result {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.menu-slot {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-card);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  position: relative;
  overflow: hidden;
}

.menu-slot::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity var(--transition);
  z-index: 0;
}

.menu-slot:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card), var(--shadow-glow);
  border-color: rgba(255, 45, 117, 0.2);
}

.menu-slot > * {
  position: relative;
  z-index: 1;
}

.slot-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.slot-header .slot-category-badge {
  margin-right: auto;
}

.slot-category-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.slot-category-badge.main {
  background: rgba(255, 45, 117, 0.2);
  color: #ff6b99;
  border: 1px solid rgba(255, 45, 117, 0.3);
}

.slot-category-badge.side {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.slot-category-badge.soup {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.shuffle-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.shuffle-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  transform: rotate(180deg);
}

.exclude-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
  cursor: pointer;
}

.exclude-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #f87171;
  transform: scale(1.15);
}

.slot-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.35;
}

.slot-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.meta-tag {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.slot-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* --------------------------------------------------------------------------
   Ingredient Section
   -------------------------------------------------------------------------- */
.ingredient-section,
.shopping-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  backdrop-filter: blur(12px);
}

.ingredient-section h3,
.shopping-section h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

.ingredient-category-group {
  margin-bottom: 12px;
}

.ingredient-category-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 4px 0;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.ingredient-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.ingredient-item:last-child {
  border-bottom: none;
}

.ingredient-name {
  color: var(--text);
}

.ingredient-amount {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.ingredient-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* Shopping list reuses ingredient styles */
.shopping-list {
  /* inherits from ingredient-category-group */
}

.shopping-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.shopping-item:last-child {
  border-bottom: none;
}

.shopping-check {
  width: 16px;
  height: 16px;
  accent-color: var(--success);
  cursor: pointer;
  flex-shrink: 0;
}

.shopping-name {
  flex: 1;
  color: var(--text);
}

.shopping-amount {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Recipes Toolbar
   -------------------------------------------------------------------------- */
.recipes-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 150px;
  padding: 9px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text);
  font-size: 0.85rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  border-color: rgba(255, 45, 117, 0.4);
  box-shadow: 0 0 0 3px rgba(255, 45, 117, 0.08);
}

.filter-select {
  padding: 9px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text);
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color var(--transition);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239ba1c7' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 30px;
}

.filter-select:focus {
  border-color: rgba(255, 45, 117, 0.4);
}

.filter-select option {
  background: #1a1b2e;
}

/* --------------------------------------------------------------------------
   Recipe List & Cards
   -------------------------------------------------------------------------- */
.recipe-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recipe-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  backdrop-filter: blur(12px);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  gap: 12px;
}

.recipe-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateX(2px);
  box-shadow: var(--shadow-card);
}

.recipe-card.excluded {
  opacity: 0.5;
}

.recipe-card-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.recipe-card-info {
  min-width: 0;
}

.recipe-card-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recipe-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.recipe-badge {
  font-size: 0.68rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
}

.recipe-badge.category-main {
  background: rgba(255, 45, 117, 0.15);
  color: #ff6b99;
  border-color: rgba(255, 45, 117, 0.25);
}

.recipe-badge.category-side {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.25);
}

.recipe-badge.category-soup {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.25);
}

.recipe-badge.cuisine {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border-color: var(--border);
}

.recipe-badge.custom {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.25);
}

.recipe-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all var(--transition);
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.btn-icon.btn-favorite:hover,
.btn-icon.btn-favorite.active {
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.1);
}

.btn-icon.btn-exclude:hover,
.btn-icon.btn-exclude.active {
  color: var(--accent);
  border-color: rgba(255, 45, 117, 0.4);
  background: var(--accent-soft);
}

.btn-icon.btn-edit:hover {
  color: var(--info);
  border-color: rgba(59, 130, 246, 0.4);
  background: rgba(59, 130, 246, 0.1);
}

.btn-icon.btn-delete:hover {
  color: #ff4d6d;
  border-color: rgba(255, 77, 109, 0.4);
  background: rgba(255, 77, 109, 0.1);
}

/* --------------------------------------------------------------------------
   Settings Tab
   -------------------------------------------------------------------------- */
.settings-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 20px;
  backdrop-filter: blur(12px);
}

.settings-section h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

.settings-section h4 {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Family members */
.family-members-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.family-member-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.family-member-name {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text);
}

.family-member-type {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
}

.family-member-remove {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.family-member-remove:hover {
  background: rgba(255, 77, 109, 0.15);
  border-color: rgba(255, 77, 109, 0.4);
  color: #ff4d6d;
}

.portion-display {
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.portion-display strong {
  color: var(--accent);
}

/* Exclude sections */
.exclude-subsection {
  margin-bottom: 20px;
}

.exclude-subsection:last-child {
  margin-bottom: 0;
}

.excluded-recipes-list,
.excluded-ingredients-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.exclude-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-size: 0.78rem;
  background: var(--accent-soft);
  border: 1px solid rgba(255, 45, 117, 0.2);
  border-radius: var(--radius-pill);
  color: var(--text);
}

.exclude-item-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 0;
  line-height: 1;
  cursor: pointer;
  transition: color var(--transition);
  display: flex;
  align-items: center;
}

.exclude-item-remove:hover {
  color: var(--accent);
}

/* Add ingredient row */
.add-ingredient-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.input-inline {
  flex: 1;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text);
  font-size: 0.85rem;
  transition: border-color var(--transition);
}

.input-inline::placeholder {
  color: var(--text-muted);
}

.input-inline:focus {
  border-color: rgba(255, 45, 117, 0.4);
  box-shadow: 0 0 0 3px rgba(255, 45, 117, 0.08);
}

/* Data actions */
.data-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* --------------------------------------------------------------------------
   History Tab
   -------------------------------------------------------------------------- */
.history-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.history-toolbar h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  backdrop-filter: blur(12px);
  transition: border-color var(--transition);
}

.history-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.history-card-date {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.history-card-date::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}

.history-menu-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.history-recipe-tag {
  font-size: 0.78rem;
  padding: 3px 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text);
}

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  z-index: 1;
  background: #13141f;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.modal-close:hover {
  background: rgba(255, 45, 117, 0.15);
  border-color: rgba(255, 45, 117, 0.3);
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   Form Elements
   -------------------------------------------------------------------------- */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 0.88rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus,
.form-group select:focus {
  border-color: rgba(255, 45, 117, 0.45);
  box-shadow: 0 0 0 3px rgba(255, 45, 117, 0.1);
}

.form-group select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239ba1c7' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.form-group select option {
  background: #1a1b2e;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

/* --------------------------------------------------------------------------
   Toast Notifications
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
  animation: toastIn 0.25s ease, toastOut 0.25s ease 2.75s forwards;
  backdrop-filter: blur(12px);
  min-width: 200px;
  max-width: 340px;
}

.toast::before {
  font-size: 1rem;
}

.toast.success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #4ade80;
}

.toast.success::before {
  content: '✓';
}

.toast.error {
  background: rgba(255, 77, 109, 0.15);
  border: 1px solid rgba(255, 77, 109, 0.3);
  color: #ff6b6b;
}

.toast.error::before {
  content: '✕';
}

.toast.info {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #60a5fa;
}

.toast.info::before {
  content: 'ℹ';
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(20px);
  }
}

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */
.hidden {
  display: none !important;
}

.empty-message {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  padding: 32px 16px;
}

/* --------------------------------------------------------------------------
   Scrollbar
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* --------------------------------------------------------------------------
   Responsive — max-width: 600px
   -------------------------------------------------------------------------- */
@media (max-width: 600px) {
  header {
    padding: 12px 16px;
  }

  .branding h1 {
    font-size: 1.05rem;
  }

  main {
    padding: 16px 12px 48px;
  }

  .tab-btn {
    padding: 8px 12px;
    font-size: 0.75rem;
  }

  .menu-type-selector {
    gap: 6px;
  }

  .type-btn {
    padding: 6px 12px;
    font-size: 0.76rem;
  }

  .menu-result {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .recipes-toolbar {
    flex-wrap: wrap;
  }

  .search-input {
    width: 100%;
    flex: none;
  }

  .recipe-card {
    flex-wrap: wrap;
  }

  .recipe-card-actions {
    width: 100%;
    justify-content: flex-end;
    border-top: 1px solid var(--border);
    padding-top: 8px;
    margin-top: 4px;
  }

  .modal-content {
    padding: 20px 16px;
  }

  .toast-container {
    bottom: 16px;
    right: 16px;
    left: 16px;
  }

  .toast {
    max-width: 100%;
  }

  .data-actions {
    flex-direction: column;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .form-actions button {
    width: 100%;
    justify-content: center;
  }
}
