@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=DM+Sans:ital,wght@0,300;0,400;0,500;1,300&display=swap');

:root {
  --bg: #FAF7F2;
  --surface: #FFFFFF;
  --border: #E8E0D5;
  --text: #2C2C2C;
  --text-dim: #7A7068;
  --accent: #C4622D;
  --accent-light: #F5E6DC;
  --accent-dark: #A8521F;
  --sage: #6B7F5E;
  --sage-light: #EEF2EB;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.06);
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-hover: 0 6px 24px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
}

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

html { font-size: 16px; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

h1, h2, h3, h4 {
  font-family: 'Playfair Display', Georgia, serif;
  line-height: 1.2;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

a { color: inherit; }

/* Navigation */
nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.5px;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 400;
  transition: color 0.15s;
}

.nav-links a:hover { color: var(--accent); }
.nav-user { font-size: 0.85rem; color: var(--text-dim); }

/* Layout */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-hoverable {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.card-hoverable:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.recipe-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: var(--radius) var(--radius) 0 0;
}

.recipe-card-placeholder {
  width: 100%;
  height: 180px;
  background: linear-gradient(135deg, var(--accent-light), var(--sage-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  border-radius: var(--radius) var(--radius) 0 0;
}

.recipe-card-body { padding: 1.25rem; }
.recipe-card-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.recipe-card-meta { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 0.5rem; }

/* Tags */
.tag {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.75rem;
  padding: 2px 10px;
  border-radius: 20px;
  margin: 2px 2px 2px 0;
  font-weight: 500;
}

.tag-sage {
  background: var(--sage-light);
  color: var(--sage);
}

/* Stars */
.stars { color: var(--accent); letter-spacing: 2px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  white-space: nowrap;
}

.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-dark); box-shadow: 0 2px 8px rgba(196,98,45,0.35); }

.btn-secondary { background: var(--accent-light); color: var(--accent); }
.btn-secondary:hover { background: #ecd8c9; }

.btn-sage { background: var(--sage-light); color: var(--sage); }
.btn-sage:hover { background: #dde8d9; }

.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text-dim); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-danger { background: transparent; border: 1px solid #d9534f; color: #d9534f; }
.btn-danger:hover { background: #fdf0ef; }

.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.85rem; }

/* Forms */
.form-group { margin-bottom: 1.25rem; }

.form-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(196, 98, 45, 0.1);
}

.form-textarea { resize: vertical; min-height: 100px; }

.form-hint { font-size: 0.8rem; color: var(--text-dim); margin-top: 0.25rem; }
.form-error { font-size: 0.8rem; color: #d9534f; margin-top: 0.25rem; }

/* Camera / upload zone */
.camera-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  background: var(--accent-light);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  user-select: none;
}

.camera-zone:hover,
.camera-zone:focus {
  border-color: var(--accent);
  background: #f0d9c9;
}

.camera-zone-icon { font-size: 3rem; margin-bottom: 1rem; display: block; }
.camera-zone-label { font-size: 1.05rem; font-weight: 500; margin-bottom: 0.4rem; }
.camera-zone-hint { font-size: 0.85rem; color: var(--text-dim); }

/* Ingredient rows */
.ingredient-row {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
  align-items: center;
}

.ingredient-row .form-input { margin: 0; }

/* Nutrition badges */
.nutrition-strip {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}

.nutrition-badge {
  background: var(--accent-light);
  color: var(--accent-dark);
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
}

/* Decorative divider */
.divider {
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border), transparent);
  margin: 2rem 0;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #1a1a1a;
  color: white;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  transform: translateY(8px);
  z-index: 999;
  max-width: 320px;
  font-size: 0.95rem;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Substitution highlight */
.sub-highlight {
  background: #FFF9C4;
  border-radius: 3px;
  padding: 0 3px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 5rem 2rem;
  color: var(--text-dim);
}

.empty-state-icon { font-size: 4rem; margin-bottom: 1.25rem; display: block; }
.empty-state h2 { color: var(--text); margin-bottom: 0.75rem; }
.empty-state p { margin-bottom: 1.5rem; }

/* Alert / flash */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}

.alert-error { background: #fdf0ef; color: #b94040; border: 1px solid #f5c6c6; }
.alert-success { background: var(--sage-light); color: #3d5c35; border: 1px solid #c1d9b8; }

/* Auth / form page layout */
.auth-wrapper {
  max-width: 440px;
  margin: 4rem auto;
}

.card-padded {
  padding: 2.5rem;
}

.card-title {
  text-align: center;
  margin-bottom: 0.4rem;
  font-size: 1.75rem;
}

.card-subtitle {
  text-align: center;
  color: var(--text-dim);
  margin-bottom: 2rem;
}

.link-accent {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}

.link-accent:hover { text-decoration: underline; }

.text-center { text-align: center; }
.text-dim { color: var(--text-dim); }
.text-sm { font-size: 0.9rem; }

.btn-full {
  width: 100%;
  justify-content: center;
  margin-top: 0.5rem;
}

/* Inline display */
.d-inline { display: inline; }

/* Responsive */
@media (max-width: 768px) {
  h1 { font-size: 1.6rem; }
  nav { padding: 0 1rem; }
  .container { padding: 1.25rem 1rem; }
}

@media (max-width: 640px) {
  .recipe-grid { grid-template-columns: 1fr; }
  .nav-links { gap: 1rem; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .nutrition-strip { gap: 0.5rem; }
}
