/* ==========================================================================
   NCASS Partner Directory — Frontend Styles
   All colours, sizes, and layout driven by CSS custom properties set inline
   from plugin settings. Scoped entirely to .ncass-partner-directory.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Custom property defaults (overridden by inline style from PHP settings)
   -------------------------------------------------------------------------- */
.ncass-partner-directory {
	--ncass-columns: 3;
	--ncass-accent: #2C7A3F;
	--ncass-cta-colour: #2C7A3F;
	--ncass-logo-bg: #ffffff;
	--ncass-logo-size: 64px;
	--ncass-radius: 8px;
	--ncass-cta-radius: 4px;

	font-family: inherit;
	color: inherit;
	box-sizing: border-box;
}

.ncass-partner-directory *,
.ncass-partner-directory *::before,
.ncass-partner-directory *::after {
	box-sizing: inherit;
}

/* --------------------------------------------------------------------------
   Controls bar
   -------------------------------------------------------------------------- */
.ncass-controls {
	margin-bottom: 28px;
}

/* Search */
.ncass-search-wrap {
	position: relative;
	max-width: 400px;
	margin-bottom: 16px;
}

.ncass-search-input {
	width: 100%;
	padding: 10px 40px 10px 14px;
	font-size: 15px;
	border: 1px solid #d0d0d0;
	border-radius: var(--ncass-radius);
	background: #fff;
	color: inherit;
	outline: none;
	transition: border-color 0.15s;
}

.ncass-search-input:focus {
	border-color: var(--ncass-accent);
	box-shadow: 0 0 0 2px color-mix(in srgb, var(--ncass-accent) 20%, transparent);
}

.ncass-search-icon {
	position: absolute;
	right: 12px;
	top: 50%;
	transform: translateY(-50%);
	pointer-events: none;
	font-size: 16px;
	opacity: 0.4;
}

/* --------------------------------------------------------------------------
   Filter panel card
   -------------------------------------------------------------------------- */
.ncass-filter-panel {
	background: #fff;
	border-radius: 12px;
	border: 1.5px solid #e5e5e5;
	box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
	margin-bottom: 16px;
	overflow: hidden;
}

/* Header bar */
.ncass-filter-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 20px;
	border-bottom: 1px solid #eee;
}

.ncass-filter-header-left {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 1;
	min-width: 0;
}

.ncass-filter-icon {
	stroke: var(--ncass-accent);
	flex-shrink: 0;
}

.ncass-filter-title {
	font-size: 13px;
	font-weight: 600;
	color: #333;
	white-space: nowrap;
}

