/* ===== Global variables ===== */
:root {
  --brand: #87d6d4;        /* main blue */
  --brand-dark: #0a8274;   /* darker blue for hover */
  --background: #f0eedd;   /* light page background */
}

/* ===== Base layout ===== */
body {
  font-family: "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--background);
  color: #333;
  margin: 0;
  padding: 0;
}

header,
footer {
  background: var(--brand);
  color: var(--brand-dark);
  padding: 1rem;
  text-align: center;
}

/* --- Don't apply teal background to inner headers --- */
.recipe-header {
  background: none;
  color: #1a2c5b;
  padding: 0;
  text-align: left;
}

/* Remove default main padding (outer main removed) */
main {
  background: var(--background);
  max-width: 100%;
  margin: 0;
  padding: 0;
  box-shadow: none;
  border: none;
}

/* ===== Links ===== */
a {
  color: var(--brand-dark);
  text-decoration: none;
  transition: color 0.2s ease;
}
a:hover { color: var(--brand); }

/* ===== Forms ===== */
form input,
form textarea {
  width: 100%;
  padding: 0.5rem;
  margin: 0.5rem 0 1rem 0;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
}

/* ===== Buttons ===== */
button {
  background: var(--brand);
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  font-size: 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s ease;
}
button:hover { background: var(--brand-dark); }

/* ===== Delete button ===== */
.btn-danger {
  background: #e74c3c;
  color: white;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  transition: background 0.2s ease;
}
.btn-danger:hover { background: #c0392b; }

/* ===== Recipe cards ===== */
.recipe-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  padding: 1rem;
  margin: 1rem 0;
}

/* ===== Tag groups ===== */
.tag-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.tag-groups fieldset {
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 0.75rem 1rem 1rem;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.tag-groups legend {
  font-weight: 600;
  padding: 0 0.5rem;
}
.tag-box {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.5rem;
}
.tag-box label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
  padding: 0 0.3rem;
  font-size: 0.95rem;
}
.tag-box input[type="checkbox"] { accent-color: var(--brand); }

/* ===== Clickable tag pills ===== */
.tag-pill {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  border: 2px solid var(--brand-dark);
  border-radius: 20px;
  background: #fff;
  color: #333;
  text-align: center;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.tag-pill input[type="checkbox"] { display: none; }
.tag-pill:has(input[type="checkbox"]:checked) {
  background: var(--brand-dark);
  color: #fff;
}

/* ===== Displayed tags on recipe page ===== */
.recipe-tags {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.recipe-tags span {
  background: var(--brand-dark);
  color: #fff;
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  font-size: 0.85rem;
}

/* ===== Recipe images ===== */
.recipe-image {
  max-width: 200px;
  width: 100%;
  border-radius: 8px;
  display: block;
  margin: 1rem 0;
}
.recipe-thumb {
  max-width: 70px;
  width: 100%;
  border-radius: 8px;
  display: block;
  margin: 0 auto 0.5rem;
}

/* ===== Recipe rows and Select buttons ===== */
.recipe-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid #ddd;
}
.recipe-row a {
  flex: 1;
  color: #2f4f4f;
  text-decoration: none;
}
.select-dish-btn {
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  width: 1.6rem;
  height: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.recipe-header .select-dish-btn { width: 2rem; height: 2rem; }
.recipe-header .select-dish-btn::before { font-size: 2.2rem; }
.recipe-header .select-dish-btn:hover,
.recipe-header .select-dish-btn:focus,
.recipe-header .select-dish-btn:active {
  background: none !important;
  box-shadow: none !important;
}
.select-dish-btn::before {
  content: "+";
  color: #aaa;
  font-size: 1.6rem;
  transition: color 0.25s ease, transform 0.2s ease, opacity 0.2s ease;
}
.select-dish-btn:hover::before {
  color: var(--brand-dark);
  transform: scale(1.15);
}
.select-dish-btn.selected::before {
  content: "✓";
  color: #00b35f;
  font-weight: 900;
  transform: scale(1.2);
  animation: fadeInIcon 0.25s ease;
}
.select-dish-btn:active::before { opacity: 0.7; }
@keyframes fadeInIcon {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1.35); }
}

