:root {
  --leisure-primary: #6BA368;
  --leisure-hover: #40653E;
  --leisure-active: #2E492D;
  --leisure-heading: #4F6F52;
  --leisure-bg: #FAF7F2;
  --navbar-height: 65px;
}

body {
  background: var(--leisure-bg);
  font-family: 'Merriweather', serif;
  line-height: 1.75;
}

.brand {
  color: var(--leisure-heading);
  letter-spacing: 0.5px;
}

/* =====================
   NAVBAR SEARCH
===================== */
.navbar-search {
  max-width: 380px;
}

@media (max-width: 991px) {
  .navbar-search {
    max-width: 20%;
  }
}

@media (max-width: 767px) {
  .navbar-search {
    max-width: 100%;
  }
}

/* iPad-specific: mobile search form width */
@media (min-width: 768px) and (max-width: 1024px) {
  .mobile-search {
    max-width: 45%;
    margin-left: auto;
    margin-right: auto;
  }
  
  .mobile-search input {
    width: 100%;
  }
}

/* =====================
   SIDEBAR LAYOUT
===================== */
.app-body {
  display: flex;
  min-height: calc(100vh - var(--navbar-height));
}

.sidebar {
  width: 220px;
  min-width: 220px;
  background: #fff;
  border-right: 1px solid #e5e7eb;
  position: sticky;
  top: var(--navbar-height);
  height: calc(100vh - var(--navbar-height));
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-inner {
  padding: 1.5rem 1rem;
}

.sidebar-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #7A7A7A;
  margin-bottom: 0.6rem;
  font-family: 'Merriweather', serif;
}

.sidebar-cat-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.65rem;
  border-radius: 0.5rem;
  text-decoration: none;
  color: #555;
  font-size: 0.875rem;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 1px;
}

.sidebar-cat-link:hover {
  background: #f3f4f6;
  color: #333;
  text-decoration: none;
}

.sidebar-cat-link.active {
  background: var(--leisure-bg);
  color: var(--leisure-primary);
  font-weight: 700;
}

.cat-count {
  font-size: 0.68rem;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  background: #f3f4f6;
  color: #7A7A7A;
  font-family: system-ui, sans-serif;
}

.sidebar-cat-link.active .cat-count {
  background: rgba(107, 163, 104, 0.15);
  color: var(--leisure-hover);
}

.sidebar-divider {
  border-color: #f0f0f0;
  margin: 1rem 0;
}

.recently-viewed-link {
  display: block;
  font-size: 0.82rem;
  color: #666;
  text-decoration: none;
  padding: 0.2rem 0.65rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 0.4rem;
  transition: background 0.1s, color 0.1s;
}

.recently-viewed-link:hover {
  background: #f3f4f6;
  color: #333;
  text-decoration: none;
}

/* =====================
   MAIN CONTENT AREA
===================== */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 2.5rem 2.5rem;
}

@media (max-width: 992px) {
  .main-content {
    padding: 1.5rem 1.25rem;
  }
}

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

.content-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--leisure-heading);
  font-family: 'Merriweather', serif;
  margin: 0;
}

.content-count {
  font-size: 0.875rem;
  color: #7A7A7A;
  margin-top: 0.25rem;
  font-family: system-ui, sans-serif;
}

/* =====================
   RECIPE LIST
===================== */
.recipe-group {
  margin-bottom: 2rem;
}

.recipe-group-heading {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--leisure-heading);
  margin-bottom: 1rem;
  font-family: 'Merriweather', serif;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--leisure-primary);
}

.recipe-list {
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  overflow: hidden;
  background: #fff;
}

.recipe-list-item {
  display: flex;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.15s;
  text-decoration: none;
  color: inherit;
}

.recipe-list-item:last-child {
  border-bottom: none;
}

.recipe-list-item:hover {
  background: var(--leisure-bg);
  text-decoration: none;
  color: inherit;
}

.recipe-list-item:hover .recipe-view-link {
  opacity: 1;
}

.recipe-list-body {
  flex: 1;
  min-width: 0;
  padding-right: 1rem;
}

.recipe-list-name {
  font-size: 1rem;
  font-weight: 700;
  color: #111;
  margin-bottom: 0.3rem;
}

.recipe-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
}

.recipe-cat-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.5rem;
  border-radius: 0.3rem;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--leisure-bg);
  border: 1px solid #e5e7eb;
  color: #555;
  font-family: system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.recipe-time {
  font-size: 0.75rem;
  color: #7A7A7A;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: system-ui, sans-serif;
}

.recipe-list-desc {
  font-size: 0.85rem;
  color: #7A7A7A;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: system-ui, sans-serif;
}

.recipe-view-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--leisure-primary);
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: system-ui, sans-serif;
}

.recipe-view-link:hover {
  color: var(--leisure-hover);
  text-decoration: none;
}

/* Mobile: category dropdown */
.mobile-category-select {
  margin-bottom: 1.25rem;
}

/* =====================
   ALPHABET NAVIGATION
===================== */
.alphabet-nav {
  padding: 1rem 0;
}

.alphabet-link {
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  transition: all 0.15s;
  text-decoration: none;
  color: #555;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  font-family: system-ui, sans-serif;
}

.alphabet-link:hover {
  background: var(--leisure-primary);
  color: #fff;
  border-color: var(--leisure-primary);
  text-decoration: none;
}

.alphabet-link.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

[data-bs-theme="dark"] .alphabet-link.disabled {
  opacity: 0.3;
}

[data-bs-theme="dark"] .alphabet-link {
  color: #B8C2BC;
  background: #3A463F;
  border-color: #3A463F;
}

