/*
 * components.css — TCB Elementor Theme
 * Dialogs, mobile menu, filter toolbar, toast, empty state, WC notices,
 * badge visibility, header action icons.
 * Scoped to avoid conflicts with Elementor and WooCommerce.
 */

/* ─── Dialog Base ────────────────────────────────────────────────────────── */
dialog {
  border: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  max-height: 100dvh;
  overflow: auto;
}

dialog::backdrop {
  background: rgba(38, 45, 38, 0.45);
  backdrop-filter: blur(2px);
}

/* Class toggled on <html> while any dialog is open */
.dialog-open {
  overflow: hidden;
}

/* ─── Close Button ───────────────────────────────────────────────────────── */
.close-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

/* ─── Menu Toggle (hamburger) ────────────────────────────────────────────── */
#menu-toggle {
  display: none; /* shown via responsive.css at ≤760px */
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 34px;
  height: 34px;
  padding: 4px;
}

#menu-toggle span {
  display: block;
  height: 1.5px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

/* ─── Menu Dialog ────────────────────────────────────────────────────────── */
.menu-dialog:not([open]):not(.is-open) {
  display: none !important;
}

.menu-dialog[open],
.menu-dialog.is-open {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.menu-dialog {
  position: fixed;
  inset: 0;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  padding: 16px;
  border: 0;
  background: rgba(25, 35, 23, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99999;
  box-sizing: border-box;
  margin: 0;
}

.menu-dialog::backdrop {
  background: transparent;
}

.menu-dialog-card {
  width: min(420px, calc(100% - 16px));
  max-height: 90vh;
  margin: auto;
  padding: 32px 24px;
  border: 0;
  background: #fafaf7;
  color: #262d26;
  box-shadow: 0 20px 100px rgba(22, 35, 22, 0.25);
  box-sizing: border-box;
  overflow-y: auto;
  position: relative;
  border-radius: 4px;
}

.menu-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  margin-bottom: 12px;
}

.menu-heading h2,
#menu-title {
  font-family: Manrope, sans-serif;
  font-size: 27px;
  font-weight: 500;
  letter-spacing: -1px;
  color: #262d26;
  margin: 0;
  padding-right: 35px;
  line-height: 1.1;
}

.menu-dialog .close-button {
  position: absolute;
  right: -4px;
  top: -6px;
  z-index: 3;
  background: rgba(250, 250, 247, 0.85);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  font-size: 27px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #262d26;
  padding: 0;
  transition: opacity 0.2s;
}

.menu-dialog .close-button:hover {
  opacity: 0.75;
}

/* ─── Mobile Nav Links ───────────────────────────────────────────────────── */
.menu-dialog nav.mobile-nav-links,
.menu-dialog .mobile-nav-links,
.mobile-nav-links {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px;
  margin-top: 25px;
  visibility: visible !important;
  opacity: 1 !important;
}

.mobile-nav-links ul,
.mobile-nav-list {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
}

.mobile-nav-links li,
.mobile-nav-list li {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
}