/* ===== Header & Nav ===== */
.site-header {
  background: var(--brand);
  color: #fff;
  text-align: center;
  padding: 0.25rem 0;              /* compact vertical height */
}
.site-title a {
  color: #fff;
  text-decoration: none;
  font-size: 1.8rem;
  line-height: 1.2;
}

.site-nav {
  background: var(--brand);
  text-align: center;
  padding: 0.25rem 0.4rem;
}
.site-nav a {
  color: var(--brand-dark);
  margin: 0 0.6rem;
  font-weight: 600;
  text-decoration: none;
}
.site-nav a:hover {
  color: #ffeb3b;
}

/* ===== Control Space ===== */
.control-space {
  position: sticky;
  top: 2.6rem;                    /* sits below nav */
  z-index: 90;
  display: flex;
  justify-content: center;
  align-items: center;            /* ensures vertical alignment */
  gap: 0.8rem;
  flex-wrap: wrap;
  background: var(--background);
  padding: 0.35rem 0.6rem;
  margin: 0 auto 0.4rem;
  max-width: 900px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  border-radius: 5px;
}

/* --- Shared button look --- */
.btn-clear,
.btn-toggle-cloud {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  line-height: 1;
  font-weight: 600;
  padding: 0.45rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid #bbb;
  transition: background 0.25s ease, color 0.25s ease, transform 0.1s ease;
}

/* --- Cloud button --- */
.btn-toggle-cloud {
  background: var(--brand);
  color: #fff;
  position: relative;
  top: 1px;                      /* slight visual nudge down */
}
.btn-toggle-cloud:hover {
  background: var(--brand-dark);
  transform: scale(1.05);
}
.btn-toggle-cloud.active {
  background: #00b35f;
}

/* --- Clear button --- */
.btn-clear {
  background: #fff;
  color: var(--brand-dark);
}
.btn-clear:hover {
  background: #f0f0f0;
  color: #0a8274;
}

/* ===== Search Bar ===== */
.search-section {
  text-align: center;
  margin: 0.4rem 0 0.6rem;
}
.search-input {
  width: 100%;
  max-width: 720px;
  padding: 0.55rem 1rem;
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid #bbb;
  background: #fff;
  box-sizing: border-box;
}
.search-input:focus {
  border-color: var(--brand-dark);
  box-shadow: 0 0 0 1.5px rgba(10,130,116,0.2);
  outline: none;
}

