/* ESP-i Catalog — styled to match the reference catalog layout.
   Scoped under #espi-catalog / .espi-catalog-endpoint. */

/* Accents inherit the Riode theme palette (falls back if the vars are absent). */
:root {
	--espi-blue: var(--rio-primary-color, #2f7de1);
	--espi-blue-hover: var(--rio-primary-color-hover, #2266c4);
	--espi-blue-dark: var(--rio-dark-color, #1b2a56);
	--espi-navy: var(--rio-dark-color, #16305c);
	--espi-ink: #1f2a37;
	--espi-muted: #64748b;
	--espi-line: #e5e9f0;
	--espi-card: #f3f6fb;
	--espi-card-hover: #eceff5;
	--espi-radius: 12px;
}

/* ============================================================
   Catalog page chrome: no page-title banner, sticky site header.
   Scoped to the catalog endpoint only.
   ============================================================ */

/* This theme's header is a transparent overlay that sits on top of the page
   banner. We don't want the tall title banner (it pushes the catalog below the
   fold), but the header still needs a dark backdrop or the white logo + menu
   vanish. So collapse the banner to a short dark strip the height of the header:
   backdrop restored, content pushed below the header, minimal scroll. */
.espi-catalog-endpoint .page-header {
	min-height: 170px;
	padding: 0 !important;
	margin: 0 !important;
	background-image: none !important;
	background-color: #222 !important;
}
.espi-catalog-endpoint .page-header .page-title-wrap,
.espi-catalog-endpoint .page-header .breadcrumb,
.espi-catalog-endpoint .ptb-block,
.espi-catalog-endpoint .breadcrumb_wrapper {
	display: none !important;
}
.espi-catalog-endpoint main.main { padding-top: 24px; }

/* Sticky site header. catalog.js adds .espi-sticky-header only when the
   theme's own sticky header (.sticky-content) is not configured. */
.espi-catalog-endpoint #header.espi-sticky-header {
	position: sticky;
	top: 0;
	z-index: 1001;
	background: #fff;
}
.espi-catalog-endpoint #header.espi-sticky-header.espi-stuck {
	box-shadow: 0 2px 14px rgba(0, 0, 0, .1);
}
.admin-bar.espi-catalog-endpoint #header.espi-sticky-header { top: 32px; }
@media (max-width: 782px) {
	.admin-bar.espi-catalog-endpoint #header.espi-sticky-header { top: 46px; }
}

/* ============================================================
   My Account — horizontal, on-brand menu (ALL account pages,
   incl. the Catalog endpoint). Turns Riode's vertical sidebar
   into a full-width tab bar with the content stacked beneath.
   ============================================================ */

/* Stack nav (top) + content (below), each full width. */
.woocommerce-account .woocommerce-MyAccount-navigation,
.woocommerce-account .woocommerce-MyAccount-content {
	width: 100% !important;
	max-width: 100% !important;
	flex: 0 0 100% !important;
	float: none !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
}
.woocommerce-account .woocommerce > .row,
.woocommerce-account .elementor-widget-woocommerce-my-account .woocommerce > .row {
	flex-wrap: wrap !important;
}

/* The horizontal bar. */
.woocommerce-account .woocommerce-MyAccount-navigation {
	margin-bottom: 28px !important;
}
.woocommerce-account .woocommerce-MyAccount-navigation ul {
	display: flex !important;
	flex-wrap: wrap;
	gap: 4px;
	list-style: none !important;
	margin: 0 !important;
	padding: 6px !important;
	background: var(--espi-card);
	border: 1px solid var(--espi-line);
	border-radius: 12px;
}
.woocommerce-account .woocommerce-MyAccount-navigation ul li {
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	list-style: none !important;
	background: none !important;
}
.woocommerce-account .woocommerce-MyAccount-navigation ul li a {
	display: block;
	padding: 12px 22px !important;
	border: 0 !important;
	border-radius: 8px;
	color: var(--espi-navy) !important;
	font-weight: 600;
	font-size: 14px;
	line-height: 1.2;
	text-decoration: none !important;
	transition: background .15s, color .15s;
}
/* Kill Riode's per-item icons/arrows so it reads as a clean tab bar. */
.woocommerce-account .woocommerce-MyAccount-navigation ul li a::before,
.woocommerce-account .woocommerce-MyAccount-navigation ul li a::after {
	content: none !important;
	display: none !important;
}
.woocommerce-account .woocommerce-MyAccount-navigation ul li a:hover {
	background: var(--espi-card-hover);
	color: var(--espi-blue) !important;
}
.woocommerce-account .woocommerce-MyAccount-navigation ul li.is-active a,
.woocommerce-account .woocommerce-MyAccount-navigation ul li.woocommerce-MyAccount-navigation-link--customer-logout a:hover {
	background: var(--espi-blue);
	color: #fff !important;
}
/* Logout sits on the right. */
.woocommerce-account .woocommerce-MyAccount-navigation ul li.woocommerce-MyAccount-navigation-link--customer-logout {
	margin-left: auto !important;
}

/* Content sits full-width beneath the bar. */
.woocommerce-account .woocommerce-MyAccount-content {
	background: transparent;
}

@media (max-width: 680px) {
	.woocommerce-account .woocommerce-MyAccount-navigation ul { gap: 2px; }
	.woocommerce-account .woocommerce-MyAccount-navigation ul li a { padding: 10px 14px !important; font-size: 13px; }
	.woocommerce-account .woocommerce-MyAccount-navigation ul li.woocommerce-MyAccount-navigation-link--customer-logout { margin-left: 0 !important; }
}

#espi-catalog {
	--fs: 14px;
	color: var(--espi-ink);
	font-size: var(--fs);
	line-height: 1.5;
}
#espi-catalog *, #espi-catalog *::before, #espi-catalog *::after { box-sizing: border-box; }
#espi-catalog a { text-decoration: none; }

/* ---- Panels ---- */
.espi-panel {
	background: #fff;
	border: 1px solid var(--espi-line);
	border-radius: var(--espi-radius);
	padding: 22px;
	margin-bottom: 22px;
}

/* ---- Search bar ---- */
.espi-searchbar {
	display: flex;
	align-items: center;
	gap: 16px;
	background: #fff;
	border: 1px solid var(--espi-line);
	border-radius: var(--espi-radius);
	padding: 16px 18px;
	margin-bottom: 22px;
}
.espi-search-input { flex: 1 1 auto; }
.espi-search-input input {
	width: 100%;
	height: 46px;
	border: 1px solid var(--espi-line);
	border-radius: 999px;
	padding: 0 20px;
	font-size: 15px;
	outline: none;
	background: #fff;
}
.espi-search-input input:focus { border-color: var(--espi-blue); }
/* The button itself is styled by the theme (.btn.btn-primary.btn-rounded.btn-sm);
   only sizing/flow tweaks live here. */
.espi-searchbar .espi-btn-primary { flex: 0 0 auto; align-self: center; }
.espi-parts-count {
	border: 1px solid var(--espi-line);
	border-radius: 8px;
	padding: 10px 18px;
	color: var(--espi-muted);
	white-space: nowrap;
}
.espi-parts-count strong { color: var(--espi-blue); font-size: 18px; }

/* Cart icon + live count badge. */
.espi-cart-link {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 46px;
	height: 46px;
	border: 1px solid var(--espi-line);
	border-radius: 8px;
	color: var(--espi-ink);
	transition: color .15s, border-color .15s;
}
.espi-cart-link:hover { color: var(--espi-blue); border-color: var(--espi-blue); }
.espi-cart-link i { font-size: 22px; line-height: 1; }
.espi-cart-count {
	position: absolute;
	top: -8px;
	right: -8px;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 999px;
	background: var(--espi-blue);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 20px;
	text-align: center;
}
.espi-cart-count.is-empty { display: none; }

/* ---- Categories ---- */
.espi-cats-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.espi-cats-title { font-weight: 700; font-size: 16px; }
.espi-breadcrumb { color: var(--espi-muted); font-size: 13px; }
.espi-breadcrumb a { color: var(--espi-blue); }
.espi-breadcrumb .espi-sep { margin: 0 6px; }

#espi-catalog .espi-cats-grid {
	display: grid !important;
	grid-template-columns: repeat(7, 1fr);
	gap: 14px;
}
.espi-cat-card {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	background: var(--espi-card);
	border: 1px solid transparent;
	border-radius: 10px;
	padding: 14px 16px;
	min-height: 74px;
	cursor: pointer;
	text-align: left;
	transition: background .15s, border-color .15s, transform .05s;
}
.espi-cat-card:hover { background: var(--espi-card-hover); }
.espi-cat-card.active { border-color: var(--espi-blue); background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.12); }
.espi-cat-name { font-weight: 600; font-size: 13px; color: var(--espi-ink); }
/* High specificity + !important so theme `img{width:100%}` rules can't blow these up. */
#espi-catalog .espi-cats-grid .espi-cat-card .espi-cat-img {
	width: 48px !important;
	height: 48px !important;
	min-width: 48px;
	max-width: 48px;
	object-fit: contain;
	flex: 0 0 auto;
	border-radius: 6px;
	background: #fff;
}