.menu-dialog .mobile-nav-links a,
.menu-dialog .mobile-nav-links button,
.menu-dialog .mobile-nav-list a,
.mobile-nav-links a,
.mobile-nav-links button,
.mobile-nav-list a {
  min-height: 52px;
  width: 100%;
  padding: 15px 0;
  border-top: 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 1px solid var(--line, #dddfd6);
  font-family: 'DM Sans', sans-serif;
  font-size: 17px;
  font-weight: 500;
  color: #262d26 !important;
  background: transparent;
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
  text-align: left;
  line-height: 1.2;
  transition: opacity 0.2s;
}

.mobile-nav-links a:hover,
.mobile-nav-links button:hover,
.mobile-nav-list a:hover {
  opacity: 0.75;
}

.mobile-nav-links a span,
.mobile-nav-links button span,
.mobile-nav-list a span {
  font-size: 18px;
  color: var(--muted, #71766d);
  line-height: 1;
  flex-shrink: 0;
}

/* ─── Header Action Icon / Label ─────────────────────────────────────────── */
.header-actions .action-icon,
.header-actions #bag-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.header-actions .action-icon svg,
.header-actions #bag-icon svg {
  width: 22px;
  height: 22px;
  display: block;
}

.header-actions .action-label,
.header-actions .bag-label {
  font-size: 12px;
  white-space: nowrap;
}

/* ─── Badge: Wishlist & Bag Count (Desktop: in-flow next to label) ────────── */
.header-actions #wishlist-count,
.header-actions #bag-count,
.header-actions .wishlist-count,
.header-actions .cart-count {
  display: none;
  background: var(--green, #344536);
  color: white;
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
  margin-left: 2px;
  box-sizing: border-box;
  flex-shrink: 0;
}

.header-actions #wishlist-count[data-count]:not([data-count=""]):not([data-count="0"]):not(:empty),
.header-actions #bag-count[data-count]:not([data-count=""]):not([data-count="0"]):not(:empty),
.header-actions .wishlist-count[data-count]:not([data-count=""]):not([data-count="0"]):not(:empty),
.header-actions .cart-count[data-count]:not([data-count=""]):not([data-count="0"]):not(:empty) {
  display: inline-grid;
  place-items: center;
}

/* ─── Results Count ──────────────────────────────────────────────────────── */
.results-count {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}

/* ─── Collection Toolbar ─────────────────────────────────────────────────── */
.collection-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 25px;
}

/* ─── Filter Tabs ────────────────────────────────────────────────────────── */
.filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-tabs button,
.filter-tabs a,
.filter-tabs .filter-tab {
  font-size: 11px;
  border: 1px solid #e0e1d8;
  padding: 10px 17px;
  border-radius: 3px;
  text-decoration: none;
  color: inherit;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  background: transparent;
  line-height: 1;
}

.filter-tabs button span,
.filter-tabs a span,
.filter-tabs .filter-tab span {
  margin-left: 5px;
  font-size: 9px;
}

.filter-tabs button.selected,
.filter-tabs a.selected,
.filter-tabs .filter-tab.selected {
  color: white;
  background: var(--green);
  border-color: var(--green);
}

/* ─── Sort Label / Select ────────────────────────────────────────────────── */
.sort-label {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}

.sort-label select {
  border: 0;
  background: transparent;
  font-size: 11px;
  color: #30372b;
  margin-left: 9px;
  max-width: 160px;
}

/* ─── Search Row ─────────────────────────────────────────────────────────── */
.search-row {
  display: flex;
  margin: 0 0 25px;
  gap: 15px;
}

.search-row input {
  background: white;
  border: 1px solid var(--line);
  padding: 13px;
  flex: 1;
  min-width: 0;
}

.search-row button {
  font-size: 12px;
}

/* ─── Toast Notification ─────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: var(--green);
  color: white;
  padding: 12px 22px;
  font-size: 12px;
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
}

#toast.visible {
  opacity: 1;
}

/* ─── Empty State ────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.empty-state svg {
  width: 48px;
  height: 48px;
  color: var(--muted);
}

.empty-state p {
  font-size: 13px;
  color: var(--muted);
  max-width: 280px;
  line-height: 1.7;
}

/* ─── WooCommerce Notices (styled as .notice) ────────────────────────────── */
.notice,
.woocommerce-message,
.woocommerce-error,
.woocommerce-info {
  padding: 14px 18px;
  font-size: 12px;
  line-height: 1.6;
  border-radius: 2px;
  margin-bottom: 18px;
  list-style: none;
}

/* Info / neutral */
.notice,
.woocommerce-info {
  background: #eef1e8;
  border-left: 3px solid var(--green);
  color: #3e4b35;
}

/* Success */
.notice.success,
.woocommerce-message {
  background: #eaf0e5;
  border-left: 3px solid #5b7246;
  color: #3a4f30;
}

/* Error */
.notice.error,
.woocommerce-error {
  background: #f9eded;
  border-left: 3px solid #b94040;
  color: #7a2a2a;
}

.woocommerce-error li,
.woocommerce-message li,
.woocommerce-info li {
  margin: 0;
  padding: 0;
}

/* ─── Search Modal & Live Preview ────────────────────────────────────────── */
.tcb-search-modal[hidden] {
  display: none !important;
}

.tcb-search-modal:not([hidden]) {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 100000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px 16px;
  box-sizing: border-box;
}

.tcb-search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(25, 35, 23, 0.58);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
}

