/**
 * RAFZ Avropa – frontend styles
 */

/* ═══════════════════════════════════════════════
 * Full-width layout — hide sidebar on /offentlig-miljo
 * Uses both body.page-avropa (local) and the
 * presence of .rafz-avropa-shipping-notice as
 * a parent anchor (works on any page with the shortcode).
 * ═══════════════════════════════════════════════ */

/* Hide sidebar — target Woodmart's sidebar classes */
body.page-avropa .sidebar-container,
body.page-avropa aside.wd-sidebar,
body.page-avropa aside.widget-area {
	display: none !important;
}

/* Full-width content area */
body.page-avropa .site-content .content-area,
body.page-avropa .main-page-wrapper .content-area,
body.page-avropa .content-area,
body.page-avropa .wd-content-layout .wd-grid-col {
	width: 100% !important;
	float: none !important;
	max-width: 100% !important;
	flex: 0 0 100% !important;
}

body.page-avropa .main-page-wrapper {
	display: block !important;
}

/*
 * Fallback: if body class isn't applied, use the shortcode's
 * own wrapper to walk up and hide the sibling sidebar.
 * This targets the Woodmart layout structure directly.
 */
.rafz-avropa-shipping-notice ~ .wd-sidebar,
.rafz-avropa-shipping-notice ~ .sidebar-container,
.rafz-filter-panel ~ .wd-sidebar,
.rafz-filter-panel ~ .sidebar-container {
	display: none !important;
}

/* Also hide via Woodmart's own page layout classes when sidebar is present */
.wd-content-layout:has(.rafz-avropa-shipping-notice) > aside.wd-sidebar,
.wd-content-layout:has(.rafz-avropa-shipping-notice) > .sidebar-container,
.content-layout-wrapper:has(.rafz-avropa-shipping-notice) > aside.wd-sidebar {
	display: none !important;
}

.wd-content-layout:has(.rafz-avropa-shipping-notice) > .wd-grid-col:not(aside) {
	width: 100% !important;
	max-width: 100% !important;
	flex: 0 0 100% !important;
}

/* ═══════════════════════════════════════════════
 * Hide the site-wide campaign banner on /offentlig-miljo
 * (Woodmart top bar with "fri frakt vid köp över 5000kr")
 * ═══════════════════════════════════════════════ */
body.page-avropa .whb-top-bar {
	display: none !important;
}

/* Fallback: detect avropa page by shortcode content (works without body class) */
body:has(.rafz-avropa-shipping-notice) .whb-top-bar {
	display: none !important;
}

/* ═══════════════════════════════════════════════
 * Filter panel (collapsible <details>)
 * ═══════════════════════════════════════════════ */
.rafz-filter-panel {
	margin-bottom: 24px;
	border: 1px solid #e5e5e5;
	border-radius: 8px;
	background: #fafafa;
}

.rafz-filter-toggle {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 20px;
	cursor: pointer;
	font-size: 0.95em;
	font-weight: 600;
	color: #333;
	user-select: none;
	list-style: none; /* hide default marker */
}

.rafz-filter-toggle::-webkit-details-marker {
	display: none;
}

.rafz-filter-toggle-icon {
	font-size: 0.7em;
	transition: transform 0.2s ease;
	display: inline-block;
}

details.rafz-filter-panel[open] .rafz-filter-toggle-icon {
	transform: rotate(180deg);
}

.rafz-filter-active-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 20px;
	padding: 0 6px;
	border-radius: 10px;
	background: #222;
	color: #fff;
	font-size: 0.75em;
	font-weight: 700;
	line-height: 1;
}

.rafz-filter-content {
	padding: 0 20px 16px;
}

.rafz-filter-section {
	margin-bottom: 16px;
}

.rafz-filter-section:last-child {
	margin-bottom: 0;
}

.rafz-filter-heading {
	margin: 0 0 10px;
	font-size: 0.8em;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #888;
}

.rafz-filter-clear {
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px solid #e5e5e5;
}

.rafz-filter-clear-link {
	font-size: 0.85em;
	color: #888;
	text-decoration: none;
}

.rafz-filter-clear-link:hover {
	color: #c00;
	text-decoration: none;
}

