/* ===============================
   WCMV BROWSE STYLES
================================ */

#wcmv-browse-root {
  --wcmv-browse-heading: var(--wcmv-color-heading, #1f2937);
  --wcmv-browse-muted: var(--wcmv-color-muted, #6b7280);
  --wcmv-browse-card-bg: var(--wcmv-color-card-bg, #ffffff);
  --wcmv-browse-card-border: var(--wcmv-color-card-border, #fde68a);
  --wcmv-browse-btn-start: var(--wcmv-color-button-start, #f97316);
  --wcmv-browse-btn-end: var(--wcmv-color-button-end, #ef4444);
  --wcmv-browse-success: var(--wcmv-color-success, #16a34a);
  --wcmv-browse-info: var(--wcmv-color-info, #0f766e);
  --wcmv-browse-danger: var(--wcmv-color-danger, #92400e);
  --wcmv-browse-badge: var(--wcmv-color-badge, #6366f1);
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  box-sizing: border-box;
}

#wcmv-browse-root *,
#wcmv-browse-root *::before,
#wcmv-browse-root *::after {
  box-sizing: border-box;
}

/* Header */
#wcmv-browse-root .wcmv-header h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--wcmv-browse-heading);
  margin: 0;
}

#wcmv-browse-root .wcmv-header p {
  margin-top: 6px;
  color: var(--wcmv-browse-muted);
}

/* Search card */
#wcmv-browse-root .wcmv-search-card {
  background: var(--wcmv-browse-card-bg);
  border: 2px solid var(--wcmv-browse-card-border);
  border-radius: 16px;
  padding: 20px;
  margin: 24px 0;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

#wcmv-browse-root .wcmv-search-row {
  display: flex !important;
  align-items: center !important;
  gap: 12px;
}

#wcmv-browse-root .wcmv-search-input {
  position: relative;
  flex: 1;
}

#wcmv-browse-root .wcmv-search-input input {
  width: 100% !important;
  padding: 12px 14px 12px 36px;
  border-radius: 10px;
  border: 2px solid #e5e7eb;
  font-size: 15px;
}

#wcmv-browse-root .wcmv-search-input .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.45;
}

#wcmv-browse-root .wcmv-search-btn {
  background: linear-gradient(90deg, var(--wcmv-browse-btn-start), var(--wcmv-browse-btn-end));
  color: #fff;
  border: none;
  padding: 12px 22px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

#wcmv-browse-root .wcmv-save-search-btn {
  border: 1px solid #c6d4ea;
  background: #fff;
  color: #1f2f4a;
  padding: 12px 14px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

#wcmv-browse-root .wcmv-save-search-btn:hover {
  background: #f4f8ff;
}

#wcmv-browse-root .wcmv-mobile-toolbar {
  display: none;
}

#wcmv-browse-root .wcmv-saved-searches {
  grid-area: saved;
  margin: 0;
  padding-top: 6px;
  border-top: 0;
  min-width: 0;
}

#wcmv-browse-root .wcmv-saved-searches-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

#wcmv-browse-root .wcmv-saved-search-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #c8d7ee;
  background: #f6faff;
  border-radius: 999px;
  padding: 4px 8px 4px 10px;
}

#wcmv-browse-root .wcmv-saved-search-chip a {
  text-decoration: none;
  color: #1f2f4a;
  font-weight: 600;
}

#wcmv-browse-root .wcmv-delete-saved-search {
  border: 0;
  background: transparent;
  color: #6b7a93;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

#wcmv-browse-root .wcmv-saved-search-empty {
  color: #6b7280;
  font-size: 13px;
}

/* Filters */
#wcmv-browse-root .wcmv-filters-row {
  display: grid !important;
  grid-template-columns: minmax(170px, 1fr) auto auto minmax(300px, 1.55fr) minmax(220px, 1.1fr);
  grid-template-areas: "category buy view price saved";
  align-items: end;
  gap: 12px;
  margin-top: 16px;
}

#wcmv-browse-root .wcmv-filter-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#wcmv-browse-root .wcmv-filter-group.wcmv-filter-price {
  min-width: 0;
  align-items: flex-start;
  flex-direction: column;
  grid-area: price;
}

#wcmv-browse-root .wcmv-filters-row > .wcmv-filter-group:first-child {
  grid-area: category;
}

#wcmv-browse-root .wcmv-filters-row > .wcmv-checkbox {
  grid-area: buy;
}

