/*
 * Cafe Menu Pro v3 – Stylesheet
 * Author: Al Islam | softbeez.com
 *
 * Font: BrandonGrotesqueBlack (applied via dynamic inline CSS when enabled)
 * Layout:
 *   Desktop: [tabs flex-1 ~80%] [search max 20%]
 *   Mobile:  [search top full width] → [tabs full width]
 */

/* ── Reset ──────────────────────────────────────────────── */
.cmp-wrapper *,
.cmp-wrapper *::before,
.cmp-wrapper *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Wrapper ─────────────────────────────────────────────── */
.cmp-wrapper {
  background: var(--cmp-page-bg, #fff8f9);
  padding: 24px 20px 52px;
  font-family: 'BrandonGrotesqueBlack', sans-serif;
  color: var(--cmp-card-text, #2d2d2d);
  position: relative;
}

/* ══════════════════════════════════════════════════════════
   TOP BAR  ─  Tabs (left / flex-1) + Search (right / 20%)
   ══════════════════════════════════════════════════════════ */
.cmp-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
  flex-wrap: nowrap;
}

/* ── Category tabs ──────────────────────────────────────── */
.cmp-category-bar {
  flex: 1 1 auto;
  min-width: 0;
  background: var(--cmp-cat-bar-bg, #ffffff);
  border-radius: 50px;
  padding: 5px 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
  overflow: hidden;
}

.cmp-category-inner {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: smooth;
  padding: 1px 2px;
}
.cmp-category-inner::-webkit-scrollbar { display: none; }

.cmp-cat-btn {
  flex-shrink: 0;
  background: transparent;
  border: none;
  border-radius: 50px;
  padding: 8px 20px;
  font-size: var(--cmp-cat-font-size, 13px);
  font-family: inherit;
  font-weight: 500;
  color: var(--cmp-cat-txt, #555);
  cursor: pointer;
  transition: background .2s, color .2s;
  white-space: nowrap;
  outline: none;
}
.cmp-cat-btn:hover { background: rgba(0,0,0,.05); }
.cmp-cat-btn:focus-visible {
  outline: 2px solid var(--cmp-cat-active-bg, #e8697d);
  outline-offset: 2px;
}
.cmp-cat-btn.cmp-cat-active {
  background: var(--cmp-cat-active-bg, #e8697d);
  color: var(--cmp-cat-active-txt, #fff);
  box-shadow: 0 3px 12px rgba(232,105,125,.28);
}

/* ── Search box (right, max ~20%, min 160px) ─────────────── */
.cmp-search-wrap {
  flex: 0 0 clamp(160px, 20%, 260px);
  position: relative;
}

.cmp-search-inner { position: relative; }

.cmp-search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: #bbb;
  display: flex;
  pointer-events: none;
}

.cmp-search-input {
  width: 100%;
  padding: 10px 36px 10px 36px;
  border: 2px solid #f0d8de;
  /* radius via CSS var set by admin */
  border-radius: var(--cmp-search-br, 50px);
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: var(--cmp-card-text, #2d2d2d);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
  appearance: none;
}
.cmp-search-input:focus {
  border-color: var(--cmp-btn-bg, #e8697d);
  box-shadow: 0 0 0 3px rgba(232,105,125,.12);
}
/* Hide browser native clear button */
.cmp-search-input::-webkit-search-cancel-button { display: none; }

.cmp-search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #bbb;
  display: flex;
  padding: 3px;
  border-radius: 50%;
  transition: color .18s;
}
.cmp-search-clear:hover { color: #666; }

/* ── Suggestions dropdown ─────────────────────────────────── */
.cmp-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--cmp-sug-bg, #fff);
  border: 1.5px solid #f0d8de;
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(0,0,0,.10);
  list-style: none;
  z-index: 9999;
  overflow: hidden;
  max-height: 300px;
  overflow-y: auto;
}

.cmp-sug-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  text-decoration: none;
  color: var(--cmp-card-text, #2d2d2d);
  font-size: 13px;
  font-family: inherit;
  transition: background .15s;
}
.cmp-sug-item:hover,
.cmp-sug-item[aria-selected="true"] { background: var(--cmp-sug-hover, #fde6ee); }
.cmp-sug-item:not(:last-child) { border-bottom: 1px solid #f9eaed; }

.cmp-sug-thumb {
  width: 38px; height: 38px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: #f5e8ec;
}
.cmp-sug-thumb-ph {
  width: 38px; height: 38px;
  border-radius: 8px;
  background: #f5e8ec;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cmp-sug-name {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

mark.cmp-hi {
  background: rgba(232,105,125,.22);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

/* ══════════════════════════════════════════════════════════
   GRID
   ══════════════════════════════════════════════════════════ */
.cmp-grid-wrap { position: relative; min-height: 160px; }

.cmp-grid {
  display: grid;
  gap: 20px;
  /* columns injected via cmp_dynamic_css() */
}

/* ══════════════════════════════════════════════════════════
   CARD  (entire <a> is the card)
   ══════════════════════════════════════════════════════════ */
.cmp-card {
  display: flex;
  flex-direction: column;
  background: var(--cmp-card-bg, #fde6ee);
  border-radius: var(--cmp-card-br, 20px);
  overflow: hidden;
  position: relative;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 14px rgba(0,0,0,.07);
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .25s;
  cursor: pointer;
}

/* Hover variants toggled by data-hover on wrapper */
.cmp-wrapper[data-hover="lift"] .cmp-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 14px 32px rgba(0,0,0,.13);
}
.cmp-wrapper[data-hover="glow"] .cmp-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(232,105,125,.36);
}
.cmp-wrapper[data-hover="scale"] .cmp-card:hover {
  transform: scale(1.035);
  box-shadow: 0 10px 26px rgba(0,0,0,.11);
}

/* Image area */
.cmp-card__img-wrap {
  width: 100%;
  padding-top: 80%;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.cmp-card__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: var(--cmp-img-br, 14px);
  padding: 12px 12px 6px;
  transition: transform .3s ease;
}
.cmp-card:hover .cmp-card__img { transform: scale(1.05); }

.cmp-card__img-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Card body */
.cmp-card__body {
  padding: 10px 14px 44px; /* 44px bottom = room for + button */
  flex: 1;
}
.cmp-card__name {
  font-size: var(--cmp-name-size, 15px);
  font-weight: var(--cmp-name-weight, 700);
  font-family: inherit;
  color: var(--cmp-name-color, #2d2d2d);
  line-height: 1.3;
  margin-bottom: 4px;
}
.cmp-card__desc {
  font-size: 11.5px;
  color: #999;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Order (+) button ────────────────────────────────────── */
.cmp-order-btn {
  position: absolute;
  bottom: 11px;
  right: 11px;
  width: 33px;
  height: 33px;
  border-radius: 9px;
  background: var(--cmp-btn-bg, #e8697d);
  color: var(--cmp-btn-text, #fff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  font-weight: 300;
  font-family: inherit;
  line-height: 1;
  border: none;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(232,105,125,.4);
  transition: transform .22s cubic-bezier(.34,1.56,.64,1), box-shadow .2s;
  z-index: 4;
  user-select: none;
}
.cmp-order-btn:hover {
  transform: scale(1.18) rotate(90deg);
  box-shadow: 0 6px 18px rgba(232,105,125,.5);
}
.cmp-order-btn:focus-visible {
  outline: 2px solid var(--cmp-btn-bg, #e8697d);
  outline-offset: 3px;
}

/* ── Best seller badge ───────────────────────────────────── */
.cmp-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--cmp-badge-bg, #4caf50);
  color: var(--cmp-badge-text, #fff);
  font-size: 10px;
  font-weight: 700;
  font-family: inherit;
  padding: 3px 9px;
  border-radius: 50px;
  text-transform: uppercase;
  letter-spacing: .05em;
  z-index: 3;
  box-shadow: 0 2px 8px rgba(0,0,0,.14);
}

/* ── Loading spinner ─────────────────────────────────────── */
.cmp-loading {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(255,248,249,.78);
  backdrop-filter: blur(2px);
  z-index: 10;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
}
.cmp-loading.is-active { display: flex; }
.cmp-spinner {
  width: 36px; height: 36px;
  border: 3px solid #f0d8de;
  border-top-color: var(--cmp-btn-bg, #e8697d);
  border-radius: 50%;
  animation: cmp-spin .7s linear infinite;
}
@keyframes cmp-spin { to { transform: rotate(360deg); } }

/* ── No results ──────────────────────────────────────────── */
.cmp-no-results {
  text-align: center;
  padding: 56px 20px;
  color: #bbb;
  font-size: 15px;
  font-family: inherit;
}

/* ══════════════════════════════════════════════════════════
   PAGINATION
   ══════════════════════════════════════════════════════════ */
.cmp-pag-wrap {
  margin-top: 32px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

/* Load More button */
.cmp-loadmore {
  background: var(--cmp-loadmore-bg, #e8697d);
  color: var(--cmp-loadmore-text, #fff);
  border: none;
  border-radius: 50px;
  padding: 12px 40px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(232,105,125,.3);
  transition: transform .2s, box-shadow .2s, opacity .2s;
}
.cmp-loadmore:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(232,105,125,.4);
}
.cmp-loadmore:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

/* Numbered pagination */
.cmp-pagination {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
.cmp-page-btn {
  background: #fff;
  border: 2px solid #f0d8de;
  border-radius: 8px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background .18s, border-color .18s, color .18s;
  color: var(--cmp-cat-txt, #555);
}
.cmp-page-btn:hover,
.cmp-page-btn.cmp-page-active {
  background: var(--cmp-cat-active-bg, #e8697d);
  border-color: var(--cmp-cat-active-bg, #e8697d);
  color: #fff;
}
.cmp-page-btn.cmp-page-dots {
  border-color: transparent;
  background: transparent;
  cursor: default;
  pointer-events: none;
}

/* ══════════════════════════════════════════════════════════
   CARD ENTRY ANIMATION
   ══════════════════════════════════════════════════════════ */
@keyframes cmp-fade-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cmp-card.cmp-anim { animation: cmp-fade-in .34s ease both; }
.cmp-card.cmp-anim:nth-child(1){animation-delay:.03s}
.cmp-card.cmp-anim:nth-child(2){animation-delay:.06s}
.cmp-card.cmp-anim:nth-child(3){animation-delay:.09s}
.cmp-card.cmp-anim:nth-child(4){animation-delay:.12s}
.cmp-card.cmp-anim:nth-child(5){animation-delay:.15s}
.cmp-card.cmp-anim:nth-child(6){animation-delay:.18s}
.cmp-card.cmp-anim:nth-child(7){animation-delay:.21s}
.cmp-card.cmp-anim:nth-child(8){animation-delay:.24s}
.cmp-card.cmp-anim:nth-child(9){animation-delay:.27s}
.cmp-card.cmp-anim:nth-child(10){animation-delay:.30s}
.cmp-card.cmp-anim:nth-child(11){animation-delay:.33s}
.cmp-card.cmp-anim:nth-child(12){animation-delay:.36s}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */

/* Tablet (601–900px) */
@media (max-width: 900px) {
  .cmp-search-wrap { flex: 0 0 clamp(140px, 26%, 220px); }
}

/* Mobile (≤600px): search on top, tabs below */
@media (max-width: 600px) {
  .cmp-topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  /* Search comes FIRST on mobile */
  .cmp-search-wrap  { order: -1; flex: 1 1 100%; }
  .cmp-category-bar { order:  0; flex: 1 1 100%; }

  .cmp-search-input {
    font-size: 15px;
    padding: 11px 38px 11px 40px;
  }

  .cmp-card__body { padding-bottom: 46px; }
  .cmp-loadmore   { padding: 12px 32px; }
}

/* ══════════════════════════════════════════════════════════
   PAGE BUILDER COMPAT
   ══════════════════════════════════════════════════════════ */
.elementor-widget-shortcode .cmp-wrapper,
.wp-block-shortcode .cmp-wrapper { margin: 0; }

/* ══════════════════════════════════════════════════════════
   ACCESSIBILITY
   ══════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .cmp-card, .cmp-card__img, .cmp-order-btn,
  .cmp-cat-btn, .cmp-spinner, .cmp-loadmore {
    transition: none !important;
    animation: none !important;
  }
}

/* ══════════════════════════════════════════════════════════
   PRINT
   ══════════════════════════════════════════════════════════ */
@media print {
  .cmp-category-bar, .cmp-search-wrap,
  .cmp-order-btn, .cmp-pag-wrap { display: none !important; }
  .cmp-grid { grid-template-columns: repeat(3,1fr) !important; }
}
