/* Mobile Category Browser — full-screen drill-down navigation */
.mcb-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  background: #fff;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  will-change: transform;
}
.mcb-overlay--open {
  transform: translateX(0);
}

/* Header */
.mcb-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  min-height: 56px;
  flex-shrink: 0;
  background: #fff;
}
.mcb-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border: none;
  background: #f3f4f6;
  border-radius: 8px;
  cursor: pointer;
  color: #374151;
  flex-shrink: 0;
  transition: background .15s;
}
.mcb-back:hover { background: #e5e7eb; }
.mcb-back:focus-visible { outline: 2px solid var(--primary, #2563eb); outline-offset: -2px; }
.mcb-back--hidden { visibility: hidden; }
.mcb-title {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
  color: var(--text, #111827);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mcb-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border: none;
  background: none;
  cursor: pointer;
  color: #6b7280;
  flex-shrink: 0;
  border-radius: 8px;
  transition: background .15s;
}
.mcb-close:hover { background: #f3f4f6; }
.mcb-close:focus-visible { outline: 2px solid var(--primary, #2563eb); outline-offset: -2px; }

/* Search */
.mcb-search {
  padding: 8px 16px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  flex-shrink: 0;
  background: #fff;
}
.mcb-search input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 15px;
  outline: none;
  background: #f9fafb url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239ca3af' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.656a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E") 12px center no-repeat;
  transition: border-color .15s;
  box-sizing: border-box;
}
.mcb-search input:focus {
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

/* Category list */
.mcb-list {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.mcb-panel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow-y: auto;
  transition: transform .25s cubic-bezier(.4,0,.2,1), opacity .25s;
}
.mcb-panel--enter-right {
  transform: translateX(100%);
  opacity: 0;
}
.mcb-panel--enter-left {
  transform: translateX(-100%);
  opacity: 0;
}
.mcb-panel--active {
  transform: translateX(0);
  opacity: 1;
}
.mcb-panel--exit-left {
  transform: translateX(-100%);
  opacity: 0;
}
.mcb-panel--exit-right {
  transform: translateX(100%);
  opacity: 0;
}
.mcb-list-wrap {
  position: relative;
  flex: 1;
  overflow: hidden;
}

/* Individual category item */
.mcb-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  text-decoration: none;
  color: var(--text, #111827);
  transition: background .12s;
  gap: 12px;
}
.mcb-item:hover, .mcb-item:active {
  background: #f0f7ff;
}
.mcb-item:focus-visible {
  outline: 2px solid var(--primary, #2563eb);
  outline-offset: -2px;
  background: #f0f7ff;
}
.mcb-item__icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #eff6ff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 20px;
}
.mcb-item__info {
  flex: 1;
  min-width: 0;
}
.mcb-item__name {
  display: block;
  font-size: 15px;
  font-weight: 500;
  color: var(--text, #111827);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mcb-item__count {
  display: block;
  font-size: 13px;
  color: #6b7280;
  margin-top: 2px;
}
.mcb-item__arrow {
  color: #6b7280;
  flex-shrink: 0;
  transition: transform .15s;
}
.mcb-item:hover .mcb-item__arrow {
  transform: translateX(2px);
  color: var(--primary, #2563eb);
}

/* "Ver todos" link at top of subcategory list */
.mcb-item--view-all {
  background: #f0f7ff;
  border-bottom: 2px solid #dbeafe;
}
.mcb-item--view-all .mcb-item__name {
  color: var(--primary, #2563eb);
  font-weight: 600;
}
.mcb-item--view-all .mcb-item__icon {
  background: #dbeafe;
}

/* Quick links section */
.mcb-section-title {
  padding: 16px 16px 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #6b7280;
}
.mcb-quick-links {
  padding: 0 16px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.mcb-quick-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #f3f4f6;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.mcb-quick-link:hover {
  background: #dbeafe;
  color: #1d4ed8;
}
.mcb-quick-link:focus-visible {
  outline: 2px solid var(--primary, #2563eb);
  outline-offset: -2px;
}

/* No results */
.mcb-empty {
  text-align: center;
  padding: 48px 24px;
  color: #6b7280;
}
.mcb-empty__icon { font-size: 40px; margin-bottom: 12px; }
.mcb-empty__text { font-size: 15px; }

/* Loading */
.mcb-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  gap: 12px;
  color: #6b7280;
}
.mcb-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border, #e5e7eb);
  border-top-color: var(--primary, #2563eb);
  border-radius: 50%;
  animation: mcb-spin .6s linear infinite;
}
@keyframes mcb-spin { to { transform: rotate(360deg); } }

/* Reduced motion: disable all transitions and spinner animation (WCAG 2.3.3) */
@media (prefers-reduced-motion: reduce) {
  .mcb-overlay,
  .mcb-back,
  .mcb-close,
  .mcb-search input,
  .mcb-panel,
  .mcb-item,
  .mcb-item__arrow,
  .mcb-quick-link { transition: none; }
  .mcb-spinner { animation: none; }
  .mcb-item:hover .mcb-item__arrow { transform: none; }
}

/* High contrast: preserve spinner border-top color trick (WCAG 1.4.11) */
@media (forced-colors: active) {
  .mcb-spinner { forced-color-adjust: none; }
  .mcb-search input:focus { outline: 2px solid Highlight; }
}

/* Only show on mobile */
@media (min-width: 769px) {
  .mcb-overlay { display: none !important; }
}