#wcmv-browse-root .wcmv-filters-row > .wcmv-view-toggle {
  grid-area: view;
}

#wcmv-browse-root .wcmv-filter-price-label {
  font-weight: 600;
}

#wcmv-browse-root .wcmv-price-fields {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

#wcmv-browse-root .wcmv-price-fields input {
  flex: 1;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 8px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
}

#wcmv-browse-root select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 2px solid #e5e7eb;
}

#wcmv-browse-root .wcmv-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

/* Results */
#wcmv-browse-root .wcmv-results-meta {
  margin-bottom: 14px;
  color: var(--wcmv-browse-muted);
}

#wcmv-browse-root .wcmv-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

#wcmv-browse-root .wcmv-card {
  background: var(--wcmv-browse-card-bg);
  border-radius: 16px;
  padding: 12px;
  border: 2px solid var(--wcmv-browse-card-border);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  position: relative;
}

#wcmv-browse-root .wcmv-card img {
  width: 100% !important;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}

#wcmv-browse-root .wcmv-title {
  font-size: 14px !important;
  font-weight: 700;
  margin: 10px 0 6px;
  line-height: 1.3;
  min-height: calc(1.3em * 2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}

#wcmv-browse-root .wcmv-title a {
  color: inherit;
  text-decoration: none;
}

#wcmv-browse-root .wcmv-price {
  font-weight: 700;
  color: var(--wcmv-browse-success);
  margin-bottom: 8px;
}

.wcmv-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  gap: 6px;
  z-index: 5;
}

.wcmv-badge {
  background: var(--wcmv-browse-badge);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
}

#wcmv-browse-root .wcmv-fav {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #fff;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  border: 1px solid #e5e7eb;
  display: grid;
  place-items: center;
  line-height: 1;
  padding: 0;
  color: #6b7280;
  font-size: 17px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

#wcmv-browse-root .wcmv-fav.active {
  color: #ef4444;
}

#wcmv-browse-root .wcmv-fav-icon {
  display: inline-block;
  transform: translateY(-0.5px);
}

#wcmv-price-slider {
  margin-top: 16px;
}

.wcmv-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.wcmv-price-row .label {
  color: var(--wcmv-browse-muted);
}

.wcmv-price-row .price {
  font-size: 18px;
  font-weight: 800;
  color: var(--wcmv-browse-success);
}

.wcmv-shipping-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  margin-top: 4px;
}

.wcmv-shipping-row .label {
  color: var(--wcmv-browse-muted);
}

.wcmv-shipping-row .price {
  font-size: 14px;
  font-weight: 700;
  color: var(--wcmv-browse-info);
}

.wcmv-shipping-sub {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--wcmv-browse-muted);
}

.wcmv-shipping-row.wcmv-shipping-pickup .price {
  color: var(--wcmv-browse-danger);
}

.wcmv-shipping-row.wcmv-shipping-flat .price {
  color: var(--wcmv-browse-info);
}

.wcmv-shipping-row.wcmv-shipping-calculated .price {
  color: var(--wcmv-browse-info);
}

#wcmv-browse-root .wcmv-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  margin: 8px 0;
  color: #374151;
}

#wcmv-browse-root .wcmv-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

#wcmv-browse-root .wcmv-meta-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  font-size: 11px;
  line-height: 1;
  opacity: 0.9;
}

.wcmv-view-btn {
  display: none !important;
}

.wcmv-vendor {
  font-size: 13px;
  color: var(--wcmv-browse-muted);
  margin-top: 6px;
}

.wcmv-vendor-trust {
  margin-top: 4px;
  font-size: 12px;
  color: #4b5563;
}

/* View toggle */
#wcmv-browse-root .wcmv-view-toggle {
  display: inline-flex;
  background: #f3f4f6;
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
}

#wcmv-browse-root .wcmv-view-toggle button {
  border: none;
  background: transparent;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}

#wcmv-browse-root .wcmv-view-toggle .active {
  background: linear-gradient(90deg, var(--wcmv-browse-btn-start), var(--wcmv-browse-btn-end));
  color: #fff;
}

#wcmv-browse-root .wcmv-grid.list {
  grid-template-columns: 1fr !important;
}

#wcmv-browse-root .wcmv-grid.list .wcmv-card {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 14px;
  align-items: start;
}

#wcmv-browse-root .wcmv-grid.list .wcmv-thumb {
  grid-column: 1;
  grid-row: 1 / span 6;
}

