/* ========================================
   Pricelist - Hub + Category Pages
   Option B+C hybrid design
   ======================================== */

/* ========================================
   HUB PAGE
   ======================================== */
.hub-page {
  min-height: 100vh;
  background: var(--color-bg);
}

.hub-hero {
  background: linear-gradient(180deg, var(--color-bg-subtle) 0%, var(--color-bg) 100%);
  padding: 56px 0 40px;
  border-bottom: 1px solid var(--color-border);
}

.hub-hero-inner {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}

.hub-hero h1 {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.hub-hero p {
  font-size: 17px;
  color: var(--color-text-muted);
  margin-bottom: 32px;
}

.search-wrap {
  position: relative;
  max-width: 560px;
  margin: 0 auto 16px;
}

.search-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-light);
  pointer-events: none;
}

.hub-search {
  width: 100%;
  padding: 18px 52px 18px 52px;
  font-size: 17px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: white;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  transition: all 0.15s ease;
  font-family: inherit;
}

.hub-search:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-light);
}

.search-clear {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  background: var(--color-bg-muted);
  color: var(--color-text-muted);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.search-clear:hover {
  background: var(--color-border);
  color: var(--color-text);
}

.search-hint {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--color-text-light);
  font-size: 14px;
}

.hint-chip {
  padding: 4px 12px;
  background: var(--color-bg-muted);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 100px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.hint-chip:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-primary-dark);
}

/* ---------- Hub Content ---------- */
.hub-content {
  padding: 48px 0 80px;
}

.categories-intro {
  text-align: center;
  margin-bottom: 40px;
}

.categories-intro h2 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.categories-intro p {
  color: var(--color-text-muted);
  font-size: 16px;
}

/* ---------- Category Cards Grid ---------- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.category-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: all 0.15s ease;
  position: relative;
}

.category-card:hover {
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  text-decoration: none;
}

.cat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  background: var(--color-primary-light);
  color: var(--color-primary);
  flex-shrink: 0;
}

.icon-pulsa { background: #dbeafe; color: #1e40af; }
.icon-paket_data { background: #d1fae5; color: #065f46; }
.icon-token_pln { background: #fef3c7; color: #92400e; }
.icon-e_wallet { background: #ede9fe; color: #5b21b6; }
.icon-voucher_game { background: #fce7f3; color: #9f1239; }
.icon-pascabayar { background: #e0e7ff; color: #3730a3; }
.icon-tagihan { background: #fecaca; color: #991b1b; }
.icon-streaming { background: #fed7aa; color: #9a3412; }
.icon-telp_sms { background: #cffafe; color: #155e75; }
.icon-lainnya { background: #f1f5f9; color: #475569; }

.cat-card-body {
  flex: 1;
  min-width: 0;
}

.cat-card-body h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
}

.cat-card-body p {
  font-size: 13px;
  color: var(--color-text-muted);
}

.cat-card-arrow {
  color: var(--color-text-light);
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.category-card:hover .cat-card-arrow {
  color: var(--color-primary);
  transform: translateX(4px);
}

/* ---------- Search Results ---------- */
.search-results {
  max-width: 800px;
  margin: 0 auto;
}

.results-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.results-header h2 {
  font-size: 22px;
  font-weight: 600;
}

.results-count {
  color: var(--color-text-muted);
  font-size: 14px;
}

.empty-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-muted);
}

.empty-results svg {
  color: var(--color-text-light);
  margin-bottom: 16px;
}

.empty-results h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 8px;
}

.search-list {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.search-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border);
  transition: background 0.1s ease;
}

.search-item:last-child {
  border-bottom: none;
}

.search-item:hover {
  background: var(--color-bg-subtle);
}

.search-item-code {
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-primary-dark);
  background: var(--color-primary-light);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.search-item-main {
  min-width: 0;
}

.search-item-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 4px;
}

.search-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--color-text-muted);
  flex-wrap: wrap;
}

.search-item-meta .dot {
  color: var(--color-text-light);
}

.search-item-price {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.load-more-wrap {
  padding: 20px;
  text-align: center;
  border-top: 1px solid var(--color-border);
}

/* ========================================
   CATEGORY PAGE
   ======================================== */
.category-page {
  min-height: 100vh;
  background: var(--color-bg-subtle);
}

.cat-page-hero {
  background: white;
  padding: 32px 0 24px;
  border-bottom: 1px solid var(--color-border);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}

.breadcrumb a {
  color: var(--color-text-muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--color-primary);
}

.breadcrumb-sep {
  color: var(--color-text-light);
}

.cat-page-title {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.cat-page-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  flex-shrink: 0;
}

.cat-page-title h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 2px;
  letter-spacing: -0.01em;
}

.cat-page-title p {
  color: var(--color-text-muted);
  font-size: 14px;
}

.cat-search-wrap {
  position: relative;
  max-width: 500px;
}

.cat-filter-input {
  width: 100%;
  padding: 10px 40px 10px 42px;
  font-size: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg-subtle);
  transition: all 0.15s ease;
  font-family: inherit;
}

