*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --border: #e0e0e0;
  --text: #1a1a1a;
  --text-muted: #666;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
header h1 { font-size: 1.25rem; font-weight: 600; }

main { max-width: 900px; margin: 2rem auto; padding: 0 1.5rem; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger    { background: #fff; color: var(--danger); border-color: #fca5a5; }
.btn-danger:hover { background: #fef2f2; }
.btn-success   { background: var(--success); color: #fff; border-color: transparent; }
.btn-success:hover { background: #15803d; }
.btn-sm        { padding: 0.25rem 0.625rem; font-size: 0.8rem; }

/* Badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-draft     { background: #fef3c7; color: #92400e; }
.badge-published { background: #d1fae5; color: #065f46; }
.badge-pending   { background: #dbeafe; color: #1e40af; }

/* Public food grid */
.food-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.food-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}
.food-card h2 { font-size: 1.05rem; margin-bottom: 0.4rem; }
.food-card p  { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 0.75rem; white-space: pre-wrap; }
.food-card .meta { font-size: 0.75rem; color: var(--text-muted); }

/* Admin list */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.filter-tabs {
  display: flex;
  gap: 0.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.25rem;
}
.filter-tab {
  padding: 0.35rem 0.875rem;
  border-radius: 6px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s;
}
.filter-tab.active { background: var(--accent); color: #fff; }

.food-list { display: flex; flex-direction: column; gap: 0.75rem; }

.food-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}
.food-item-info { flex: 1; min-width: 0; }
.food-item-info h3 { font-size: 1rem; margin-bottom: 0.2rem; }
.food-item-info .desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  white-space: pre-wrap;
}
.food-item-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
}
.food-item-actions {
  display: flex;
  gap: 0.375rem;
  align-items: flex-start;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Published vs draft name diff in admin */
.name-published { font-size: 0.75rem; color: var(--text-muted); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--surface);
  border-radius: 10px;
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.modal h2 { font-size: 1.05rem; margin-bottom: 1.25rem; }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.35rem; }
.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.form-group input:focus,
.form-group textarea:focus { border-color: var(--accent); }
.form-group textarea { resize: vertical; min-height: 100px; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.hidden { display: none; }

.food-id {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: monospace;
  margin-bottom: 0.2rem;
}

.form-group input[readonly] {
  background: var(--bg);
  color: var(--text-muted);
  cursor: default;
  font-family: monospace;
  font-size: 0.8rem;
}