.tcb-search-dialog {
  position: relative;
  z-index: 2;
  width: min(640px, 100%);
  margin-top: 48px;
  background: #fafaf7;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 24px 52px rgba(0, 0, 0, 0.24);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: min(85vh, 700px);
  animation: tcbSearchSlideDown 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes tcbSearchSlideDown {
  from {
    opacity: 0;
    transform: translateY(-14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.tcb-search-header {
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  padding: 14px 20px;
}

.tcb-search-form {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.tcb-search-input-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: var(--green);
  flex-shrink: 0;
}

.tcb-search-input-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.tcb-search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font-body, 'DM Sans', sans-serif);
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  outline: none;
  padding: 6px 0;
  -webkit-appearance: none;
}

.tcb-search-input::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

.tcb-search-clear {
  background: #eaece4;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  font-size: 16px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.tcb-search-clear:hover {
  background: #dddfd6;
  color: var(--text);
}

.tcb-search-close {
  background: #f0f2eb;
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.tcb-search-close:hover {
  background: #e2e5dc;
  color: #000000;
}

.tcb-search-body {
  padding: 20px 22px;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

/* Suggestions */
.tcb-search-suggestions {
  margin-bottom: 8px;
}

.tcb-suggestions-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 12px;
  display: block;
}

.tcb-suggestion-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tcb-suggestion-tag {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 7px 15px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.tcb-suggestion-tag:hover {
  background: var(--green);
  color: #ffffff;
  border-color: var(--green);
}

/* Live Preview */
.tcb-search-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.tcb-search-results-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.tcb-search-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid transparent;
  text-decoration: none;
  color: inherit;
  transition: all 0.15s;
  cursor: pointer;
}

.tcb-search-item:hover,
.tcb-search-item.is-selected {
  background: #f2f5ec;
  border-color: var(--line);
  transform: translateY(-1px);
}

.tcb-search-item-thumb {
  width: 50px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  background: #e8eae1;
  flex-shrink: 0;
}

.tcb-search-item-info {
  flex: 1;
  min-width: 0;
}

.tcb-search-item-tag {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--green);
  text-transform: uppercase;
  margin-bottom: 3px;
  display: block;
}

.tcb-search-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.tcb-search-item-title mark {
  background: #fcf1c5;
  color: var(--text);
  padding: 0 2px;
  border-radius: 2px;
  font-weight: 700;
}

.tcb-search-item-pricing {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 13px;
}

.tcb-search-item-price {
  font-weight: 700;
  color: var(--text);
}

.tcb-search-item-del {
  font-size: 11px;
  color: var(--muted);
  text-decoration: line-through;
}

.tcb-search-item-discount {
  font-size: 10px;
  font-weight: 700;
  color: #2e6b35;
  background: #eaf3ea;
  padding: 1px 5px;
  border-radius: 3px;
}

.tcb-search-item-arrow {
  font-size: 14px;
  color: var(--muted);
  margin-left: auto;
  flex-shrink: 0;
  transition: transform 0.15s, color 0.15s;
}

.tcb-search-item:hover .tcb-search-item-arrow,
.tcb-search-item.is-selected .tcb-search-item-arrow {
  transform: translateX(2px);
  color: var(--green);
}

.tcb-search-view-all {
  margin-top: 14px;
  text-align: center;
}

.tcb-search-view-all-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 18px;
  border-radius: 8px;
  background: var(--green);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.15s;
  box-sizing: border-box;
}

.tcb-search-view-all-btn:hover {
  opacity: 0.92;
  color: #ffffff;
}

.tcb-search-empty {
  text-align: center;
  padding: 36px 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.tcb-search-empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

@media (max-width: 760px) {
  .tcb-search-modal:not([hidden]) {
    padding: 0;
  }

  .tcb-search-dialog {
    margin: 0;
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    border: 0;
  }

  .tcb-search-backdrop {
    display: none;
  }

  .tcb-search-header {
    padding: 12px 14px;
  }

  .tcb-search-input {
    font-size: 16px;
  }

  .tcb-search-body {
    padding: 16px;
  }
}

