/* ═══════════════════════════════════════════════════
   list.css — Trang danh sách hoá chất & sản phẩm
   ═══════════════════════════════════════════════════ */

/* ── PAGE HEADER ── */
.list-header {
  background: linear-gradient(135deg, var(--green-900) 0%, var(--green-800) 100%);
  padding: calc(var(--nav-h) + 48px) var(--page-pad) 48px;
  text-align: center; position: relative; overflow: hidden;
}
.list-header::before {
  content: '';
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='92'%3E%3Cpolygon points='40,2 78,22 78,70 40,90 2,70 2,22' fill='none' stroke='rgba(134,239,172,0.07)' stroke-width='1.5'/%3E%3C/svg%3E");
  background-size: 80px 92px; pointer-events: none;
}
.list-header-inner { position: relative; z-index: 1; max-width: var(--page-max); margin: 0 auto; }
.list-header h1 { color: #fff; font-size: clamp(1.8rem,4vw,2.8rem); margin-bottom: 24px; line-height: 1.4;  }
.list-header p  { color: rgba(255,255,255,0.65); font-size: 0.95rem; margin-bottom: 28px; }

.chem-header h1 { margin-bottom: 24px; line-height: 1.4; }
.chem-header p  { margin-bottom: 28px; line-height: 1.6; }

/* Stats badges */
.list-stats {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 12px;
}
.list-stat-badge {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 100px; padding: 6px 18px;
  color: rgba(255,255,255,0.85); font-size: 0.85rem; font-weight: 500;
}
.list-stat-badge strong { color: var(--green-300); }

/* ── TOOLBAR ── */
.list-toolbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 16px var(--page-pad); position: sticky; top: var(--nav-h); z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.list-toolbar-inner {
  max-width: var(--page-max); margin: 0 auto;
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
}

/* Search bar nhỏ */
.list-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 14px;
  flex: 1; min-width: 220px; max-width: 360px;
  transition: border-color 0.18s;
}
.list-search:focus-within { border-color: var(--accent); background: #fff; }
.list-search input {
  flex: 1; border: none; background: none; outline: none;
  font-family: var(--font-body); font-size: 0.88rem; color: var(--text);
}
.list-search input::placeholder { color: var(--muted); }
.list-search-icon { color: var(--muted); font-size: 16px; flex-shrink: 0; }

/* Filter chips */
.filter-chips {
  display: flex; flex-wrap: wrap; gap: 7px; align-items: center;
}
.filter-chip {
  background: var(--surface2); border: 1.5px solid var(--border);
  border-radius: 100px; padding: 5px 14px;
  font-size: 0.80rem; font-weight: 500; color: var(--text2);
  cursor: pointer; transition: all 0.18s; white-space: nowrap;
}
.filter-chip:hover  { border-color: var(--accent); color: var(--accent); background: var(--green-50); }
.filter-chip.active { background: var(--green-100); border-color: var(--green-400); color: var(--green-700); font-weight: 600; }

/* Count */
.list-count { color: var(--muted); font-size: 0.83rem; margin-left: auto; white-space: nowrap; }
.list-count strong { color: var(--accent); }

/* ── MAIN CONTENT ── */
.list-main {
  max-width: var(--page-max); margin: 32px auto;
  padding: 0 var(--page-pad) 80px;
}

/* ─── CHEMICALS LIST ─── */
.chem-list-grid {
  display: flex; flex-direction: column; gap: 10px;
}

.chem-list-item {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-md); padding: 16px 22px;
  display: flex; align-items: center; gap: 18px;
  cursor: pointer; transition: all 0.18s;
  text-decoration: none; color: inherit;
  box-shadow: var(--shadow-sm);
}
.chem-list-item:hover {
  border-color: var(--green-400); background: var(--green-50);
  transform: translateX(4px);
  box-shadow: -4px 0 0 var(--accent), var(--shadow-md);
}

.chem-list-num {
  color: var(--muted); font-size: 0.75rem; font-weight: 600;
  min-width: 32px; text-align: right; flex-shrink: 0;
}
.chem-list-formula {
  font-family: var(--font-mono); font-size: 1.1rem; font-weight: 600;
  color: var(--accent); min-width: 100px; flex-shrink: 0;
}
.chem-list-info { flex: 1; min-width: 0; }
.chem-list-name { font-weight: 600; font-size: 0.97rem; color: var(--text); margin-bottom: 2px; }
.chem-list-sub {
  color: var(--muted); font-size: 0.80rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chem-list-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 5px; }
.chem-list-arrow {
  color: var(--border2); font-size: 20px; flex-shrink: 0;
  transition: transform 0.18s, color 0.18s;
}
.chem-list-item:hover .chem-list-arrow { transform: translateX(4px); color: var(--accent); }

/* ─── PRODUCTS GRID ─── */
.prod-list-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

.prod-list-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  cursor: pointer; transition: all 0.22s;
  text-decoration: none; color: inherit;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
}
.prod-list-card:hover {
  border-color: var(--green-400);
  transform: translateY(-4px); box-shadow: var(--shadow-lg);
}

.prod-card-thumb {
  height: 140px;
  background: linear-gradient(135deg, var(--green-800), var(--green-900));
  display: flex; align-items: center; justify-content: center;
  font-size: 52px; position: relative; overflow: hidden;
}
.prod-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.prod-card-category {
  position: absolute; bottom: 10px; left: 10px;
}

.prod-card-body { padding: 16px; flex: 1; display: flex; flex-direction: column; gap: 7px; }
.prod-card-name { font-weight: 700; font-size: 0.95rem; color: var(--text); line-height: 1.3; }
.prod-card-desc {
  color: var(--text2); font-size: 0.81rem; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; flex: 1;
}
.prod-card-chems {
  display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px;
}
.prod-card-chem {
  background: var(--green-100); border: 1px solid var(--green-300);
  border-radius: 100px; padding: 2px 9px;
  font-size: 0.69rem; font-family: var(--font-mono); color: var(--green-700);
}

/* ── EMPTY STATE ── */
.list-empty {
  text-align: center; padding: 80px 0; color: var(--muted);
}
.list-empty-icon { font-size: 52px; margin-bottom: 14px; opacity: 0.3; }

/* ── ALPHABET INDEX (sidebar nhanh cho chemicals) ── */
.alpha-index {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px;
}
.alpha-btn {
  width: 32px; height: 32px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 0.80rem; font-weight: 600;
  color: var(--text2); cursor: pointer; transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.alpha-btn:hover  { background: var(--green-50); border-color: var(--accent); color: var(--accent); }
.alpha-btn.active { background: var(--green-100); border-color: var(--green-400); color: var(--green-700); }

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  .list-toolbar { padding: 12px var(--page-pad-sm); }
  .list-main    { padding: 0 var(--page-pad-sm) 60px; }
  .list-header  { padding: calc(var(--nav-h) + 32px) var(--page-pad-sm) 32px; }
  .chem-list-num { display: none; }
  .chem-list-formula { min-width: 70px; font-size: 0.95rem; }
  .prod-list-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 400px) {
  .prod-list-grid { grid-template-columns: 1fr; }
}
/* ── Chống tràn ngang trên điện thoại (chữ lớn hơn) ── */
.filter-chips { max-width: 100%; }
.chem-list-item { min-width: 0; }
@media (max-width: 600px) {
  .filter-chip { white-space: normal; text-align: center; }
  .chem-list-item { padding: 14px 14px; gap: 12px; }
  .chem-list-num { display: none; }
  .chem-list-formula { min-width: 0; max-width: 34%; flex-shrink: 1; overflow-wrap: anywhere; font-size: 0.85rem; }
}
