/* 🏠 La Mesa Palette */
/* See CLAUDE.md "Brand identity → Color palette" — these hex values are
   authoritative. Do not invent new brand colors without updating that
   section first. */
:root {
  --color-bg: #fffcf8;            /* warm off-white, La Mesa background */
  --color-card-bg: #ffffff;       /* pure white for cards */
  --color-border: #e8d9c4;        /* warm tan border */
  --color-text: #2a2420;          /* very dark brown, not pure black */
  --color-muted: #7a6d5f;         /* warm muted grey-brown */

  /* Brand accents. Brown carries text weight (headings, links,
     cookbook-name), orange is reserved for CTAs / primary buttons,
     gold shows up as an occasional signature (star rating). */
  --color-brand: #845b21;         /* brown — headings, links, cookbook name */
  --color-brand-dark: #5f3f15;    /* hover for brown */
  --color-accent: #ea590d;        /* Mesa orange — primary buttons, CTAs */
  --color-accent-dark: #c24a0a;   /* hover for orange */
  --color-gold: #e9b523;          /* signature gold */
}

/* General page styling */
body {
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  margin: 0;
  padding: 0;
}

/* Header / Navbar */
.navbar {
  background-color: #ffffff;
  border-bottom: 1px solid var(--color-border);
}

/* Headings */
h1, h2, h3 {
  color: var(--color-brand);
  margin-top: 0;
  font-family: "Georgia", serif;
}

/* Main container */
main {
  background: var(--color-card-bg);
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin: 20px;
}

/* Links — brown, subtle. Orange is reserved for explicit CTAs. */
a {
  color: var(--color-brand);
  text-decoration: none;
}
a:hover {
  color: var(--color-brand-dark);
  text-decoration: underline;
}

/* Buttons (override Bootstrap a little). Primary = Mesa orange; we
   intentionally DO NOT override .btn-success so Bootstrap's default
   green stays for semantic-success actions — La Mesa's palette has
   no green. */
.btn-primary {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
}
.btn-primary:hover {
  background-color: var(--color-accent-dark);
  border-color: var(--color-accent-dark);
}
.btn-outline-secondary {
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-outline-secondary:hover {
  background-color: var(--color-border);
}

/* Form inputs */
input,
textarea,
select {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 8px;
  font-size: 1em;
  color: var(--color-text);
  background: #fefefe;
}
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 3px rgba(234,89,13,0.35);  /* orange focus ring */
}

/* Table styling */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}
th {
  background-color: var(--color-bg);
  color: var(--color-text);
  text-align: left;
  padding: 10px;
  border-bottom: 2px solid var(--color-border);
  font-weight: 600;
}
td {
  border-bottom: 1px solid var(--color-border);
  padding: 8px 10px;
}

/* Cards for browse page */
.card {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background-color: var(--color-card-bg);
}
.card-title {
  color: var(--color-text);
  font-weight: 600;
}
.card-text {
  color: var(--color-muted);
}

/* Ingredients / Instructions */
.multiline {
  white-space: pre-line;
  padding: 12px;
  background: #fefaf5;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  margin-bottom: 20px;
}

/* Ingredient list */
.ingredient-list {
  list-style: disc;
  padding-left: 40px;
  margin-bottom: 20px;
}
.ingredient-list li {
  margin-bottom: 6px;
}

/* Hide the up/down spinners on number inputs — typing on the
   number pad is faster, and we don't have any inputs that
   benefit from stepping through values. */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Recipe photo (when an image is uploaded as the file attachment) */
.recipe-photo {
  margin: 16px 0;
}
.recipe-photo img {
  max-width: 100%;
  max-height: 500px;
  height: auto;
  border: 1px solid var(--color-border);
  border-radius: 6px;
}

/* Cook Mode button — primary CTA, so it gets the brand orange. */
.cook-mode-button {
  display: inline-block;
  background: var(--color-accent);
  color: #fff;
  padding: 10px 20px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: bold;
}
.cook-mode-button:hover {
  background: var(--color-accent-dark);
}

/* Delete button */
.delete-button {
  background: #b94a48;
  color: #fff;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  margin-top: 20px;
}
.delete-button:hover {
  background: #8c3837;
}

/* Flash messages */
.flash-messages {
  list-style: none;
  padding: 0;
  margin-bottom: 20px;
}
.flash-success {
  color: #155724;
  background-color: #d4edda;
  border: 1px solid #c3e6cb;
  padding: 10px;
  border-radius: 4px;
  margin-bottom: 10px;
}

