/* =========================================
   COFFEE REPUBLIC — MENU PAGE
   ========================================= */

/* ── Unified Menu Hero (title + description + search + pills) ─────────────── */

.menu-hero {
  padding-block: clamp(40px, 7vw, 80px) 0;
  /* surface-dark provides the espresso background */
}

.menu-hero-inner {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.menu-hero h1 {
  margin-block: 10px 0;
  font-size: clamp(2.8rem, 7vw, 5.5rem);
}

.menu-hero-description {
  max-width: 58ch;
  font-size: 1rem;
  line-height: 1.8;
  opacity: 0.72;
  color: var(--color-cream);
  margin: 0;
}

/* ── Search Bar ───────────────────────────────────────────────────────────── */

.menu-search-wrapper {
  margin-bottom: clamp(20px, 3vw, 36px);
}

.menu-search-box {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 520px;
}

.search-icon {
  position: absolute;
  left: 16px;
  font-size: 1.2rem;
  color: var(--color-espresso);
  opacity: 0.4;
  pointer-events: none;
  line-height: 1;
}

.menu-search-input {
  width: 100%;
  padding: 14px 48px 14px 44px;
  border: 1.5px solid rgba(24, 11, 13, 0.15);
  border-radius: 100px;
  background: #fff;
  color: var(--color-espresso);
  font-family: var(--font-body);
  font-size: 0.92rem;
  line-height: 1.5;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  appearance: none;
}

.menu-search-input::placeholder {
  color: rgba(24, 11, 13, 0.38);
}

.menu-search-input::-webkit-search-cancel-button { display: none; }

.menu-search-input:focus {
  outline: none;
  border-color: var(--color-pink);
  box-shadow: 0 0 0 3px rgba(233, 79, 134, 0.12);
}

.search-clear {
  position: absolute;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: rgba(24, 11, 13, 0.08);
  color: var(--color-espresso);
  cursor: pointer;
  font-size: 0.7rem;
  transition: background var(--transition-fast);
}

.search-clear:hover {
  background: rgba(24, 11, 13, 0.15);
}

.search-results-count {
  margin-top: 10px;
  font-size: 0.78rem;
  opacity: 0.55;
  padding-left: 4px;
}

/* Force hidden attribute */
[hidden] { display: none !important; }

/* ── Page Hero ────────────────────────────────────────────────────────────── */

.page-hero {
  padding-block: clamp(60px, 9vw, 120px);
  text-align: center;
}

.page-hero-inner {
  max-width: 760px;
  margin-inline: auto;
}

.page-hero h1 {
  margin-block: 18px 20px;
}

.page-hero-description {
  max-width: 58ch;
  margin-inline: auto;
  font-size: 1.05rem;
  line-height: 1.8;
  opacity: 0.75;
  color: var(--color-cream);
}

/* ── Category Pills Section — light background, full wrap, no scroll ─────── */

.menu-tabs-section {
  background: var(--color-cream);
  padding-block: 20px 16px;
  border-bottom: 1px solid rgba(24, 11, 13, 0.08);
}

.menu-tabs-wrapper {
  /* No sticky, no max-height, no overflow — all pills show at once */
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
}

/* Wrapping flex — 3 pills per row */
.menu-tabs {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 10px;
  justify-items: start;
}

/* Each pill — dark on light background */
.menu-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1.5px solid rgba(24, 11, 13, 0.14);
  border-radius: 100px;
  background: #fff;
  color: var(--color-espresso);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(24, 11, 13, 0.06);
  transition:
    background var(--transition-smooth),
    border-color var(--transition-smooth),
    color var(--transition-smooth),
    box-shadow var(--transition-smooth);
  user-select: none;
}

.menu-tab:hover {
  border-color: var(--color-pink);
  background: rgba(233, 79, 134, 0.07);
  box-shadow: 0 4px 12px rgba(233, 79, 134, 0.2);
}

.menu-tab.is-active {
  border-color: var(--color-espresso);
  background: var(--color-espresso);
  color: var(--color-cream);
  box-shadow: 0 4px 12px rgba(24, 11, 13, 0.18);
}

/* Icon inside pill */
.menu-tab-icon {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  width: 15px;
  height: 15px;
}

.menu-tab-icon svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
}

.menu-tab-label {
  line-height: 1;
}

/* Bubble animation */
@keyframes pill-bubble {
  0%   { transform: translateY(0)    scale(1);    }
  30%  { transform: translateY(-9px) scale(1.06); box-shadow: 0 8px 18px rgba(233,79,134,0.28); }
  60%  { transform: translateY(-4px) scale(1.03); }
  100% { transform: translateY(0)    scale(1);    }
}

.menu-tab.is-bubbling {
  animation: pill-bubble 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  border-color: var(--color-pink);
}