[data-bs-theme="dark"] .alphabet-link:hover {
  background: var(--leisure-primary);
  color: #fff;
  border-color: var(--leisure-primary);
}

/* =====================
   PAGINATION
===================== */
.pagination .page-link {
  color: var(--leisure-primary);
  border-color: #e5e7eb;
  border-radius: 0.4rem;
  margin: 0 1px;
  font-family: system-ui, sans-serif;
  font-size: 0.85rem;
}

.pagination .page-link:hover {
  color: var(--leisure-hover);
  background-color: var(--leisure-bg);
  border-color: var(--leisure-primary);
}

.pagination .page-item.active .page-link {
  background-color: var(--leisure-primary);
  border-color: var(--leisure-primary);
  color: #fff;
}

.pagination .page-item.disabled .page-link {
  color: #ccc;
  border-color: #e5e7eb;
}

[data-bs-theme="dark"] .pagination .page-link {
  color: #8DBB99;
  background-color: #2E3A34;
  border-color: #3A463F;
}

[data-bs-theme="dark"] .pagination .page-link:hover {
  background-color: #3a4f44;
  color: #fff;
}

[data-bs-theme="dark"] .pagination .page-item.active .page-link {
  background-color: #6BA368;
  border-color: #6BA368;
  color: #fff;
}

[data-bs-theme="dark"] .pagination .page-item.disabled .page-link {
  color: #3A463F;
  background-color: #252F29;
  border-color: #3A463F;
}

/* =====================
   RECIPE DETAIL CARD
   (used on recipe.html)
===================== */
.recipe-card {
  background: #fff;
  border-radius: 1.25rem;
  padding: 1.75rem;
  border: none;
  box-shadow: 0 15px 30px rgba(0,0,0,0.05);
}

.meta {
  font-size: 0.85rem;
  color: #7A7A7A;
  margin-bottom: 0.5rem;
}

.ingredient {
  border: 1px solid var(--leisure-primary);
  padding: .5rem;
}

.btn-primary {
  background-color: var(--leisure-primary);
  border: none;
  border-radius: 2rem;
  padding: 0.6rem;
}

.btn-primary:hover {
  background-color: var(--leisure-hover);
  border: none;
}

.btn.btn-primary.active,
.btn.btn-primary:active {
  background-color: var(--leisure-active);
  border: none;
}

.form-select {
  padding: 0.75rem 1.25rem;
  font-size: 0.95rem;
}

/* =====================
   DARK MODE
===================== */
[data-bs-theme="dark"] {
  --bs-body-bg: #1F2421;
  --bs-body-color: #E8E4DD;
}

[data-bs-theme="dark"] body {
  background: #1F2421;
}

/* Theme Toggle Icon */
#themeIcon {
  color: var(--leisure-heading);
  font-size: 1.25rem;
  transition: color 0.15s;
}

[data-bs-theme="dark"] #themeIcon {
  color: #8DBB99;
}

[data-bs-theme="dark"] .brand {
  color: #8DBB99;
}

[data-bs-theme="dark"] .sidebar {
  background: #252F29;
  border-color: #3A463F;
}

[data-bs-theme="dark"] .sidebar-section-title {
  color: #B8C2BC;
}

[data-bs-theme="dark"] .sidebar-cat-link {
  color: #B8C2BC;
}

[data-bs-theme="dark"] .sidebar-cat-link:hover {
  background: rgba(255,255,255,0.05);
  color: #E8E4DD;
}

[data-bs-theme="dark"] .sidebar-cat-link.active {
  background: #2E3A34;
  color: #8DBB99;
}

[data-bs-theme="dark"] .cat-count {
  background: rgba(255,255,255,0.07);
  color: #B8C2BC;
}

[data-bs-theme="dark"] .sidebar-cat-link.active .cat-count {
  background: rgba(141,187,153,0.15);
  color: #8DBB99;
}

[data-bs-theme="dark"] .sidebar-divider {
  border-color: #3A463F;
}

[data-bs-theme="dark"] .recently-viewed-link {
  color: #B8C2BC;
}

[data-bs-theme="dark"] .recently-viewed-link:hover {
  background: rgba(255,255,255,0.05);
  color: #E8E4DD;
}

[data-bs-theme="dark"] .content-title {
  color: #8DBB99;
}

[data-bs-theme="dark"] .recipe-list {
  background: #2E3A34;
  border-color: #3A463F;
}

[data-bs-theme="dark"] .recipe-list-item {
  border-bottom-color: #3A463F;
  color: #E8E4DD;
}

[data-bs-theme="dark"] .recipe-list-item:hover {
  background: rgba(255,255,255,0.03);
}

[data-bs-theme="dark"] .recipe-list-name {
  color: #E8E4DD;
}

[data-bs-theme="dark"] .recipe-cat-badge {
  background: #1F2421;
  border-color: #3A463F;
  color: #B8C2BC;
}

[data-bs-theme="dark"] .recipe-view-link {
  color: #8DBB99;
}

[data-bs-theme="dark"] .recipe-view-link:hover {
  color: #6BA368;
}

[data-bs-theme="dark"] .recipe-card {
  background: #2E3A34;
  box-shadow: none;
}

[data-bs-theme="dark"] .meta {
  color: #B8C2BC;
}

[data-bs-theme="dark"] .btn-primary {
  background-color: #8DBB99;
}

[data-bs-theme="dark"] .btn-primary:hover {
  background-color: #609F71;
}

[data-bs-theme="dark"] .form-select {
  background-color: #2E3A34;
  color: #E8E4DD;
  border-color: #3A463F;
}