/* Mobile only: summary text shown when panel is collapsed + filters active */
.ncass-filter-summary {
	display: none;
	font-size: 13px;
	color: #555;
	font-weight: 400;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Mobile only: Active badge shown when panel is collapsed + filters active */
.ncass-filter-active-badge {
	display: none;
	font-size: 11px;
	font-weight: 600;
	padding: 2px 7px;
	border-radius: 20px;
	background: color-mix(in srgb, var(--ncass-accent) 15%, transparent);
	color: var(--ncass-accent);
	flex-shrink: 0;
}

.ncass-filter-header-right {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

/* Clear all button — shown only when .has-filters is on the panel */
.ncass-clear-all {
	display: none;
	align-items: center;
	gap: 5px;
	padding: 5px 10px;
	border-radius: 6px;
	border: 1.5px solid #f0c0c0;
	background: #fff5f5;
	color: #c0392b;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s;
	white-space: nowrap;
}

.ncass-filter-panel.has-filters .ncass-clear-all {
	display: flex;
}

/* Chevron — hidden on desktop, shown on mobile */
.ncass-filter-chevron {
	display: none;
	flex-shrink: 0;
	transition: transform 0.2s;
}

/* Filter body */
.ncass-filter-body {
	padding: 16px 20px 18px;
}

/* Filter groups */
.ncass-filter-group {
	margin-bottom: 0;
}

.ncass-filter-group + .ncass-filter-group {
	border-top: 1px solid #eee;
	padding-top: 14px;
	margin-top: 14px;
}

.ncass-filter-label {
	display: block;
	font-size: 11px;
	font-weight: 700;
	color: #888;
	margin-bottom: 8px;
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

/* Pill buttons */
.ncass-pill-row {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.ncass-pill {
	display: inline-flex;
	align-items: center;
	padding: 5px 12px;
	font-size: 13px;
	font-weight: 500;
	border: 1.5px solid #ddd;
	border-radius: 6px;
	background: #fff;
	color: #444;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
	white-space: nowrap;
}

.ncass-pill:hover {
	border-color: var(--ncass-accent);
	color: var(--ncass-accent);
}

.ncass-pill.active {
	background: var(--ncass-accent);
	border-color: var(--ncass-accent);
	color: #fff;
}

/* Dropdown filter style */
.ncass-filter-select {
	padding: 8px 12px;
	font-size: 14px;
	border: 1px solid #d0d0d0;
	border-radius: var(--ncass-radius);
	background: #fff;
	color: inherit;
	min-width: 200px;
}

/* Controls row (count + sort) */
.ncass-controls-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 10px;
	padding: 6px 2px;
}

.ncass-results-count {
	font-size: 13px;
	color: #666;
}

.ncass-results-count strong {
	color: #111;
}

.ncass-sort-wrap {
	display: flex;
	align-items: center;
	gap: 8px;
}

.ncass-sort-label {
	font-size: 13px;
	color: #555;
	white-space: nowrap;
}

.ncass-sort-select {
	padding: 6px 10px;
	font-size: 13px;
	border: 1px solid #d0d0d0;
	border-radius: var(--ncass-radius);
	background: #fff;
	color: inherit;
}

/* Active filter tags */
.ncass-active-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 10px;
}

.ncass-active-tag {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 4px 10px;
	font-size: 12px;
	background: color-mix(in srgb, var(--ncass-accent) 12%, transparent);
	border: 1px solid color-mix(in srgb, var(--ncass-accent) 30%, transparent);
	color: var(--ncass-accent);
	border-radius: 50px;
}

.ncass-tag-remove {
	background: none;
	border: none;
	padding: 0;
	cursor: pointer;
	font-size: 14px;
	line-height: 1;
	color: inherit;
	opacity: 0.7;
}

.ncass-tag-remove:hover {
	opacity: 1;
}

/* --------------------------------------------------------------------------
   Card grid — equal height via CSS Grid stretch
   -------------------------------------------------------------------------- */
.ncass-grid {
	display: grid;
	grid-template-columns: repeat(var(--ncass-columns), 1fr);
	gap: 24px;
	align-items: stretch; /* equal height rows */
}

/* --------------------------------------------------------------------------
   Card
   -------------------------------------------------------------------------- */
.ncass-card {
	position: relative;
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid #e5e5e5;
	border-radius: var(--ncass-radius);
	overflow: hidden;
	transition: box-shadow 0.18s, transform 0.18s;
}

.ncass-card:hover {
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.10);
	transform: translateY(-2px);
}

.ncass-card--clickable {
	cursor: pointer;
}

.ncass-card--clickable:focus {
	outline: 2px solid var(--ncass-accent);
	outline-offset: 2px;
}

/* Corner badges */
.ncass-badge {
	position: absolute;
	top: 10px;
	right: 10px;
	padding: 3px 9px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	border-radius: 50px;
	z-index: 1;
}

.ncass-badge--featured {
	background: #ff4c4c;
	color: #fff;
}

.ncass-badge--new {
	background: #e8a000;
	color: #fff;
}

/* Logo area — wide rectangular banner, full card width × fixed height */
.ncass-card-logo {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px 28px;
	height: 160px;
	border-bottom: 1px solid #f0f0f0;
	overflow: hidden;
}

.ncass-logo-img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	display: block;
}

.ncass-logo-placeholder {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 52px;
	font-weight: 700;
	color: var(--ncass-accent);
	background: color-mix(in srgb, var(--ncass-accent) 10%, transparent);
	border-radius: 4px;
}

/* Card header */
.ncass-card-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 8px;
	padding: 14px 16px 4px;
}

.ncass-card-name {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
	flex: 1;
}

.ncass-category-badge {
	display: inline-block;
	padding: 2px 8px;
	font-size: 11px;
	font-weight: 600;
	background: color-mix(in srgb, var(--ncass-accent) 12%, transparent);
	color: var(--ncass-accent);
	border-radius: 50px;
	white-space: nowrap;
	flex-shrink: 0;
}

/* Description — clamped to 3 lines for card consistency */
.ncass-card-description {
	margin: 0;
	padding: 8px 16px 12px;
	font-size: 14px;
	line-height: 1.55;
	color: #555;

	/* Preferred: ellipsis clamp */
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;

	/* !important prevents Flatsome overriding overflow on <p> elements */
	overflow: hidden !important;

	/* Hard ceiling: +20px accounts for 8px top + 12px bottom padding with border-box */
	max-height: calc(3 * 1.55em + 20px);
}

/* Deal highlight box */
.ncass-deal-box {
	margin: 0 16px 12px;
	padding: 10px 14px;
	background: color-mix(in srgb, var(--ncass-accent) 8%, transparent);
	border-left: 3px solid var(--ncass-accent);
	border-radius: 4px;
}

