/* Global Styles */
body { margin: 0; font-family: Georgia, serif; background: #fafafa; color: #222; }
* { box-sizing: border-box; }

/* Keep horizontal alignment consistent by reserving space for the vertical scroll bar on all pages */
html { scrollbar-gutter: stable; /* modern browsers */ overflow-y: scroll; /* fallback */ }

/* Back to Top Button */
#back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 8px 12px;
  font-size: 14px;
  border: none;
  border-radius: 4px;
  background: #000080;
  color: #fff;
  cursor: pointer;
  display: none; /* Hidden by default, shown by JS */
  z-index: 999;
}

/* Index Page */
header {
  width: 100%;
  background: #e5e9f3;
  padding: 2rem 0 1rem;
  text-align: center;
  font-size: 2.2rem;
  color: #333;
  font-family: Georgia, serif;
  letter-spacing: 1px;
  font-weight: bold;
  border-bottom: 1px solid #aaa;
}
.nav-cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2.5rem;
  margin: 4rem auto;
  padding: 0 1rem;
}
.nav-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 220px;
  height: 180px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  text-decoration: none;
  color: #222;
  font-size: 1.3rem;
  font-weight: 600;
  transition: box-shadow 0.2s, transform 0.2s;
  border: 1px solid #e5e9f3;
}
.nav-card:hover {
  box-shadow: 0 8px 32px rgba(0,0,0,0.13);
  transform: translateY(-4px) scale(1.03);
  color: #000080;
  border: 1.5px solid #000080;
}
.nav-card span {
  font-size: 3.2rem;
  margin-bottom: 1.2rem;
  display: block;
}