#wcmv-browse-root .wcmv-grid.list .wcmv-card img {
  width: 100% !important;
  aspect-ratio: 1 / 1;
}

#wcmv-browse-root .wcmv-grid.list .wcmv-title,
#wcmv-browse-root .wcmv-grid.list .wcmv-price-row,
#wcmv-browse-root .wcmv-grid.list .wcmv-shipping-row,
#wcmv-browse-root .wcmv-grid.list .wcmv-shipping-sub,
#wcmv-browse-root .wcmv-grid.list .wcmv-meta,
#wcmv-browse-root .wcmv-grid.list .wcmv-vendor,
#wcmv-browse-root .wcmv-grid.list .wcmv-vendor-trust {
  grid-column: 2;
}

/* Pagination */
#wcmv-browse-root .wcmv-pagination {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

#wcmv-browse-root .wcmv-page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 2px solid #e5e7eb;
  background: #ffffff;
  color: #374151;
  text-decoration: none;
  font-weight: 700;
  line-height: 1;
  transition: all 0.15s ease;
}

#wcmv-browse-root .wcmv-page-link:hover {
  border-color: #fdba74;
  background: #fff7ed;
  color: #9a3412;
}

#wcmv-browse-root .wcmv-page-link.is-active {
  background: linear-gradient(90deg, var(--wcmv-browse-btn-start), var(--wcmv-browse-btn-end));
  border-color: transparent;
  color: #ffffff;
}

#wcmv-browse-root .wcmv-page-nav {
  padding: 0 14px;
}

@media (max-width: 1100px) {
  #wcmv-browse-root .wcmv-search-row {
    flex-wrap: wrap;
  }

  #wcmv-browse-root .wcmv-search-input {
    min-width: 260px;
  }

  #wcmv-browse-root .wcmv-filters-row {
    grid-template-columns: minmax(170px, 1fr) auto auto minmax(300px, 1fr);
    grid-template-areas:
      "category buy view price"
      "saved saved saved saved";
  }

  #wcmv-browse-root .wcmv-saved-searches {
    border-top: 1px solid #dbe4f2;
    margin-top: 2px;
    padding-top: 8px;
  }
}

