/* ==========================================================================
   Treolan B2B Catalog Replica Stylesheet
   Preserves Treolan's 24-category tree, multi-level hierarchy, spec facets,
   series filter, and B2B table/grid views.
   ========================================================================== */

/* 1. Comparison Switch Bar */
.catalog-version-switch-bar {
  background: linear-gradient(90deg, #0f172a 0%, #1e293b 100%);
  color: #e2e8f0;
  border-bottom: 2px solid #2563eb;
  padding: 8px 16px;
  font-size: 13px;
  position: relative;
  z-index: 100;
}

.version-switch-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.version-switch-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.version-label {
  font-weight: 600;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 6px;
}

.version-toggle-group {
  display: inline-flex;
  background: #334155;
  border-radius: 8px;
  padding: 3px;
  gap: 4px;
}

.version-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: #cbd5e1;
  text-decoration: none;
  transition: all 0.2s ease;
}

.version-toggle-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.version-toggle-btn.active {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.35);
}

.v-pill {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.15);
  font-weight: 500;
}

.active-pill {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.version-switch-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.version-info-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.3);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}

/* 2. Page Header Banner */
.treo-header-banner {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 16px 24px;
}

.treo-header-container {
  max-width: 1440px;
  margin: 0 auto;
}

.treo-breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
  color: #64748b;
  margin-bottom: 8px;
}

.treo-crumb-link {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
}

.treo-crumb-link:hover {
  text-decoration: underline;
}

.treo-crumb-sep {
  color: #94a3b8;
  font-size: 11px;
}

.treo-crumb-current {
  color: #0f172a;
  font-weight: 600;
}

.treo-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.treo-page-title {
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.treo-cat-badge {
  font-size: 13px;
  background: #f1f5f9;
  color: #475569;
  padding: 3px 9px;
  border-radius: 12px;
  font-weight: 600;
}

/* 3. Subcategories & Series Quick Filter Bar */
.treo-series-bar {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px dashed #e2e8f0;
}

.treo-series-label {
  font-size: 12.5px;
  font-weight: 600;
  color: #64748b;
  margin-right: 4px;
}

.treo-series-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  font-size: 12.5px;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.treo-series-chip:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.treo-series-chip.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
  font-weight: 600;
}

.treo-series-count {
  font-size: 11px;
  opacity: 0.8;
}

/* 4. Layout */
.treo-app-container {
  max-width: 1440px;
  margin: 20px auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1024px) {
  .treo-app-container {
    grid-template-columns: 1fr;
  }
}

/* 5. Sidebar Treolan Category Tree */
.treo-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.treo-tree-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.treo-tree-header {
  padding: 14px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.treo-tree-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.treo-tree-search {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  position: relative;
}

.treo-tree-search-input {
  width: 100%;
  padding: 7px 10px 7px 32px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 12.5px;
  outline: none;
  transition: border-color 0.15s ease;
}

.treo-tree-search-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.1);
}

.treo-tree-search-icon {
  position: absolute;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 12px;
}

.treo-tree-container {
  max-height: 520px;
  overflow-y: auto;
  padding: 6px 0;
}

/* Custom Scrollbar */
.treo-tree-container::-webkit-scrollbar,
.treo-filter-scroll::-webkit-scrollbar {
  width: 6px;
}
.treo-tree-container::-webkit-scrollbar-thumb,
.treo-filter-scroll::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

/* Category Node Styles */
.treo-cat-node {
  user-select: none;
}

.treo-cat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px 7px 10px;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
}

.treo-cat-item:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.treo-cat-item.active {
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 600;
  border-left-color: #2563eb;
}

.treo-cat-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.treo-cat-arrow {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 10px;
  transition: transform 0.2s ease;
  cursor: pointer;
}

.treo-cat-arrow.expanded {
  transform: rotate(90deg);
  color: #2563eb;
}

.treo-cat-icon {
  font-size: 13px;
  color: #f59e0b; /* Folder icon color */
  flex-shrink: 0;
}

.treo-cat-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12.5px;
}

.treo-cat-count {
  font-size: 11px;
  color: #94a3b8;
  padding-left: 6px;
  flex-shrink: 0;
}

.treo-cat-item.active .treo-cat-count {
  color: #3b82f6;
  font-weight: 600;
}

/* Nested Children */
.treo-children {
  padding-left: 14px;
  display: none;
  position: relative;
}

.treo-children.open {
  display: block;
}

.treo-children::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #e2e8f0;
}