/* ===== Feedback states ===== */
.btn-waiting { background: #f6c343 !important; color: #000; }
.btn-cleared { background: #0a8274 !important; color: #fff; }


/* ===== Homepage layout ===== */
main.homepage {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1rem 1rem;
  background: var(--background);
  border: none;
  box-shadow: none;
}
.search-section {
  margin: 0.2rem 0 0.4rem;
  padding: 0;
  text-align: center;
}
.search-input {
  width: 100%;
  max-width: 400px;
  padding: 0.55rem 8rem;
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid #bbb;
  background: #fff;
}
.search-input:focus {
  border-color: var(--brand-dark);
  box-shadow: 0 0 0 1.5px rgba(10,130,116,0.2);
  outline: none;
}

/* === Quick Access Tag Buttons === */
.quick-tags {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.4rem 0 0.8rem;
}
.tag-btn {
  background: var(--brand);
  color: white;
  border: 1px solid var(--brand-dark);
  border-radius: 18px;
  padding: 0.35rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  
  transition: all 0.25s ease;
}
.tag-btn:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  transform: translateY(-1px);
  
}
.tag-btn.active {
  background: var(--brand-dark);
  color: #fff;
  border-color: var(--brand-dark);
  
}
.btn-toggle-cloud {
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1.1rem;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s ease, transform 0.1s ease;
}
.btn-toggle-cloud:hover {
  background: var(--brand-dark);
  transform: scale(1.05);
}
.btn-toggle-cloud.active {
  background: #00b35f;
}


/* === Tag Cloud Styles and Reveal Animation === */
.tag-cloud {
  text-align: center;
  margin: 0.4rem 0 0.8rem;
  line-height: 1.6rem;
}

.tag-link {
  margin: 0.1rem 0.4rem;
  color: #1a2c5b;
  text-decoration: none;
  font-weight: 500;
}

.tag-link:hover {
  color: var(--brand-dark);
  text-decoration: underline;
}

/* === Animated Show / Hide states === */
.tag-cloud.hidden {
  max-height: 0;
  opacity: 0;
  transform: translateY(-10px);
  overflow: hidden;
  transition: all 0.4s ease;
}

.tag-cloud.visible {
  max-height: 500px;    /* adjust based on your content */
  opacity: 1;
  transform: translateY(0);
}



/* === Recipe Detail Page Layout === */
.recipe-detail {
  max-width: 900px;
  margin: 1rem auto;
  padding: 1.5rem 2rem;
  background: #fff;
  border-radius: 10px;
  
  text-align: left;
}
.recipe-detail h3 { margin-top: 1rem; margin-bottom: 0.4rem; }
.recipe-detail .method-text {
  margin-top: 0;
  line-height: 1.6;
  white-space: pre-line;
}
.recipe-detail img { border-radius: 8px; max-width: 220px; }
.recipe-detail .content-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.recipe-detail .ingredients-column {
  flex: 0 1 auto;
  min-width: 260px;
  max-width: 60%;
}
.recipe-detail .ingredients-column ul {
  list-style-type: disc;
  margin-left: 1.2rem;
  line-height: 1.6;
}
.recipe-detail .image-column img {
  max-width: 160px;
  width: 100%;
  border-radius: 8px;
}
/* === Sticky Quick Access (Homepage only) === */
.homepage .quick-tags {
  position: sticky;
  top: 5.4rem; /* below nav + control */
  z-index: 80;
  background: var(--background);
  padding: 0.4rem 0.5rem;
  
  border-radius: 6px;
}

/* === Global Sticky Navigation + Control Space === */
.site-title { 
  position: static; 
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--brand);
  color: var(--brand-dark);
  text-align: center;                 /* ✅ center links */
  padding: 0.6rem 0;                  /* slightly taller for breathing room */
  border-bottom: 1px solid rgba(0,0,0,0.1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);  /* subtle depth */
}
/* ===== Select Dish Button (Recipe Detail Page) ===== */

/* --- Select Dish Button --- */
.select-dish-btn {
  all: unset;                         /* wipe every inherited style */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  cursor: pointer;
  vertical-align: middle;
  margin-right: 0.4rem;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
}

.select-dish-btn .icon {
  font-size: 1.4rem;
  color: #888;                        /* grey + */
  transition: color 0.2s ease;
  line-height: 1;
}

/* --- Only remove system styling on the recipe detail select button --- */
.recipe-detail .select-dish-btn,
.recipe-detail .select-dish-btn::before,
.recipe-detail .select-dish-btn::after {
  -webkit-appearance: none !important;
  appearance: none !important;
  content: none !important;
}

/* hover: teal icon only, no shape */
.select-dish-btn:hover .icon {
  color: var(--brand-dark);
}

/* selected: green tick icon */
.select-dish-btn.selected .icon {
  color: #00b35f;
}
/* === Hide Clear Selections bar on Planner page === */
body[data-page="planner"] #clearSelectedBtn {
  display: none !important;              /* hides the button itself */
}

/* === Remove the control-space bar & line spacing on Planner page === */
body[data-page="planner"] .control-space {
  border-bottom: none !important;        /* remove the faint divider line */
  margin-bottom: 0 !important;           /* reclaim vertical space */
  padding-bottom: 0 !important;
}