/* ── Menu Section (items grid only) ──────────────────────────────────────── */
.menu-section {
  padding-block: clamp(40px, 6vw, 72px);
}

.menu-tabs-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  gap: 12px;
  font-size: 0.82rem;
  opacity: 0.6;
}

.spinner {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 2.5px solid rgba(24, 11, 13, 0.18);
  border-top-color: var(--color-pink);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Menu Items Grid ──────────────────────────────────────────────────────── */

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: clamp(12px, 2vw, 24px);
  min-height: 200px;
}

/* Loading skeleton shimmer */
.menu-grid.is-loading {
  pointer-events: none;
}

.menu-skeleton {
  height: 220px;
  border-radius: var(--radius-medium);
  background: linear-gradient(
    90deg,
    rgba(24, 11, 13, 0.06) 25%,
    rgba(24, 11, 13, 0.10) 50%,
    rgba(24, 11, 13, 0.06) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease infinite;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Menu Item Card ───────────────────────────────────────────────────────── */

.menu-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius-medium);
  background: #fff;
  box-shadow: 0 2px 12px rgba(24, 11, 13, 0.07);
  transition:
    transform var(--transition-smooth),
    box-shadow var(--transition-smooth);
  animation: card-appear 0.4s ease both;
  /* Fixed total height so 80/20 split is precise */
  height: 360px;
}

@keyframes card-appear {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Menu Item Card — full background image ───────────────────────────────── */

.menu-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-medium);
  box-shadow: 0 2px 12px rgba(24, 11, 13, 0.10);
  transition:
    transform var(--transition-smooth),
    box-shadow var(--transition-smooth);
  animation: card-appear 0.4s ease both;
  height: 220px;                /* full card is the image */
  background: var(--color-espresso);
  cursor: pointer;
}

@keyframes card-appear {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.menu-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 14px 36px rgba(24, 11, 13, 0.18);
}

/* Background image fills the entire card */
.menu-card-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.menu-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-elegant);
}

.menu-card:hover .menu-card-image img {
  transform: scale(1.07);
}

/* Emoji placeholder when no image */
.menu-card-no-image {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  opacity: 0.18;
  color: var(--color-cream);
  user-select: none;
}

/* Dark gradient at the bottom so text is readable over any image */
.menu-card-body {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 32px 12px 12px;
  background: linear-gradient(
    to top,
    rgba(24, 11, 13, 0.82) 0%,
    rgba(24, 11, 13, 0.4) 60%,
    transparent 100%
  );
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-card-name {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Description hidden */
.menu-card-description {
  display: none;
}

.menu-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.menu-card-price {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--color-pink);
}

.menu-card-price span {
  font-size: 0.62rem;
  font-weight: 600;
  opacity: 0.8;
  margin-left: 2px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.7);
}

/* Badge removed from card */
.menu-card-badge {
  display: none;
}

/* ── Unavailable item dimming ─────────────────────────────────────────────── */
/* (Only visible in admin preview) */
.menu-card.is-unavailable {
  opacity: 0.5;
  pointer-events: none;
}

/* ── Empty state ──────────────────────────────────────────────────────────── */

.menu-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  grid-column: 1 / -1;
  padding: 60px 20px;
  text-align: center;
  opacity: 0.6;
  gap: 12px;
}

.menu-empty-icon {
  font-size: 3rem;
}

/* ── Error state ──────────────────────────────────────────────────────────── */

.menu-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
  gap: 20px;
}

.menu-error-icon {
  font-size: 3rem;
  opacity: 0.4;
}

.menu-error p {
  max-width: 42ch;
  opacity: 0.7;
}

/* Search highlight */
.menu-card-name mark {
  background: rgba(233, 79, 134, 0.18);
  color: var(--color-espresso);
  border-radius: 3px;
  padding: 0 2px;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 820px) {
  .menu-tabs-wrapper {
    top: 76px; /* match reduced header height */
  }

  .visit-grid {
    grid-template-columns: 1fr;
    max-width: 400px;
    margin-inline: auto;
  }
}

@media (max-width: 600px) {
  /* 2 columns on mobile (3 is too tight on small screens) */
  .menu-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .menu-card,
  .menu-skeleton {
    height: 170px;
  }

  .menu-card-body {
    padding: 8px 10px 10px;
    gap: 3px;
  }

  .menu-card-name {
    font-size: 0.82rem;
  }

  .menu-card-price {
    font-size: 0.82rem;
  }

  .menu-card-price span {
    display: none;
  }

  .menu-card-badge {
    font-size: 0.52rem;
    padding: 2px 6px;
    max-width: 66px;
  }

  .menu-tabs-wrapper {
    max-height: 140px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner,
  .menu-skeleton,
  .menu-card {
    animation: none;
  }

  .menu-card:hover {
    transform: none;
  }
}