.treo-level-2 .treo-cat-icon {
  color: #38bdf8;
  font-size: 12px;
}

.treo-level-3 .treo-cat-icon {
  color: #818cf8;
  font-size: 11px;
}

.treo-level-3 .treo-cat-name {
  font-size: 12px;
}

/* 6. Filter Cards */
.treo-filter-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.treo-filter-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.treo-filter-scroll {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}

.treo-checkbox-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: #334155;
  cursor: pointer;
  padding: 3px 0;
}

.treo-checkbox-item:hover {
  color: #0f172a;
}

.treo-checkbox-item input[type="checkbox"] {
  margin-right: 8px;
  accent-color: #2563eb;
  cursor: pointer;
}

.treo-checkbox-left {
  display: flex;
  align-items: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.treo-facet-count {
  font-size: 11px;
  color: #94a3b8;
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 10px;
  margin-left: 6px;
}

/* 7. Reset Filters Button */
.treo-btn-reset {
  width: 100%;
  padding: 9px;
  border: 1px dashed #ef4444;
  background: #fef2f2;
  color: #dc2626;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.treo-btn-reset:hover {
  background: #fee2e2;
}

/* 8. Main Section Toolbar */
.treo-toolbar {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.treo-toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.treo-results-count {
  font-size: 13.5px;
  font-weight: 600;
  color: #475569;
}

.treo-toolbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.treo-view-toggles {
  display: inline-flex;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 3px;
  gap: 3px;
}

.treo-view-btn {
  border: none;
  background: transparent;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.treo-view-btn.active {
  background: #ffffff;
  color: #2563eb;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.treo-sort-select {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  color: #334155;
  background: #ffffff;
  outline: none;
  cursor: pointer;
}

/* 9. Product Grid View */
.treo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.treo-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
  position: relative;
}

.treo-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 8px 16px -4px rgba(37, 99, 235, 0.12);
  transform: translateY(-2px);
}

.treo-card-img-wrap {
  position: relative;
  height: 200px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  cursor: pointer;
}

.treo-card-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.treo-card-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.treo-vendor-badge {
  background: #0f172a;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.treo-comp-badge {
  background: #10b981;
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
}

.treo-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.treo-card-articul {
  font-size: 11.5px;
  color: #64748b;
  font-family: monospace;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.treo-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.35;
  margin-bottom: 10px;
  height: 38px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  cursor: pointer;
}

.treo-card-title:hover {
  color: #2563eb;
}

.treo-stock-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  margin-bottom: 12px;
}

.treo-stock-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.treo-stock-dot.in { background: #10b981; }
.treo-stock-dot.out { background: #94a3b8; }

.treo-card-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.treo-price-block {
  display: flex;
  flex-direction: column;
}

.treo-price-rub {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
}

.treo-price-usd {
  font-size: 12px;
  color: #64748b;
}

.treo-btn-cart {
  background: #2563eb;
  color: #ffffff;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.treo-btn-cart:hover {
  background: #1d4ed8;
}

/* 10. B2B Table View */
.treo-table-wrap {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.treo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.treo-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

.treo-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.treo-table tr:hover {
  background: #f8fafc;
}

.treo-tbl-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  background: #f1f5f9;
  border-radius: 6px;
  padding: 2px;
  cursor: pointer;
}

.treo-tbl-name {
  font-weight: 600;
  color: #0f172a;
  cursor: pointer;
}
.treo-tbl-name:hover {
  color: #2563eb;
}

.treo-tbl-pn {
  font-family: monospace;
  font-size: 11.5px;
  color: #64748b;
}

.treo-tbl-dealers {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.treo-dealer-tag {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}
.treo-dealer-tag.treolan { background: #e0f2fe; color: #0284c7; }
.treo-dealer-tag.netlab { background: #dcfce7; color: #16a34a; }
.treo-dealer-tag.merlion { background: #fef3c7; color: #d97706; }

/* 11. Pagination */
.treo-pagination {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.treo-page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.treo-page-btn:hover {
  border-color: #2563eb;
  color: #2563eb;
}

.treo-page-btn.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
  font-weight: 700;
}

.treo-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* 12. Modal Quick View */
.treo-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.treo-modal-content {
  background: #ffffff;
  border-radius: 16px;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  position: relative;
  padding: 24px;
}

.treo-modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  border: none;
  background: #f1f5f9;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 16px;
}

.treo-modal-close:hover {
  background: #e2e8f0;
  color: #0f172a;
}
