/**
 * Blog Category & Topic Hub Stylesheet (Server-side rendering)
 * Area: blog-hub
 *
 * Fixes desktop tag overflow bug and provides smooth horizontal scrolling on mobile phones (<= 689px).
 * Uses strictly Blocksy theme custom properties.
 */

/* ==========================================================================
   1. Base Hub Layout & Styling
   ========================================================================== */

.ekrd-tax-hub {
	background-color: var(--theme-palette-color-8);
	border: 1px solid var(--theme-border-color);
	border-radius: 12px;
	padding: 18px 22px;
	margin-bottom: 26px;
	box-shadow: var(--theme-box-shadow, 0px 12px 18px -6px rgba(34, 56, 101, 0.04));
	display: flex;
	flex-direction: column;
	gap: 14px;
	direction: rtl;
	box-sizing: border-box;
}

.ekrd-tax-hub .ekrd-tax-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.ekrd-tax-hub .ekrd-pills-wrap {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

.ekrd-tax-hub .ekrd-row-label {
	font-size: 12.5px;
	line-height: 1.4;
	font-weight: 700;
	color: var(--theme-headings-color);
	margin-left: 4px;
	flex-shrink: 0;
}

.ekrd-tax-hub .ekrd-cat-pill {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 14px;
	border-radius: var(--theme-button-border-radius, 3px);
	background-color: var(--theme-palette-color-7);
	border: 1px solid var(--theme-border-color);
	color: var(--theme-headings-color) !important;
	font-family: var(--theme-font-family);
	font-size: 13.5px;
	line-height: 1.4;
	font-weight: 600;
	text-decoration: none !important;
	transition: all 0.15s ease;
	white-space: nowrap;
}

.ekrd-tax-hub .ekrd-cat-pill:hover {
	border-color: var(--theme-palette-color-1);
	background-color: var(--theme-palette-color-6);
}

.ekrd-tax-hub .ekrd-cat-pill.is-active {
	background-color: var(--theme-button-background-initial-color, var(--theme-palette-color-1));
	border-color: var(--theme-button-background-initial-color, var(--theme-palette-color-1));
	color: var(--theme-button-text-initial-color, #ffffff) !important;
}

.ekrd-tax-hub .ekrd-tag-chip {
	display: inline-flex;
	align-items: center;
	padding: 4px 11px;
	border-radius: var(--theme-button-border-radius, 3px);
	background-color: var(--theme-palette-color-6);
	border: 1px solid transparent;
	color: var(--theme-text-color) !important;
	font-family: var(--theme-font-family);
	font-size: 12.5px;
	line-height: 1.4;
	font-weight: 500;
	text-decoration: none !important;
	transition: all 0.15s ease;
	white-space: nowrap;
}

.ekrd-tax-hub .ekrd-tag-chip:hover {
	border-color: var(--theme-palette-color-1);
	color: var(--theme-link-initial-color) !important;
}

.ekrd-tax-hub .ekrd-tag-chip.is-active {
	background-color: var(--theme-palette-color-8);
	border-color: var(--theme-palette-color-1);
	color: var(--theme-link-initial-color) !important;
	font-weight: 700;
}

.ekrd-tax-hub .ekrd-inline-search {
	display: flex;
	align-items: center;
	gap: 6px;
}

.ekrd-tax-hub .ekrd-inline-search input[type="search"] {
	min-width: 220px;
	height: 38px;
	padding: 6px 12px;
	border: 1px solid var(--theme-form-field-border-initial-color, var(--theme-border-color));
	border-radius: var(--theme-form-border-radius, 3px);
	background-color: var(--theme-palette-color-7);
	font-family: var(--theme-form-font-family, var(--theme-font-family));
	font-size: 13px;
	color: var(--theme-form-text-initial-color, var(--theme-headings-color));
}

.ekrd-tax-hub .ekrd-inline-search input[type="search"]:focus {
	outline: none;
	border-color: var(--theme-form-field-border-focus-color, var(--theme-palette-color-1));
	background-color: var(--theme-palette-color-8);
}

.ekrd-tax-hub .ekrd-inline-search button.ct-button {
	min-height: 38px;
	height: 38px;
	padding: 0 16px;
	font-size: 13.5px;
}

/* ==========================================================================
   2. Desktop Tag Row Overflow Fix (flex-wrap: wrap)
   ========================================================================== */

.ekrd-tax-hub .ekrd-tax-row--tags {
	display: flex !important;
	flex-direction: row !important;
	flex-wrap: wrap !important;
	white-space: normal !important;
	grid-template-columns: none !important;
	justify-content: flex-start !important;
	align-items: center !important;
	gap: 7px !important;
	padding-top: 12px !important;
	border-top: 1px solid var(--theme-border-color) !important;
}

.ekrd-tax-hub .ekrd-tax-row--tags .ekrd-row-label {
	grid-column: auto !important;
}

.ekrd-tax-hub .ekrd-tax-row--tags .ekrd-tag-chip {
	white-space: nowrap !important;
	flex-shrink: 0 !important;
}

/* ==========================================================================
   3. Mobile Phones (<= 689px): Single Horizontally Scrolling Line per Row
   ========================================================================== */

@media (max-width: 689px) {
	.ekrd-tax-hub {
		padding: 14px 14px;
		gap: 12px;
	}

	/* Row 1 layout on phone: category row scrolls horizontally, search is full width below */
	.ekrd-tax-hub .ekrd-tax-row {
		display: flex !important;
		flex-direction: column !important;
		align-items: stretch !important;
		gap: 12px !important;
	}

	/* Row 1 category pills: single horizontally scrolling line */
	.ekrd-tax-hub .ekrd-pills-wrap {
		display: flex !important;
		flex-direction: row !important;
		flex-wrap: nowrap !important;
		overflow-x: auto !important;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
		max-width: 100%;
		padding-bottom: 2px;
		align-items: center;
		gap: 8px;
	}

	.ekrd-tax-hub .ekrd-pills-wrap::-webkit-scrollbar {
		display: none;
	}

	.ekrd-tax-hub .ekrd-pills-wrap .ekrd-row-label,
	.ekrd-tax-hub .ekrd-pills-wrap .ekrd-cat-pill {
		flex-shrink: 0 !important;
		white-space: nowrap !important;
	}

	/* Search form full width on phone */
	.ekrd-tax-hub .ekrd-inline-search {
		width: 100% !important;
		max-width: 100% !important;
		display: flex !important;
	}

	.ekrd-tax-hub .ekrd-inline-search input[type="search"] {
		min-width: 0 !important;
		flex: 1 1 auto !important;
	}

	.ekrd-tax-hub .ekrd-inline-search button.ct-button {
		flex-shrink: 0 !important;
	}

	/* Row 2 topics/tags: single horizontally scrolling line */
	.ekrd-tax-hub .ekrd-tax-row--tags {
		display: flex !important;
		flex-direction: row !important;
		flex-wrap: nowrap !important;
		overflow-x: auto !important;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
		max-width: 100%;
		padding-top: 12px !important;
		padding-bottom: 2px !important;
		white-space: nowrap !important;
		grid-template-columns: none !important;
		align-items: center !important;
		gap: 7px !important;
	}

	.ekrd-tax-hub .ekrd-tax-row--tags::-webkit-scrollbar {
		display: none;
	}

	.ekrd-tax-hub .ekrd-tax-row--tags .ekrd-row-label,
	.ekrd-tax-hub .ekrd-tax-row--tags .ekrd-tag-chip {
		flex-shrink: 0 !important;
		white-space: nowrap !important;
		display: inline-flex !important;
	}
}