/* Version history section */
.version-history {
  margin-top: 20px;
  margin-bottom: 20px;
  padding: 10px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
}
.version-history li {
  margin-bottom: 6px;
}

/* Compact diff display */
.compact-diff {
  background: #f8f9fa;
  padding: 10px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 0.9em;
  overflow-x: auto;
  white-space: pre-wrap;
}
.compact-diff .added {
  color: #155724;
  background: #d4edda;
  display: block;
  padding: 2px;
  border-radius: 3px;
}
.compact-diff .removed {
  color: #721c24;
  background: #f8d7da;
  display: block;
  padding: 2px;
  border-radius: 3px;
}
.card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transform: translateY(-2px);
  transition: all 0.2s ease-in-out;
}
.btn {
  border-radius: 6px;
  font-weight: 600;
  padding: 8px 16px;
}
.btn + .btn {
  margin-left: 8px;
}
.filter-panel {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.filter-panel h3 {
  margin-top: 0;
  margin-bottom: 16px;
  font-family: "Georgia", serif;
}
.filter-panel label {
  font-weight: 600;
  margin-top: 10px;
}
table tbody tr:hover {
  background-color: #fdf3e6;
  cursor: pointer;
}
main {
  margin: 20px auto;
  max-width: 1200px;
}
a, .btn, input, select, textarea {
  transition: all 0.2s ease-in-out;
}
.card-text {
  background: var(--color-bg);
  display: inline-block;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.9em;
  color: var(--color-muted);
}
button.btn-link {
  background: none;
  border: none;
  color: var(--color-brand);
  text-decoration: none;
}
button.btn-link:hover {
  color: var(--color-brand-dark);
  text-decoration: none;
}
.star-rating {
  display: inline-flex;
}
.star-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0 1px;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}
.star-btn .filled {
  color: var(--color-gold);
}
.star-btn .empty {
  color: #e4e5e9;
}
.star-rating {
  display: inline-flex;
}

.star-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0 1px;
  cursor: pointer;
  font-size: 1.3rem;
  color: #e4e5e9;
  transition: color 0.2s;
  position: relative;
}

/* Filled stars */
.star-btn .filled {
  color: var(--color-gold);
}

/* Hover effect: when hovering over a star button, highlight it and all previous stars */
.star-btn:hover ~ .star-btn span {
  color: #e4e5e9;
}
.star-btn:hover span,
.star-btn:hover ~ .star-btn span:hover {
  color: var(--color-gold);
}
.star-rating:hover .star-btn span {
  color: var(--color-gold);
}

.table td, .table th {
  white-space: normal;
  word-wrap: break-word;
}

/* Dark mode (Cook Mode only) */
body.dark-mode {
  background-color: #181818;
  color: #f8f8f8;
}
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3 {
  color: #ffffff;
}
body.dark-mode .cook-mode a {
  color: #9ecbff;
}
body.dark-mode .cook-mode {
  background-color: #222;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(0,0,0,0.4);
}
body.dark-mode .ingredient-list {
  list-style: none;
  padding-left: 0;
}
body.dark-mode .ingredient-list li {
  background-color: #2c2c2c;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.4rem;
  border-radius: 8px;
  border: 1px solid #444;
}
body.dark-mode .multiline.large-text {
  background-color: #2c2c2c;
  padding: 1rem;
  margin-top: 0.5rem;
  border-radius: 8px;
  border: 1px solid #444;
  line-height: 1.6;
}
body.dark-mode .exit-cook-mode {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 0.4rem 0.8rem;
  background-color: #333;
  border-radius: 6px;
  text-decoration: none;
  color: #80caff;
}
body.dark-mode .exit-cook-mode:hover {
  background-color: #444;
}
body.dark-mode #darkModeToggle {
  background-color: #444;
  color: #f8f8f8;
}

/* Browse-by-course "View" button uses the brand brown */
.btn-brown {
  background-color: var(--color-brand);
  color: #fff;
  font-weight: bold;
  border: none;
}
.btn-brown:hover {
  background-color: var(--color-brand-dark);
  color: #fff;
}
.recipe-count-badge {
  background-color: #f9ebd4;
  color: var(--color-brand);
  font-weight: 500;
  font-size: 0.85rem;
  padding: 0.5em 0.75em;
  border-radius: 12px;
}