.cat-filter-input:focus {
  outline: none;
  border-color: var(--color-primary);
  background: white;
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* ---------- Category Content ---------- */
.cat-page-content {
  padding: 32px 0;
  min-height: 400px;
}

/* ---------- Operator Layout: Sidebar + Content ---------- */
.operator-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.operator-sidebar {
  position: sticky;
  top: 90px;
  min-width: 0;
}

.sidebar-sticky {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 8px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.sidebar-label {
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.op-link {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
  transition: all 0.1s ease;
  font-family: inherit;
  margin-bottom: 2px;
}

.op-link:hover {
  background: var(--color-bg-subtle);
}

.op-link.active {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  font-weight: 500;
}

.op-link-count {
  font-size: 12px;
  color: var(--color-text-light);
  padding: 1px 8px;
  background: var(--color-bg-muted);
  border-radius: 100px;
}

.op-link.active .op-link-count {
  background: white;
  color: var(--color-primary-dark);
}

/* ---------- Operator Content ---------- */
.operator-content {
  min-width: 0;
}

/* Per-operator loading and error states */
.op-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 20px;
  color: var(--color-text-muted);
  font-size: 14px;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.op-error {
  padding: 40px 20px;
  text-align: center;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.op-error p {
  color: var(--color-danger);
  margin-bottom: 16px;
  font-size: 14px;
}

.op-block {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
  scroll-margin-top: 90px;
}

.op-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-subtle);
}

.op-block-header h2 {
  font-size: 17px;
  font-weight: 600;
}

.op-block-count {
  font-size: 13px;
  color: var(--color-text-muted);
}

/* ---------- Table (shared) ---------- */
.desktop-only { display: block; }
.mobile-only { display: none; }

.product-table-wrap {
  overflow-x: auto;
}

.product-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.product-table thead {
  border-bottom: 1px solid var(--color-border);
}

.product-table th {
  text-align: left;
  padding: 10px 20px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.product-table th.col-price { text-align: right; }
.product-table th.col-status { text-align: center; }
.product-table th.col-code { width: 130px; }
.product-table th.col-price { width: 140px; }
.product-table th.col-status { width: 110px; }

.product-table td {
  padding: 10px 20px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}

.product-table tbody tr:last-child td {
  border-bottom: none;
}

.product-table tbody tr:hover {
  background: var(--color-bg-subtle);
}

.product-table td.col-price {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.product-table td.col-status {
  text-align: center;
}

.code-chip {
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: 12px;
  color: var(--color-primary-dark);
  background: var(--color-primary-light);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  display: inline-block;
  font-weight: 500;
}

/* ---------- Status Badges ---------- */
.status-mini {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
}

.status-mini.status-ready {
  background: #dcfce7;
  color: #15803d;
}

.status-mini.status-issue {
  background: #fee2e2;
  color: #b91c1c;
}

.status-dot-only {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot-only.status-ready { background: #22c55e; }
.status-dot-only.status-issue { background: #ef4444; }

/* ---------- Mobile Cards ---------- */
.product-cards {
  background: white;
}

.product-card-mobile {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
}

.product-card-mobile:last-child {
  border-bottom: none;
}

.card-main {
  flex: 1;
  min-width: 0;
}

.card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.card-name {
  font-size: 14px;
  color: var(--color-text);
  line-height: 1.4;
  word-break: break-word;
}

.card-price {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.empty-filter {
  padding: 32px 20px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 14px;
}

/* ---------- Shared States ---------- */
.loading-state,
.empty-state,
.error-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--color-text-muted);
}

.error-state {
  color: var(--color-danger);
}

.error-state p {
  margin-bottom: 16px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- CTA Strip ---------- */
.cta-strip {
  padding: 48px 0 60px;
  background: var(--color-bg-subtle);
}

.cta-strip-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 32px 40px;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.cta-strip h3 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 4px;
}

.cta-strip p {
  color: var(--color-text-muted);
  font-size: 14px;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .hub-hero {
    padding: 40px 0 28px;
  }

  .hub-hero h1 {
    font-size: 28px;
  }

  .hub-hero p {
    font-size: 15px;
  }

  .hub-search {
    padding: 14px 44px 14px 44px;
    font-size: 15px;
  }

  .category-grid {
    grid-template-columns: 1fr;
  }

  .cat-page-title h1 {
    font-size: 22px;
  }

  .cat-page-icon {
    width: 44px;
    height: 44px;
    font-size: 20px;
  }

  .operator-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .operator-sidebar {
    position: static;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .sidebar-sticky {
    max-height: none;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px;
    gap: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .sidebar-sticky::-webkit-scrollbar {
    height: 4px;
  }

  .sidebar-sticky::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 100px;
  }

  .sidebar-label {
    display: none;
  }

  .op-link {
    flex-shrink: 0;
    width: auto;
    margin-bottom: 0;
    white-space: nowrap;
  }

  .operator-content {
    width: 100%;
    min-width: 0;
  }

  .desktop-only { display: none; }
  .mobile-only { display: block; }

  .cta-strip-inner {
    flex-direction: column;
    text-align: center;
    padding: 24px;
  }
}