/* Common Layout for Spirits/Wine/Mixed pages */
.container {
  display: flex;
  max-width: 1200px;
  margin: 2rem auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.07);
}
.sidebar {
  flex: 0 0 240px;
  padding: 1.5rem 1rem 1rem;
  background: #f0f4fa;
  border-right: 1px solid #ddd;
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
}
.sidebar h2 { margin-top: 0; font-size: 1.2rem; color: #555; }
.sidebar input, .sidebar select {
  width: 100%;
  margin-bottom: 1rem;
  padding: 0.6rem 0.8rem;
  font-size: 0.9rem;
  border: 1px solid #bbb;
  border-radius: 6px;
  background: linear-gradient(to bottom, #fff, #ececec);
}
.sidebar button {
  width: 100%;
  padding: 0.7rem;
  font-size: 1rem;
  color: #fff;
  background: linear-gradient(to bottom, #000080, #3333aa);
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
.sidebar nav a {
  display: block;
  padding: 0.7rem 0;
  font-size: 1.05rem;
  color: #000080;
  text-decoration: none;
}
.sidebar nav a:not(:last-child) {
  border-bottom: 1px solid #ddd;
}
main {
  flex: 1;
  padding: 2rem;
  min-width: 0; /* Prevents flexbox overflow */
}
h1 { margin-top: 0; color: #444; font-size: 2rem; }
h2.section-title {
  font-size: 1.8rem;
  margin-top: 2rem;
  border-bottom: 2px solid #ddd;
  padding-bottom: 0.3rem;
  color: #333;
}
h3 { font-size: 1.4rem; margin-top: 1.5rem; color: #555; }
h4 { font-size: 1.1rem; margin-top: 2rem; margin-bottom: 0.3rem; color: #777; }
ul.drink-list { list-style: none; padding: 0; margin: 0.5rem 0 1rem; }
ul.drink-list li { margin: 0.5rem 0; }
pre { white-space: pre-wrap; word-wrap: break-word; max-width: 100%; }

/* Wine page color overrides */
.page-wine section[id^="type-Red"] h2.section-title { color: red; }
.page-wine section[id^="type-White"] h2.section-title { color: #b8860b; }

/* Mixed page specific styles */
.page-mixed .cocktail-day {
  background: #fffbe6;
  border: 1px solid #ffe58f;
  border-radius: 10px;
  padding: 1rem 1.2rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 4px rgba(255, 215, 0, 0.07);
}
.page-mixed .cocktail-day .name { font-size: 1rem; font-weight: bold; color: #222; margin-bottom: 0.3rem; }
.page-mixed .cocktail-day .spirit { margin-bottom: 0.8rem; font-size: 0.9rem; color: #555; }
.page-mixed .cocktail-day h2 { color: #b8860b; margin: 0 0 0.4rem 0; font-size: 1.1rem; }
.page-mixed .random-btn {
  display: inline-block;
  margin-bottom: 1rem;
  padding: 0.7rem 1.5rem;
  font-size: 1rem;
  color: #fff;
  background: linear-gradient(to right, #000080, #3333aa);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  transition: background 0.2s;
}
.page-mixed .random-btn:hover { background: linear-gradient(to right, #222299, #4444bb); }
.page-mixed .drink-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(220px, 1fr));
  gap: 1.5rem;
  justify-content: start;
}
.page-mixed .drink-card {
  background: #f8f8ff;
  border-radius: 10px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
  padding: 1.1rem 1rem;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.2s;
  border: 1px solid #e5e9f3;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}
.page-mixed .drink-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.13);
  transform: translateY(-2px) scale(1.02);
  border: 1.5px solid #000080;
}
.page-mixed .drink-card .name { font-size: 1.1rem; font-weight: 600; color: #222; margin-bottom: 0.2rem; }
.page-mixed .drink-card .spirit { font-size: 0.95rem; color: #555; }
.page-mixed .drink-card .variants { font-size: 0.9rem; color: #888; }
.page-mixed .modal-bg { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.65); align-items: center; justify-content: center; }
.page-mixed .modal-bg.active { display: flex; }
.page-mixed .modal { background: #fff; color: #222; border-radius: 12px; max-width: 420px; width: 95vw; padding: 2rem 1.5rem 1.5rem; box-shadow: 0 8px 32px rgba(0,0,0,0.18); position: relative; }
.page-mixed .modal-close { position: absolute; top: 1rem; right: 1rem; font-size: 1.5rem; color: #888; background: none; border: none; cursor: pointer; }
.page-mixed .modal h2 { margin-top: 0; font-size: 1.3rem; color: #000080; }
.page-mixed .modal .detail { display: flex; gap: 4px; margin-bottom: 4px; }
.page-mixed .modal .detail .label { min-width: 80px; font-weight: 600; }
.page-mixed .modal .section-title { font-size: 1.1rem; font-weight: bold; margin-top: 1.2rem; margin-bottom: 0.3rem; color: #333; }
.page-mixed .modal ul { margin: 0 0 1rem 1.2rem; padding: 0; }
.page-mixed .modal pre { background: #f8f8ff; padding: 0.7rem; border-radius: 6px; font-size: 0.97rem; white-space: pre-wrap; word-wrap: break-word; }

.toggle-filters { display: none; }

/* --- MOBILE STYLES (max-width: 900px) --- */
@media (max-width: 900px) {
  /* Global mobile layout */
  .container { flex-direction: column; margin: 0; border-radius: 0; }
  .sidebar {
    position: fixed;
    left: -260px; /* Hidden by default */
    top: 0;
    height: 100vh;
    width: 240px;
    overflow-y: auto;
    transition: left 0.25s ease-in-out;
    z-index: 1002;
    border-right: none;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
  }
  body.show-filters .sidebar { left: 0; }
  /* Dim background when sidebar is open */
  body.show-filters::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1001;
  }
  main { padding: 1rem; }
  h1 { font-size: 1.6rem; }
  h2.section-title { font-size: 1.4rem; }
  #back-to-top { display: none !important; } /* No back to top on mobile */

  /* Index page mobile */
  .nav-cards { flex-direction: column; gap: 1.5rem; margin-top: 2rem; align-items: center; }
  .nav-card { width: 90vw; max-width: 350px; }
  
  /* Floating Filters Button for ALL content pages */
  .page-spirits .toggle-filters,
  .page-wine .toggle-filters,
  .page-mixed .toggle-filters {
    display: block; /* Show floating button */
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    background: #000080;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.6rem 1rem;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  }

  /* Smaller grid on very small phones */
  @media(max-width: 600px) {
    .page-mixed .drink-grid { grid-template-columns: repeat(auto-fill,minmax(150px, 1fr)); gap: 1rem; }
  }
}

/* Mobile buttons styling */
.mobile-buttons {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.mobile-btn {
  padding: 0.5rem 1rem;
  background: #000080;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}
.mobile-btn:hover {
  background: #3333aa;
} 