/* ==========================================================================
   CareConnect Health — category / lab archives and AJAX product search.
   Reuses the Pharmacy page styles (chips, toolbar, cards, pagination) from
   main.css so every listing looks the same.
   ========================================================================== */

/* ---------- Catalog ---------- */
.cc-catalog-sec { padding: 0 0 40px; }
.cc-catalog { position: relative; }
.cc-catalog .cc-grid { --cc-cols: 4; }
.cc-catalog--sidebar .cc-grid { --cc-cols: 3; }
.cc-cat-heading { margin-bottom: 22px; }

/* Chips are <label> + hidden input */
.cc-chip { cursor: pointer; position: relative; }
.cc-chip-input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.cc-chip:focus-within { outline: 2px solid var(--cc-primary); outline-offset: 2px; }
.cc-cat-row .cc-clear, .cc-cat-group .cc-clear { background: none; border: 0; padding: 0; cursor: pointer; }
.cc-cat-row .cc-clear[hidden], .cc-cat-group .cc-clear[hidden] { display: none; }

.cc-cat-inline { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: center; margin: -6px 0 22px; }
.cc-cat-select { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; color: var(--cc-heading); }
.cc-cat-select select { padding: 9px 30px 9px 12px; border: 1px solid #E2E5E9; border-radius: 8px; background: #fff; }
.cc-cat-price-inline input { width: 90px; padding: 9px 10px; border: 1px solid #E2E5E9; border-radius: 8px; }
.cc-cat-check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; color: var(--cc-heading); }
.cc-cat-check input { accent-color: var(--cc-primary); width: 16px; height: 16px; }

/* Sidebar layout */
.cc-catalog--sidebar .cc-cat-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 28px; align-items: start; }
.cc-cat-side {
	background: #fff; border: 1px solid var(--cc-border, #E6EBF0); border-radius: var(--cc-radius, 12px);
	padding: 20px; position: sticky; top: 110px; max-height: calc(100vh - 130px); overflow: auto;
}
.admin-bar .cc-cat-side { top: 142px; }
.cc-cat-side-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 12px; margin-bottom: 6px; border-bottom: 1px solid var(--cc-border, #E6EBF0); }
.cc-cat-side-head strong { font-size: 16px; color: var(--cc-heading); }
.cc-cat-group { border: 0; margin: 0; padding: 14px 0; border-bottom: 1px solid var(--cc-border, #E6EBF0); min-width: 0; }
.cc-cat-group:last-of-type { border-bottom: 0; }
.cc-cat-group-title { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 0; margin-bottom: 10px; font-size: 14px; font-weight: 600; color: var(--cc-heading); }
.cc-cat-group-title .cc-clear { font-size: 12px; font-weight: 500; }
.cc-cat-opts { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow: auto; }
.cc-cat-opt { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--cc-text); cursor: pointer; line-height: 1.3; }
.cc-cat-opt input { accent-color: var(--cc-primary); width: 16px; height: 16px; flex: 0 0 auto; margin: 0; }
.cc-cat-opt:hover { color: var(--cc-heading); }
.cc-cat-price { display: flex; align-items: center; gap: 8px; }
.cc-cat-price input { width: 100%; min-width: 0; padding: 9px 10px; border: 1px solid #E2E5E9; border-radius: 8px; }
.cc-cat-apply { margin-top: 14px; }
.cc-cat-filters-toggle { display: none; }

/* Loading state */
.cc-cat-results { transition: opacity .2s; min-height: 120px; }
.cc-catalog.is-loading .cc-cat-results { opacity: .45; pointer-events: none; }
.cc-catalog.is-loading .cc-ph-toolbar .cc-ph-rowtitle::after {
	content: ""; width: 14px; height: 14px; margin-left: 6px; border: 2px solid var(--cc-border, #E6EBF0);
	border-top-color: var(--cc-primary); border-radius: 50%; animation: cc-spin .7s linear infinite;
}
@keyframes cc-spin { to { transform: rotate(360deg); } }

/* Lab card details */
.cc-lab-badges { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--cc-text); text-align: left; }
.cc-lab-badges li { display: flex; align-items: flex-start; gap: 6px; line-height: 1.35; }
.cc-lab-badges .cc-ico { color: var(--cc-primary); flex: 0 0 auto; margin-top: 1px; }

@media (max-width: 1024px) {
	.cc-catalog .cc-grid { --cc-cols: 3; }
	.cc-catalog--sidebar .cc-cat-layout { grid-template-columns: 230px minmax(0, 1fr); gap: 20px; }
	.cc-catalog--sidebar .cc-grid { --cc-cols: 2; }
}
@media (max-width: 767px) {
	.cc-catalog .cc-grid { --cc-cols: 2; gap: 12px; }
	.cc-catalog--sidebar .cc-cat-layout { grid-template-columns: 1fr; }
	.cc-cat-filters-toggle { display: inline-flex; align-items: center; gap: 8px; justify-self: start; }
	.cc-catalog--sidebar .cc-cat-side { display: none; position: static; max-height: none; }
	.cc-catalog.is-filters-open .cc-cat-side { display: block; }
	.cc-catalog .cc-ph-filters, .cc-catalog .cc-ph-filters .cc-search-field { width: 100%; min-width: 0; }
	.cc-catalog .cc-ph-filters select { width: 100%; }
}

/* ---------- AJAX product search ---------- */
.cc-psearch { position: relative; width: 100%; }
.cc-psearch-form { position: relative; display: flex; gap: 8px; align-items: stretch; width: 100%; }
.cc-psearch-cat { flex: 0 0 auto; max-width: 190px; padding: 0 30px 0 12px; border: 1px solid #E2E5E9; border-radius: 8px; background: #fff; }
.cc-psearch-field { position: relative; flex: 1; display: flex; align-items: center; min-width: 0; }
.cc-psearch-field > .cc-ico { position: absolute; left: 13px; color: #9AA1AA; pointer-events: none; }
.cc-psearch-input {
	width: 100%; padding: 12px 40px 12px 42px; border: 1px solid #E2E5E9; border-radius: 8px; background: #fff;
	outline: none; font: inherit; color: var(--cc-heading);
}
.cc-psearch-input:focus { border-color: var(--cc-primary); box-shadow: 0 0 0 3px rgba(67, 185, 63, .12); }
.cc-psearch-input::-webkit-search-cancel-button { -webkit-appearance: none; }
.cc-psearch-clear { position: absolute; right: 10px; background: none; border: 0; padding: 4px; cursor: pointer; color: #9AA1AA; line-height: 0; }
.cc-psearch-clear[hidden] { display: none; }
.cc-psearch-spin {
	position: absolute; right: 38px; width: 16px; height: 16px; border: 2px solid var(--cc-border, #E6EBF0);
	border-top-color: var(--cc-primary); border-radius: 50%; animation: cc-spin .7s linear infinite; display: none;
}
.cc-psearch.is-loading .cc-psearch-spin { display: block; }
.cc-psearch-btn { flex: 0 0 auto; }

.cc-psearch-drop {
	position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 1000; background: #fff;
	border: 1px solid var(--cc-border, #E6EBF0); border-radius: 10px; box-shadow: 0 16px 40px rgba(15, 36, 22, .14);
	max-height: 420px; overflow: auto; padding: 6px;
}
.cc-psearch-drop[hidden] { display: none; }
.cc-psearch-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px; color: var(--cc-heading); text-decoration: none; }
.cc-psearch-item:hover, .cc-psearch-item.is-active { background: var(--cc-cream, #F4FAF1); }
.cc-psearch-img { flex: 0 0 46px; width: 46px; height: 46px; border-radius: 8px; overflow: hidden; background: var(--cc-light, #F7FAFC); display: flex; align-items: center; justify-content: center; }
.cc-psearch-img img { width: 100%; height: 100%; object-fit: contain; }
.cc-psearch-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cc-psearch-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-psearch-meta { font-size: 12px; color: var(--cc-text); }
.cc-psearch-price { flex: 0 0 auto; font-size: 14px; font-weight: 600; color: var(--cc-primary); white-space: nowrap; }
.cc-psearch-price del { color: #9AA1AA; font-weight: 400; margin-right: 4px; }
.cc-psearch-price ins { text-decoration: none; }
.cc-psearch-all { display: block; text-align: center; padding: 10px; margin-top: 4px; border-top: 1px solid var(--cc-border, #E6EBF0); font-size: 13px; font-weight: 600; color: var(--cc-primary); }
.cc-psearch-all.is-active { background: var(--cc-cream, #F4FAF1); }
.cc-psearch-none { padding: 14px; text-align: center; font-size: 14px; color: var(--cc-text); }
.cc-psearch-panel { margin-top: 22px; }
.cc-psearch-panel[hidden] { display: none; }
.cc-psearch-panel .cc-grid { --cc-cols: 4; }
.cc-psearch-foot { text-align: center; margin-top: 18px; }
.cc-psearch-foot .cc-psearch-all { display: inline-block; border: 0; }

@media (max-width: 767px) {
	.cc-psearch-form { flex-wrap: wrap; }
	.cc-psearch-cat { max-width: none; flex: 1 1 100%; padding: 10px 12px; }
	.cc-psearch-btn { flex: 1 1 100%; }
	.cc-psearch-panel .cc-grid { --cc-cols: 2; gap: 12px; }
}
