/* ─── VARIABLES ─────────────────────────────────────────────────────────────── */
:root {
  --accent: #c0392b;
  --accent-light: #e74c3c;
  --accent-dark: #922b21;
  --bg: #faf9f7;
  --card-bg: #ffffff;
  --text: #1a1a1a;
  --muted: #6c757d;
  --border: #e0ddd8;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
  --font-body: 'Georgia', 'Times New Roman', serif;
  --font-ui: system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* ─── BASE ───────────────────────────────────────────────────────────────────── */
body {
  font-family: var(--font-ui);
  font-size: 1.05rem;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
h1,h2,h3,h4,h5,h6 { font-family: var(--font-body); font-weight: 700; }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }

/* ─── NAVBAR ─────────────────────────────────────────────────────────────────── */
.navbar { box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.navbar-brand { font-family: var(--font-body); font-size: 1.3rem; letter-spacing: -.02em; }

/* ─── CARDS ──────────────────────────────────────────────────────────────────── */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--card-bg);
}
.card-header {
  background: rgba(0,0,0,.025);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0 !important;
  padding: .85rem 1.25rem;
}

/* ─── RECIPE CARDS ───────────────────────────────────────────────────────────── */
.recipe-card {
  transition: transform .18s ease, box-shadow .18s ease;
  border-radius: var(--radius);
  overflow: hidden;
}
.recipe-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,.13);
}
.recipe-card-img {
  width: 100%; height: 160px;
  object-fit: cover;
  background: #f0ece6;
}
.recipe-hero-img {
  max-height: 480px;
  object-fit: cover;
  border-radius: var(--radius);
}

/* ─── RECIPE VIEW ────────────────────────────────────────────────────────────── */
.step-number {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; min-width: 2rem;
  background: var(--accent); color: #fff;
  border-radius: 50%; font-weight: 700; font-size: .9rem;
  font-family: var(--font-ui);
}
.step-block {
  border-left-color: var(--accent) !important;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.ingredient-list li { font-size: 1.05rem; }
.ingredient-list li:last-child { border-bottom: none !important; }
.qty-item { color: var(--accent-dark); }

/* Recipe cross-reference links */
a.recipe-ref {
  color: var(--accent);
  text-decoration: underline dotted;
  font-style: italic;
}
a.recipe-ref:hover { text-decoration: underline; }

/* ─── RATING STARS ───────────────────────────────────────────────────────────── */
.rating-star { cursor: pointer; font-size: 1.5rem; transition: transform .1s; }
.rating-star:hover { transform: scale(1.2); }

/* ─── TIMER DOCK (right sidebar) ─────────────────────────────────────────────── */
.timer-dock {
  position: fixed;
  right: 0; top: 50%;
  transform: translateY(-50%);
  z-index: 1050;
  display: flex; flex-direction: column; gap: .5rem;
  padding: .5rem .4rem;
  pointer-events: none;
}
.timer-pill {
  pointer-events: all;
  cursor: pointer;
  display: flex; align-items: center; gap: .5rem;
  padding: .45rem .75rem;
  border-radius: 2rem 0 0 2rem;
  color: #fff;
  font-size: .82rem; font-weight: 600;
  box-shadow: -3px 3px 12px rgba(0,0,0,.25);
  white-space: nowrap;
  min-width: 120px;
  transition: transform .15s;
  text-decoration: none;
  border: none; background: transparent;
}
.timer-pill:hover { transform: translateX(-4px); color: #fff; }
.timer-pill .timer-icon { font-size: 1rem; }
.timer-pill .timer-close {
  margin-left: auto; opacity: .7; font-size: .9rem;
  background: none; border: none; color: #fff; padding: 0; cursor: pointer;
}
.timer-pill .timer-close:hover { opacity: 1; }
.timer-pill.timer-done { animation: timer-pulse .5s ease infinite alternate; }
@keyframes timer-pulse { from { opacity: .7; } to { opacity: 1; box-shadow: 0 0 12px 4px currentColor; } }

/* ─── OCR DROP ZONE ──────────────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border) !important;
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.drop-zone.drag-over, .drop-zone:hover { border-color: var(--accent) !important; background: rgba(192,57,43,.04); }

/* ─── FORMS ──────────────────────────────────────────────────────────────────── */
.form-control, .form-select {
  font-size: 1rem; border-radius: 8px;
  border-color: var(--border);
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent-light);
  box-shadow: 0 0 0 .2rem rgba(231,76,60,.18);
}
label.form-label { font-weight: 500; }
.form-control-lg { font-size: 1.15rem; }

/* ─── BUTTONS ────────────────────────────────────────────────────────────────── */
.btn { border-radius: 8px; font-weight: 500; }
.btn-primary { background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-lg { padding: .7rem 1.5rem; font-size: 1.1rem; }

/* ─── AUTOSAVE STATUS ────────────────────────────────────────────────────────── */
#autosave-status { min-height: 1.2em; font-size: .82rem; }

/* ─── SHOPPING LIST ──────────────────────────────────────────────────────────── */
.item-row { transition: background .15s; border-radius: 6px; }
.item-row:hover { background: rgba(0,0,0,.03); }

/* ─── PAGE SCANS PREVIEW ─────────────────────────────────────────────────────── */
.scan-thumb {
  position: relative; border-radius: 8px; overflow: hidden;
  border: 2px solid var(--border);
}
.scan-thumb img { width: 100%; height: 120px; object-fit: cover; display: block; }
.scan-thumb .page-badge {
  position: absolute; top: 4px; left: 4px;
  background: rgba(0,0,0,.6); color: #fff;
  border-radius: 4px; padding: 1px 6px; font-size: .75rem;
}
.scan-thumb .remove-scan {
  position: absolute; top: 4px; right: 4px;
  background: rgba(220,53,69,.85); color: #fff;
  border: none; border-radius: 4px;
  padding: 1px 6px; cursor: pointer; font-size: .75rem;
}

/* ─── ACCESSIBILITY ──────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* Large-text mode (≥1200px, better for aging eyes) */
@media (min-width: 1200px) {
  body { font-size: 1.1rem; }
  .ingredient-list li { font-size: 1.1rem; }
  .step-block .card-body { font-size: 1.05rem; line-height: 1.8; }
}

/* ─── RESPONSIVE ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .timer-dock { top: auto; bottom: 1rem; transform: none; }
  .timer-pill { border-radius: 2rem; }
  .recipe-hero-img { max-height: 260px; }
  .recipe-card-img { height: 120px; }
}

/* ─── PRINT ──────────────────────────────────────────────────────────────────── */
@media print {
  .navbar, .footer, .timer-dock, #btn-fav, .btn, #photo-upload-area, form { display: none !important; }
  body { font-size: 12pt; }
  .card { border: 1px solid #ccc; box-shadow: none; }
}

/* ─── UTILITIES ──────────────────────────────────────────────────────────────── */
.border-dashed { border-style: dashed !important; }
.font-monospace { font-family: 'Courier New', monospace; font-size: .9rem; }