/* ═══════════════════════════════════════════════
 * Filter pills (shared by category + price)
 * ═══════════════════════════════════════════════ */
.rafz-avropa-filter-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}

.rafz-pill {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 14px;
	border: 1px solid #ddd;
	border-radius: 50px;
	background: #fff;
	color: #444;
	font-size: 0.82em;
	font-weight: 500;
	text-decoration: none;
	transition: all 0.15s ease;
	white-space: nowrap;
	line-height: 1.3;
}

.rafz-pill:hover {
	border-color: #999;
	color: #111;
	background: #f0f0f0;
	text-decoration: none;
}

.rafz-pill.active {
	background: #222;
	color: #fff;
	border-color: #222;
}

.rafz-pill.active:hover {
	background: #444;
	border-color: #444;
	color: #fff;
}

.rafz-pill-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 18px;
	height: 18px;
	padding: 0 4px;
	border-radius: 9px;
	background: rgba(0, 0, 0, 0.08);
	font-size: 0.8em;
	font-weight: 600;
	line-height: 1;
}

.rafz-pill.active .rafz-pill-count {
	background: rgba(255, 255, 255, 0.2);
}

/* Responsive */
@media (max-width: 768px) {
	.rafz-filter-content {
		padding: 0 12px 12px;
	}

	.rafz-avropa-filter-pills {
		flex-wrap: nowrap;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		padding-bottom: 4px;
		scrollbar-width: thin;
	}

	.rafz-pill {
		flex-shrink: 0;
	}
}

/* ═══════════════════════════════════════════════
 * Toolbar (result count)
 * ═══════════════════════════════════════════════ */
.rafz-avropa-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 20px;
	padding-bottom: 12px;
	border-bottom: 1px solid #eee;
}

.rafz-avropa-result-count {
	margin: 0;
	font-size: 0.9em;
	color: #666;
}

/* ═══════════════════════════════════════════════
 * "Ditt avtalspris" badge
 * ═══════════════════════════════════════════════ */
.rafz-avropa-badge {
	display: inline-block;
	background: #1d6e3f;
	color: #fff;
	font-size: 0.7em;
	font-weight: 600;
	line-height: 1;
	padding: 3px 8px;
	border-radius: 3px;
	margin-left: 6px;
	vertical-align: middle;
	white-space: nowrap;
	letter-spacing: 0.02em;
}

/* ═══════════════════════════════════════════════
 * Customer info block
 * ═══════════════════════════════════════════════ */
.rafz-avropa-customer-info {
	background: #f0f7f4;
	border-left: 4px solid #1d6e3f;
	padding: 12px 16px;
	margin-bottom: 20px;
	border-radius: 2px;
}

.rafz-avropa-customer-info p {
	margin: 0;
	font-size: 0.95em;
}

.rafz-avropa-customer-number strong {
	font-family: monospace;
	font-size: 1.05em;
}

/* ═══════════════════════════════════════════════
 * Shipping notice
 * ═══════════════════════════════════════════════ */
.rafz-avropa-shipping-notice {
	background: #fef9e7;
	border-left: 4px solid #f0c14b;
	padding: 10px 16px;
	margin-bottom: 24px;
	border-radius: 2px;
}

.rafz-avropa-shipping-notice p {
	margin: 0;
	font-size: 0.9em;
	color: #5a4e2f;
}

/* ═══════════════════════════════════════════════
 * Pagination
 * ═══════════════════════════════════════════════ */
.woocommerce-pagination ul {
	display: flex;
	justify-content: center;
	gap: 4px;
	list-style: none;
	padding: 0;
	margin: 32px 0 16px;
}

.woocommerce-pagination ul li a,
.woocommerce-pagination ul li span {
	display: inline-block;
	padding: 6px 12px;
	border: 1px solid #ddd;
	border-radius: 3px;
	text-decoration: none;
	color: #333;
	font-size: 0.9em;
}

.woocommerce-pagination ul li span.current {
	background: #333;
	color: #fff;
	border-color: #333;
}

.woocommerce-pagination ul li a:hover {
	background: #f5f5f5;
}