.ncass-deal-label {
	display: block;
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.07em;
	color: var(--ncass-accent);
	margin-bottom: 4px;
}

/* Deal text — clamped to 2 lines */
.ncass-deal-text {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.4;
	color: #222;

	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* Locked deal box */
.ncass-deal-box--locked {
	text-align: center;
	border-left-color: #bbb;
	background: #f7f7f7;
}

.ncass-lock-icon {
	display: block;
	font-size: 20px;
	margin-bottom: 4px;
}

.ncass-locked-message {
	margin: 0;
	font-size: 13px;
	color: #888;
}

/* Value statement */
.ncass-value-statement {
	margin: 0 16px 12px;
	font-size: 13px;
	font-weight: 600;
	color: #ff4c4c;
}

/* Tier badge */
.ncass-tier-badge {
	display: inline-block;
	margin: 0 16px 10px;
	padding: 3px 10px;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #fff;
	border-radius: 50px;
	align-self: flex-start;
}

/* CTA button — pushed to bottom of card via flex grow on description area */
.ncass-cta-button {
	display: block;
	margin: auto 16px 16px;
	padding: 11px 18px;
	background: var(--ncass-cta-colour);
	color: #fff !important;
	text-align: center;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none !important;
	border-radius: var(--ncass-cta-radius);
	transition: opacity 0.15s, transform 0.1s;
	border: none;
}

.ncass-cta-button:hover {
	opacity: 0.88;
}

/* CTA sticks to bottom via margin-top: auto (set in .ncass-cta-button above).
   Deal box sits naturally in flow directly below the description. */

/* --------------------------------------------------------------------------
   Empty state
   -------------------------------------------------------------------------- */
.ncass-empty-state {
	text-align: center;
	padding: 48px 24px;
	color: #888;
	font-size: 15px;
}

/* --------------------------------------------------------------------------
   Card style variants
   -------------------------------------------------------------------------- */

/* Compact */
.ncass-style-compact .ncass-card-logo {
	height: 110px;
	padding: 12px 20px;
}

.ncass-style-compact .ncass-card-description {
	-webkit-line-clamp: 2;
	padding-bottom: 8px;
}

.ncass-style-compact .ncass-deal-box {
	padding: 7px 10px;
}

/* Horizontal list */
.ncass-style-horizontal .ncass-grid {
	grid-template-columns: 1fr;
}

.ncass-style-horizontal .ncass-card {
	flex-direction: row;
	align-items: stretch;
}

.ncass-style-horizontal .ncass-card-logo {
	width: 200px;
	min-width: 200px;
	height: auto;
	flex-shrink: 0;
	border-bottom: none;
	border-right: 1px solid #f0f0f0;
}

.ncass-style-horizontal .ncass-card-header {
	padding-top: 16px;
}

.ncass-style-horizontal .ncass-cta-button {
	margin: 0 16px 16px;
	width: 160px;
	align-self: flex-end;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------
   Mobile filter panel — collapsible below 768px
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {

	/* Header becomes a tap target */
	.ncass-filter-header {
		cursor: pointer;
		user-select: none;
		border-bottom: none; /* hidden when body is collapsed */
	}

	.ncass-filter-header:hover {
		background: #fafafa;
	}

	/* Restore border when panel is open */
	.ncass-filter-panel.ncass-filter-open .ncass-filter-header {
		border-bottom: 1px solid #eee;
	}

	/* Collapse filter body by default */
	.ncass-filter-body {
		display: none;
		padding: 14px 16px 16px;
	}

	.ncass-filter-panel.ncass-filter-open .ncass-filter-body {
		display: block;
	}

	/* Show chevron on mobile */
	.ncass-filter-chevron {
		display: block;
	}

	.ncass-filter-panel.ncass-filter-open .ncass-filter-chevron {
		transform: rotate(180deg);
	}

	/* When collapsed + filters active: hide title, show summary + badge */
	.ncass-filter-panel.has-filters:not(.ncass-filter-open) .ncass-filter-title {
		display: none;
	}

	.ncass-filter-panel.has-filters:not(.ncass-filter-open) .ncass-filter-summary {
		display: block;
	}

	.ncass-filter-panel.has-filters:not(.ncass-filter-open) .ncass-filter-active-badge {
		display: inline-flex;
	}

	/* Slightly smaller clear button in compact header */
	.ncass-filter-panel.has-filters:not(.ncass-filter-open) .ncass-clear-all {
		font-size: 11px;
		padding: 4px 9px;
	}
}

/* ==========================================================================
   Partnership Slider
   ========================================================================== */

/* Wrapper — mirrors .ncass-partner-directory for CSS var inheritance */
.ncass-partner-slider {
	--ncass-accent:     #2C7A3F;
	--ncass-cta-colour: #2C7A3F;
	--ncass-logo-bg:    #ffffff;
	--ncass-radius:     8px;
	--ncass-cta-radius: 4px;

	font-family: inherit;
	color: inherit;
	box-sizing: border-box;
	margin: 36px 0;
}

.ncass-partner-slider *,
.ncass-partner-slider *::before,
.ncass-partner-slider *::after {
	box-sizing: inherit;
}

/* --------------------------------------------------------------------------
   Slider header: title + subtitle, centred above the body row
   -------------------------------------------------------------------------- */
.ncass-slider-header {
	text-align: center;
	margin-bottom: 24px;
}

.ncass-slider-title {
	margin: 0 0 8px;
	font-size: 28px;
	font-weight: 700;
	line-height: 1.2;
	color: var(--ncass-accent);
}

.ncass-slider-subtitle {
	margin: 0;
	font-size: 15px;
	color: #666;
	line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Body row: [prev btn] [scrollable track] [next btn]
   -------------------------------------------------------------------------- */
.ncass-slider-body {
	display: flex;
	align-items: center;
	gap: 12px;
}

/* --------------------------------------------------------------------------
   Nav arrow buttons
   -------------------------------------------------------------------------- */
.ncass-slider-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border: 1.5px solid #ddd;
	border-radius: 50%;
	background: #fff;
	color: #555;
	cursor: pointer;
	transition: border-color 0.15s, background 0.15s, color 0.15s;
	flex-shrink: 0;
	padding: 0;
}

.ncass-slider-btn:hover {
	border-color: var(--ncass-accent);
	background: var(--ncass-accent);
	color: #fff;
}

.ncass-slider-btn:disabled {
	opacity: 0.35;
	cursor: default;
	pointer-events: none;
}

/* --------------------------------------------------------------------------
   Scrollable track
   -------------------------------------------------------------------------- */
.ncass-slider-track {
	flex: 1;
	min-width: 0;
	display: flex;
	gap: 20px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	padding-bottom: 6px; /* room for box-shadow on cards */

	/* Hide scrollbar (functional, not visible) */
	scrollbar-width: none;       /* Firefox */
	-ms-overflow-style: none;    /* IE/Edge */
}

.ncass-slider-track::-webkit-scrollbar {
	display: none; /* Chrome/Safari */
}

/* Cards in track: 3 per row (desktop) — no snap, JS controls scrolling */
.ncass-slider-track .ncass-card {
	flex: 0 0 calc((100% - 40px) / 3);
	min-width: 220px;
}

/* --------------------------------------------------------------------------
   Footer CTA
   -------------------------------------------------------------------------- */
.ncass-slider-footer {
	margin-top: 24px;
	text-align: center;
}

.ncass-slider-cta-link {
	display: inline-block;
	padding: 13px 36px;
	background: transparent;
	border: 2px solid var(--ncass-accent);
	color: var(--ncass-accent) !important;
	font-size: 15px;
	font-weight: 600;
	border-radius: var(--ncass-cta-radius);
	text-decoration: none !important;
	transition: background 0.15s, color 0.15s;
}

.ncass-slider-cta-link:hover {
	background: var(--ncass-accent);
	color: #fff !important;
}

/* --------------------------------------------------------------------------
   Responsive slider
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
	.ncass-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.ncass-style-horizontal .ncass-card {
		flex-direction: column;
	}

	.ncass-style-horizontal .ncass-card-logo {
		width: 100%;
		min-width: 0;
		border-right: none;
		border-bottom: 1px solid #f0f0f0;
	}
}

@media (max-width: 560px) {
	.ncass-grid {
		grid-template-columns: 1fr;
	}

	.ncass-controls-row {
		flex-direction: column;
		align-items: flex-start;
	}

	.ncass-slider-title {
		font-size: 22px;
	}

	/* On mobile: arrows move above the track, right-aligned.
	   flex-wrap lets prev+next float as a top row; track fills the row below. */
	.ncass-slider-body {
		flex-wrap: wrap;
		gap: 8px;
	}

	.ncass-slider-prev {
		order: 1;
		margin-left: auto; /* pushes both buttons to the right */
	}

	.ncass-slider-next {
		order: 2;
	}

	.ncass-slider-track {
		order: 3;
		flex-basis: 100%; /* full width — no arrows competing for space */
	}

	/* Slider: ~1 card + small peek at the next */
	.ncass-slider-track .ncass-card {
		flex: 0 0 88%;
		min-width: 0;
	}

	/* Slightly smaller arrows on mobile */
	.ncass-slider-btn {
		width: 36px;
		height: 36px;
	}
}