/* Mobile */
@media (max-width: 768px) {
  #wcmv-browse-root {
    padding: 16px;
  }

  #wcmv-browse-root .wcmv-header h1 {
    font-size: 22px;
  }

  #wcmv-browse-root .wcmv-header p {
    font-size: 14px;
  }

  #wcmv-browse-root .wcmv-search-card {
    padding: 16px;
    margin: 16px 0;
  }

  #wcmv-browse-root .wcmv-search-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    align-items: stretch !important;
  }

  #wcmv-browse-root .wcmv-search-input {
    grid-column: 1 / -1;
    min-width: 0;
  }

  #wcmv-browse-root .wcmv-search-btn,
  #wcmv-browse-root .wcmv-save-search-btn {
    width: 100%;
  }

  #wcmv-browse-root .wcmv-mobile-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #dbe4f2;
  }

  #wcmv-browse-root .wcmv-mobile-type-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    flex: 1;
    border: 1px solid #dbe4f2;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
  }

  #wcmv-browse-root .wcmv-mobile-type-tab {
    border: 0;
    background: transparent;
    color: #334155;
    font-weight: 600;
    font-size: 13px;
    line-height: 1.1;
    padding: 10px 8px;
    white-space: nowrap;
    cursor: pointer;
  }

  #wcmv-browse-root .wcmv-mobile-type-tab + .wcmv-mobile-type-tab {
    border-left: 1px solid #e5e7eb;
  }

  #wcmv-browse-root .wcmv-mobile-type-tab.is-active {
    background: #eef5ff;
    color: #1d4ed8;
  }

  #wcmv-browse-root .wcmv-mobile-filter-toggle {
    border: 1px solid #c6d4ea;
    background: #fff;
    color: #1f2f4a;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
  }

  #wcmv-browse-root.wcmv-mobile-filters-closed .wcmv-filters-row {
    display: none !important;
  }

  #wcmv-browse-root.wcmv-mobile-filters-open .wcmv-filters-row {
    display: grid !important;
  }

  #wcmv-browse-root .wcmv-filters-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "category buy"
      "view view"
      "price price"
      "saved saved";
    gap: 10px;
  }

  #wcmv-browse-root .wcmv-filter-group {
    min-width: 0;
  }

  #wcmv-browse-root .wcmv-filter-group,
  #wcmv-browse-root .wcmv-checkbox,
  #wcmv-browse-root .wcmv-view-toggle,
  #wcmv-browse-root .wcmv-filter-group.wcmv-filter-price {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  #wcmv-browse-root .wcmv-checkbox {
    justify-content: flex-start;
    align-items: center;
    padding-top: 6px;
  }

  #wcmv-browse-root .wcmv-view-toggle {
    justify-content: flex-start;
  }

  #wcmv-browse-root .wcmv-saved-searches {
    grid-column: auto;
    margin-top: 2px;
    padding-top: 8px;
    border-top: 1px solid #dbe4f2;
  }

  #wcmv-browse-root .wcmv-price-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    width: 100%;
  }

  #wcmv-browse-root select,
  #wcmv-browse-root .wcmv-search-input input {
    width: 100% !important;
  }

  #wcmv-browse-root .wcmv-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  #wcmv-browse-root .wcmv-grid.list {
    grid-template-columns: 1fr !important;
  }

  #wcmv-browse-root .wcmv-grid.list .wcmv-card {
    grid-template-columns: 110px 1fr;
    gap: 10px;
  }

  #wcmv-browse-root .wcmv-card {
    padding: 10px;
  }

  #wcmv-browse-root .wcmv-card img {
    aspect-ratio: 1 / 1;
  }

  #wcmv-browse-root .wcmv-price-row .price {
    font-size: 16px;
    line-height: 1.15;
  }

  #wcmv-browse-root .wcmv-title {
    font-size: 13px !important;
  }

  #wcmv-browse-root .wcmv-price-row,
  #wcmv-browse-root .wcmv-shipping-row {
    justify-content: flex-start;
    align-items: baseline;
    gap: 0;
  }

  #wcmv-browse-root .wcmv-price-row .label,
  #wcmv-browse-root .wcmv-shipping-row .label {
    display: none;
  }

  #wcmv-browse-root .wcmv-shipping-row .price {
    font-size: 12.5px;
    color: #3b82f6;
  }

  #wcmv-browse-root .wcmv-shipping-row .price::before {
    content: "+ ";
    color: var(--wcmv-browse-muted);
    font-weight: 600;
  }

  #wcmv-browse-root .wcmv-shipping-sub {
    display: none;
  }

  #wcmv-browse-root .wcmv-meta {
    font-size: 11px;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  #wcmv-browse-root .wcmv-meta-icon {
    width: 12px;
    height: 12px;
    font-size: 10px;
  }

  #wcmv-browse-root .wcmv-price-row + .wcmv-price-row-buy-now {
    display: none;
  }

  #wcmv-browse-root .wcmv-pagination {
    flex-wrap: nowrap;
    gap: 3px;
    overflow-x: auto;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  #wcmv-browse-root .wcmv-pagination::-webkit-scrollbar {
    display: none;
  }

  #wcmv-browse-root .wcmv-page-link {
    min-width: 26px;
    height: 30px;
    padding: 0 6px;
    border-radius: 8px;
    border-width: 1px;
    font-size: 12px;
  }

  #wcmv-browse-root .wcmv-page-nav {
    min-width: 22px;
    padding: 0;
    font-size: 0;
    position: relative;
  }

  #wcmv-browse-root .wcmv-page-nav-prev::before,
  #wcmv-browse-root .wcmv-page-nav-next::before {
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
  }

  #wcmv-browse-root .wcmv-page-nav-prev::before {
    content: "\2190";
  }

  #wcmv-browse-root .wcmv-page-nav-next::before {
    content: "\2192";
  }
}

@media (max-width: 480px) {
  #wcmv-browse-root .wcmv-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #wcmv-browse-root .wcmv-mobile-toolbar {
    flex-wrap: wrap;
  }

  #wcmv-browse-root .wcmv-mobile-type-tabs {
    width: 100%;
    order: 2;
  }

  #wcmv-browse-root .wcmv-mobile-filter-toggle {
    order: 1;
    margin-left: auto;
  }

  #wcmv-browse-root .wcmv-filters-row {
    grid-template-columns: 1fr;
    grid-template-areas:
      "category"
      "buy"
      "view"
      "price"
      "saved";
  }

  #wcmv-browse-root .wcmv-price-fields {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}
