/*
 * 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]) {
  display: none !important;
}

.menu-dialog[open] {
  display: flex;
}

.menu-dialog {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(320px, 90vw);
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 0 0 auto;
  padding: 28px 24px 40px;
  flex-direction: column;
  gap: 0;
  animation: none;
  background: #fafaf7;
  border: 0;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.08);
  z-index: 10000;
}

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

.menu-heading h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.menu-heading span {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--muted);
}

/* ─── Mobile Nav Links ───────────────────────────────────────────────────── */
.mobile-nav-links,
.mobile-nav-links ul,
.mobile-nav-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
}

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

.mobile-nav-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  font-weight: 500;
  color: inherit;
  text-decoration: none;
}

.mobile-nav-links a span {
  font-size: 20px;
  color: var(--muted);
}

/* ─── 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;
  position: static;
}

.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;
}