/* ---- Filter tabs ---- */
.espi-tabs { margin-bottom: 22px; }
.espi-tab-heads { display: flex; gap: 4px; border-bottom: 1px solid var(--espi-line); flex-wrap: wrap; }
.espi-tab-head {
	background: transparent;
	border: 1px solid transparent;
	border-bottom: none;
	padding: 12px 18px;
	font-size: 14px;
	color: var(--espi-muted);
	cursor: pointer;
	border-radius: 8px 8px 0 0;
	margin-bottom: -1px;
}
.espi-tab-head.active {
	color: var(--espi-ink);
	background: #fff;
	border-color: var(--espi-line);
	font-weight: 600;
}
.espi-tab-panel { display: none; border: 1px solid var(--espi-line); border-top: none; padding: 18px; background: #fff; border-radius: 0 0 10px 10px; }
.espi-tab-panel.active { display: block; }
.espi-facets { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.espi-facet { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 13px; }
.espi-facet input { accent-color: var(--espi-blue); width: 16px; height: 16px; }
.espi-facet em { color: var(--espi-muted); font-style: normal; }
.espi-facets-empty { color: var(--espi-muted); font-style: italic; }

/* ---- Products table ---- */
.espi-products-head, .espi-products-foot {
	display: flex; align-items: center; justify-content: space-between;
	padding: 4px 2px 16px;
}
.espi-products-foot { padding: 16px 2px 4px; }
.espi-products-title { font-weight: 700; font-size: 16px; }

.espi-table-wrap { overflow-x: auto; position: relative; }
.espi-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.espi-table thead th {
	text-align: left;
	color: var(--espi-muted);
	font-weight: 600;
	font-size: 13px;
	padding: 12px 14px;
	border-bottom: 2px solid var(--espi-line);
	white-space: nowrap;
}
.espi-sortable { cursor: pointer; user-select: none; }
.espi-sortable::after { content: "\2195"; opacity: .35; margin-left: 6px; font-size: 11px; }
.espi-sortable.sort-asc::after { content: "\2191"; opacity: 1; }
.espi-sortable.sort-desc::after { content: "\2193"; opacity: 1; }

.espi-table tbody td { padding: 13px 14px; border-bottom: 1px solid var(--espi-line); vertical-align: middle; }
.espi-row:nth-child(4n+1) td { background: #fbfcfe; }
.espi-row:hover td { background: #f4f8ff; }
.espi-c-name a { color: var(--espi-blue); font-weight: 500; }
.espi-c-name a:hover { text-decoration: underline; }
.espi-c-sku { color: var(--espi-ink); font-weight: 600; white-space: nowrap; }
.espi-c-cct, .espi-c-dim { color: var(--espi-muted); white-space: nowrap; }
.espi-c-price { white-space: nowrap; font-weight: 600; }
.espi-c-exp { width: 40px; }
.espi-c-act { width: 70px; text-align: center; }

.espi-exp {
	width: 26px; height: 26px; line-height: 22px;
	border: 1px solid var(--espi-line);
	background: #fff; color: var(--espi-blue);
	border-radius: 50%; cursor: pointer; font-size: 16px; font-weight: 700;
	display: inline-flex; align-items: center; justify-content: center;
}
.espi-exp:hover { border-color: var(--espi-blue); background: #f0f6ff; }
/* Small icon add button — scoped to the table Actions cell so it can't
   shrink the full-size "Add To Cart" button in the expanded detail. */
.espi-c-act .espi-add {
	width: 34px; height: 34px;
	border: 1px solid var(--espi-line);
	background: #fff; border-radius: 8px; cursor: pointer;
	font-size: 16px; display: inline-flex; align-items: center; justify-content: center;
}
.espi-c-act .espi-add:hover { border-color: var(--espi-blue); background: #f0f6ff; }
.espi-add.is-loading { opacity: .5; pointer-events: none; }

/* ---- Expanded detail ---- */
.espi-detail > td { padding: 0 !important; background: #fff; }
.espi-detail-inner { padding: 24px; background: #f9fbfe; border-bottom: 1px solid var(--espi-line); }
.espi-detail-grid { display: grid; grid-template-columns: 300px 1fr 280px; gap: 26px; align-items: start; }
.espi-detail-media { border: 1px solid var(--espi-line); border-radius: 10px; background: #fff; padding: 14px; text-align: center; }
.espi-detail-img { max-width: 100%; height: auto; }

.espi-detail-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--espi-line); margin-bottom: 14px; }
.espi-dtab { background: none; border: none; padding: 8px 14px; color: var(--espi-muted); cursor: pointer; font-weight: 600; font-size: 13px; border-bottom: 2px solid transparent; }
.espi-dtab.active { color: var(--espi-blue); border-bottom-color: var(--espi-blue); }
.espi-dpanel { display: none; font-size: 14px; color: #374151; }
.espi-dpanel.active { display: block; }
.espi-dpanel pre { white-space: pre; overflow-x: auto; background: #fff; padding: 12px; border: 1px solid var(--espi-line); border-radius: 8px; }

.espi-detail-buy { border: 1px solid var(--espi-line); border-radius: 10px; background: #fff; padding: 20px; }
.espi-detail-name { font-size: 17px; margin: 0 0 8px; font-weight: 700; }
.espi-detail-price { font-size: 22px; font-weight: 800; color: var(--espi-ink); margin-bottom: 6px; }
.espi-detail-sku { color: var(--espi-muted); font-size: 13px; margin-bottom: 16px; }
.espi-detail-sku span { color: var(--espi-ink); }
.espi-qty-row { display: inline-flex; align-items: center; border: 1px solid var(--espi-line); border-radius: 8px; overflow: hidden; margin-bottom: 14px; }
.espi-qty-row button { width: 40px; height: 42px; border: none; background: #f3f6fb; font-size: 18px; cursor: pointer; }
.espi-qty { width: 56px; height: 42px; border: none; text-align: center; font-size: 15px; -moz-appearance: textfield; }
.espi-qty::-webkit-outer-spin-button, .espi-qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
/* Visuals come from the theme (.btn.btn-primary/.btn-dark.btn-rounded.btn-block);
   only flow fixes live here so long labels can wrap inside the buy box. */
.espi-detail-buy .espi-btn-cart {
	height: auto !important;
	min-height: 0;
	white-space: normal;
	line-height: 1.3;
}

/* ---- Pager ---- */
.espi-pager { display: inline-flex; align-items: center; gap: 8px; }
.espi-pager button {
	width: 34px; height: 34px; border: 1px solid var(--espi-line); background: #fff;
	border-radius: 8px; cursor: pointer; font-size: 16px; color: var(--espi-ink);
}
.espi-pager button:disabled { opacity: .4; cursor: default; }
.espi-page-label { font-size: 13px; color: var(--espi-muted); }

/* ---- States ---- */
.espi-empty, .espi-loading { padding: 40px; text-align: center; color: var(--espi-muted); }
.espi-error { color: #b91c1c; }

/* ---- Toast ---- */
.espi-toast {
	position: fixed; right: 22px; bottom: 22px; z-index: 9999;
	background: var(--espi-navy); color: #fff; padding: 14px 18px; border-radius: 10px;
	box-shadow: 0 10px 30px rgba(0,0,0,.2); opacity: 0; transform: translateY(10px); transition: opacity .3s, transform .3s;
	max-width: 320px; font-size: 14px;
}
.espi-toast.show { opacity: 1; transform: translateY(0); }
.espi-toast a { color: #9fd0ff; text-decoration: underline; }

/* ---- Screen-reader-only (a11y) ---- */
.espi-sr-only {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0, 0, 0, 0);
	white-space: nowrap; border: 0;
}

/* ---- Active filter chips ---- */
.espi-active-filters {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin: 0 0 18px;
}
.espi-active-filters-label { font-size: 13px; font-weight: 600; color: var(--espi-muted); margin-right: 2px; }
.espi-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 6px 5px 12px;
	background: var(--espi-card);
	border: 1px solid var(--espi-line);
	border-radius: 999px;
	font-size: 12.5px;
	color: var(--espi-ink);
}
.espi-chip .espi-chip-tax { color: var(--espi-muted); }
.espi-chip-x {
	display: inline-flex; align-items: center; justify-content: center;
	width: 18px; height: 18px; border: 0; border-radius: 50%;
	background: #fff; color: var(--espi-muted); cursor: pointer;
	font-size: 14px; line-height: 1;
}
.espi-chip-x:hover { background: var(--espi-blue); color: #fff; }
.espi-chip-clear {
	border: 0; background: transparent; color: var(--espi-blue);
	font-size: 12.5px; font-weight: 600; cursor: pointer; text-decoration: underline; padding: 5px 4px;
}

/* ---- Responsive ---- */
@media (max-width: 1100px) { #espi-catalog .espi-cats-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 900px) {
	.espi-detail-grid { grid-template-columns: 1fr; }
	.espi-detail-media { max-width: 320px; }
}
@media (max-width: 768px) { #espi-catalog .espi-cats-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 680px) {
	.espi-searchbar { flex-wrap: wrap; }
	.espi-parts-count { order: 3; }
}
@media (max-width: 480px) { #espi-catalog .espi-cats-grid { grid-template-columns: repeat(2, 1fr); } }
