/**
 * GWD Smart Disc Recommendations — Frontend Stylesheet
 *
 * Uses Golf With Discs native `--df-*` design tokens and warm editorial hierarchy
 * across desktop, tablet, and mobile viewports in both light and dark modes.
 */

#gwd-recommended-for-you.gwd-smart-recommendations {
	--gwd-sr-bg: var(--df-card, #ffffff);
	--gwd-sr-surface: var(--df-inner, #f4f1ea);
	--gwd-sr-surface-elevated: var(--df-bg, #fdf9f4);
	--gwd-sr-text: var(--df-ink, #111111);
	--gwd-sr-text-secondary: var(--df-ink-2, #222222);
	--gwd-sr-muted: var(--df-muted, #4f4f4f);
	--gwd-sr-accent: var(--df-maroon, #7c0236);
	--gwd-sr-accent-strong: var(--df-maroon-strong, #62012b);
	--gwd-sr-accent-soft: var(--df-maroon-soft, rgba(124, 2, 54, 0.08));
	--gwd-sr-teal: #0b6e69;
	--gwd-sr-teal-soft: rgba(11, 110, 105, 0.1);
	--gwd-sr-sponsor-bg: #fef3c7;
	--gwd-sr-sponsor-text: #78350f;
	--gwd-sr-promo-bg: rgba(11, 110, 105, 0.1);
	--gwd-sr-promo-text: #0b534f;
	margin-top: 2.25rem;
	margin-bottom: 2.25rem;
	padding-top: 0.25rem;
	box-sizing: border-box;
	max-width: 100%;
}

html[data-theme="dark"] #gwd-recommended-for-you.gwd-smart-recommendations,
html[data-color-mode="dark"] #gwd-recommended-for-you.gwd-smart-recommendations {
	--gwd-sr-bg: var(--df-card, #1e1e1e);
	--gwd-sr-surface: var(--df-inner, #262626);
	--gwd-sr-surface-elevated: var(--df-bg, #161616);
	--gwd-sr-text: var(--df-ink, #f2efe9);
	--gwd-sr-text-secondary: var(--df-ink-2, #e0dcd3);
	--gwd-sr-muted: var(--df-muted, #b5b0a6);
	--gwd-sr-accent: #e05388;
	--gwd-sr-accent-strong: #f06292;
	--gwd-sr-accent-soft: rgba(224, 83, 136, 0.16);
	--gwd-sr-teal: #4db6ac;
	--gwd-sr-teal-soft: rgba(77, 182, 172, 0.16);
	--gwd-sr-sponsor-bg: rgba(245, 158, 11, 0.2);
	--gwd-sr-sponsor-text: #fde68a;
	--gwd-sr-promo-bg: rgba(77, 182, 172, 0.16);
	--gwd-sr-promo-text: #b2dfdb;
}

/* Section Header & Profile Status */
.gwd-sr-header {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 0.85rem 1.5rem;
	margin-bottom: 1.15rem;
}

.gwd-sr-header__titles {
	flex: 1 1 320px;
	min-width: 0;
}

#gwd-recommended-for-you .gwd-sr-title {
	margin: 0 0 0.25rem 0;
	font-size: clamp(1.35rem, 2vw, 1.65rem);
	font-weight: 800;
	letter-spacing: -0.015em;
	line-height: 1.2;
	color: var(--gwd-sr-text);
}

.gwd-sr-subtitle {
	margin: 0;
	font-size: 0.92rem;
	line-height: 1.45;
	color: var(--gwd-sr-muted);
	max-width: 65ch;
}

.gwd-sr-header__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.6rem;
}

.gwd-sr-status-pill {
	display: inline-flex;
	align-items: center;
	padding: 0.36rem 0.7rem;
	border-radius: 6px;
	font-size: 0.78rem;
	font-weight: 600;
	background: var(--gwd-sr-surface);
	color: var(--gwd-sr-muted);
}

.gwd-sr-status-pill.is-personalized {
	background: var(--gwd-sr-teal-soft);
	color: var(--gwd-sr-teal);
}

.gwd-sr-profile-toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	min-height: 40px;
	padding: 0.42rem 0.85rem;
	cursor: pointer;
	font-weight: 700;
}

.gwd-sr-btn-icon {
	width: 15px;
	height: 15px;
	flex-shrink: 0;
}

/* DiscFinder Context Bar */
.gwd-sr-context-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.4rem 0.75rem;
	padding: 0.6rem 0.9rem;
	margin-bottom: 1rem;
	border-radius: 8px;
	background: var(--gwd-sr-surface);
	font-size: 0.86rem;
	color: var(--gwd-sr-text);
}

.gwd-sr-context-bar__label {
	color: var(--gwd-sr-muted);
}

.gwd-sr-context-bar__hint {
	color: var(--gwd-sr-muted);
	font-size: 0.8rem;
	margin-left: auto;
}

/* Stale 30-day Rating Banner */
.gwd-sr-stale-banner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.7rem 0.95rem;
	margin-bottom: 1rem;
	border-radius: 8px;
	background: var(--gwd-sr-sponsor-bg);
	color: var(--gwd-sr-sponsor-text);
	font-size: 0.86rem;
}

.gwd-sr-stale-banner[hidden] {
	display: none !important;
}

/* Profile Preferences Drawer */
.gwd-sr-profile-drawer {
	padding: 1.15rem;
	margin-bottom: 1.25rem;
	border-radius: 10px;
	background: var(--gwd-sr-surface);
}

.gwd-sr-profile-drawer[hidden] {
	display: none !important;
}

.gwd-sr-profile-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
	gap: 0.9rem;
	margin-bottom: 0.9rem;
}

.gwd-sr-field {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	min-width: 0;
}

.gwd-sr-label {
	font-size: 0.8rem;
	font-weight: 700;
	color: var(--gwd-sr-text);
}

.gwd-sr-inline-input {
	display: flex;
	gap: 0.45rem;
	align-items: stretch;
}

.gwd-sr-input,
.gwd-sr-select {
	min-height: 42px;
	width: 100%;
	padding: 0.42rem 0.65rem;
	border-radius: 6px;
	border: none;
	background: var(--gwd-sr-bg);
	color: var(--gwd-sr-text);
	font-size: 0.9rem;
	box-sizing: border-box;
}

.gwd-sr-input:focus-visible,
.gwd-sr-select:focus-visible {
	outline: 2px solid var(--gwd-sr-accent);
	outline-offset: 1px;
}

.gwd-sr-lookup-btn {
	min-height: 42px;
	white-space: nowrap;
	flex-shrink: 0;
}

.gwd-sr-consent-row {
	display: flex;
	flex-direction: column;
	gap: 0.45rem;
	margin: 0.75rem 0;
	padding-top: 0.5rem;
}

.gwd-sr-checkbox-label {
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
	font-size: 0.86rem;
	color: var(--gwd-sr-text);
	cursor: pointer;
	min-height: 30px;
}

.gwd-sr-checkbox-label input[type="checkbox"] {
	width: 17px;
	height: 17px;
	accent-color: var(--gwd-sr-accent);
	flex-shrink: 0;
}

.gwd-sr-privacy-note,
.gwd-sr-pdga-attribution {
	margin: 0.2rem 0;
	font-size: 0.76rem;
	line-height: 1.45;
	color: var(--gwd-sr-muted);
}

.gwd-sr-form-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.6rem;
	margin-top: 0.8rem;
}

.gwd-sr-form-actions .btn {
	min-height: 42px;
}

.gwd-sr-feedback {
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--gwd-sr-teal);
}

/* Strategy Navigation Rail & Active Module Summary */
.gwd-sr-strategy-shell {
	margin-bottom: 1.1rem;
}

.gwd-sr-strategy-rail {
	position: relative;
	display: flex;
	align-items: center;
	gap: 0.35rem;
	margin-bottom: 0.65rem;
}

.gwd-sr-rail-nav {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 32px;
	height: 36px;
	padding: 0;
	border: none;
	border-radius: 6px;
	background: var(--gwd-sr-surface);
	color: var(--gwd-sr-text);
	font-size: 1.15rem;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	user-select: none;
	-webkit-user-select: none;
	touch-action: manipulation;
	transition: transform 140ms cubic-bezier(0.23, 1, 0.32, 1), background-color 140ms ease, opacity 140ms ease;
}

.gwd-sr-rail-nav:disabled {
	opacity: 0.32;
	cursor: default;
}

.gwd-sr-rail-nav:not(:disabled):active {
	transform: scale(0.95);
}

.gwd-sr-strategy-tabs {
	display: flex;
	flex: 1 1 auto;
	flex-wrap: nowrap;
	align-items: center;
	gap: 0.45rem;
	min-width: 0;
	overflow-x: auto;
	scroll-snap-type: x proximity;
	scroll-behavior: smooth;
	overscroll-behavior-x: contain;
	touch-action: pan-x pan-y;
	padding: 0.1rem 0.25rem 0.2rem 0.1rem;
	scrollbar-width: none;
	-ms-overflow-style: none;
	-webkit-overflow-scrolling: touch;
}

.gwd-sr-strategy-tabs::-webkit-scrollbar {
	display: none;
}

.gwd-sr-strategy-tab {
	display: inline-flex;
	align-items: center;
	flex-shrink: 0;
	scroll-snap-align: start;
	min-height: 36px;
	padding: 0.38rem 0.82rem;
	border-radius: 6px;
	border: none;
	background: var(--gwd-sr-surface);
	color: var(--gwd-sr-text-secondary);
	font-size: 0.82rem;
	font-weight: 700;
	line-height: 1.2;
	white-space: nowrap;
	cursor: pointer;
	user-select: none;
	-webkit-user-select: none;
	touch-action: manipulation;
	transition: transform 140ms cubic-bezier(0.23, 1, 0.32, 1), background-color 140ms ease, color 140ms ease;
}

.gwd-sr-strategy-tab:active {
	transform: scale(0.97);
}

@media (hover: hover) and (pointer: fine) {
	.gwd-sr-strategy-tab:hover {
		background: var(--gwd-sr-accent-soft);
		color: var(--gwd-sr-accent);
	}

	.gwd-sr-rail-nav:not(:disabled):hover,
	.gwd-sr-carousel-btn:not(:disabled):hover,
	.gwd-sr-layout-btn:hover {
		background: var(--gwd-sr-accent-soft);
		color: var(--gwd-sr-accent);
	}
}

.gwd-sr-strategy-tab:focus-visible,
.gwd-sr-rail-nav:focus-visible,
.gwd-sr-carousel-btn:focus-visible,
.gwd-sr-layout-btn:focus-visible {
	outline: 2px solid var(--gwd-sr-accent);
	outline-offset: 2px;
}

.gwd-sr-strategy-tab.is-active {
	background: var(--gwd-sr-accent);
	color: #ffffff;
}

html[data-theme="dark"] #gwd-recommended-for-you .gwd-sr-strategy-tab.is-active,
html[data-color-mode="dark"] #gwd-recommended-for-you .gwd-sr-strategy-tab.is-active {
	color: #141414;
}

.gwd-sr-strategy-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.6rem 1rem;
	padding: 0.15rem 0;
}

.gwd-sr-strategy-header__titles {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.3rem 0.75rem;
	flex: 1 1 280px;
	min-width: 0;
}

.gwd-sr-strategy-header__controls {
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
	flex-shrink: 0;
}

.gwd-sr-layout-toggle {
	display: inline-flex;
	align-items: center;
	padding: 2px;
	border-radius: 7px;
	background: var(--gwd-sr-surface);
	gap: 2px;
}

.gwd-sr-layout-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 30px;
	padding: 0.25rem 0.62rem;
	border: none;
	border-radius: 5px;
	background: transparent;
	color: var(--gwd-sr-muted);
	font-size: 0.76rem;
	font-weight: 700;
	line-height: 1.1;
	cursor: pointer;
	user-select: none;
	-webkit-user-select: none;
	touch-action: manipulation;
	transition: transform 140ms cubic-bezier(0.23, 1, 0.32, 1), background-color 140ms ease, color 140ms ease;
}

.gwd-sr-layout-btn:active {
	transform: scale(0.97);
}

.gwd-sr-layout-btn.is-active {
	background: var(--gwd-sr-bg);
	color: var(--gwd-sr-text);
}

.gwd-sr-carousel-controls {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
}

.gwd-sr-carousel-controls[hidden] {
	display: none !important;
}

.gwd-sr-carousel-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border: none;
	border-radius: 6px;
	background: var(--gwd-sr-surface);
	color: var(--gwd-sr-text);
	font-size: 0.95rem;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	user-select: none;
	-webkit-user-select: none;
	touch-action: manipulation;
	transition: transform 140ms cubic-bezier(0.23, 1, 0.32, 1), background-color 140ms ease, opacity 140ms ease;
}

.gwd-sr-carousel-btn:disabled {
	opacity: 0.32;
	cursor: default;
}

.gwd-sr-carousel-btn:not(:disabled):active {
	transform: scale(0.95);
}

#gwd-recommended-for-you .gwd-sr-module-title {
	margin: 0;
	font-size: 0.98rem;
	font-weight: 800;
	line-height: 1.3;
	color: var(--gwd-sr-text);
}

.gwd-sr-module-subtitle {
	margin: 0;
	font-size: 0.84rem;
	line-height: 1.4;
	color: var(--gwd-sr-muted);
}

/* Horizontal Scroll Carousel Viewport & Peek Affordance (All Screen Widths) */
.gwd-sr-carousel-viewport {
	position: relative;
	width: 100%;
	max-width: 100%;
}

#gwd-recommended-for-you #gwd-sr-cards-grid.gwd-sr-grid--carousel {
	--gwd-sr-carousel-gap: 1rem;
	display: flex !important;
	flex-wrap: nowrap !important;
	align-items: stretch;
	gap: var(--gwd-sr-carousel-gap) !important;
	overflow-x: auto;
	overflow-y: visible;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	overscroll-behavior-x: contain;
	touch-action: pan-x pan-y;
	padding-bottom: 0.55rem;
	scrollbar-width: thin;
	-webkit-overflow-scrolling: touch;
}

/* Desktop (>= 1100px): 3 full cards + ~22% right-hand peek of card 4 */
#gwd-recommended-for-you #gwd-sr-cards-grid.gwd-sr-grid--carousel > .gwd-sr-card {
	flex: 0 0 calc((100% - (3 * var(--gwd-sr-carousel-gap))) / 3.22) !important;
	width: calc((100% - (3 * var(--gwd-sr-carousel-gap))) / 3.22) !important;
	max-width: calc((100% - (3 * var(--gwd-sr-carousel-gap))) / 3.22) !important;
	min-width: 245px;
	scroll-snap-align: start;
	box-sizing: border-box;
}

/* Tablet (680px - 1099px): 2 full cards + ~22% right-hand peek of card 3 */
@media (max-width: 1099px) {
	#gwd-recommended-for-you #gwd-sr-cards-grid.gwd-sr-grid--carousel > .gwd-sr-card {
		flex: 0 0 calc((100% - (2 * var(--gwd-sr-carousel-gap))) / 2.22) !important;
		width: calc((100% - (2 * var(--gwd-sr-carousel-gap))) / 2.22) !important;
		max-width: calc((100% - (2 * var(--gwd-sr-carousel-gap))) / 2.22) !important;
		min-width: 230px;
	}
}

/* Mobile (< 680px): 1 full card + ~18% right-hand peek of card 2 */
@media (max-width: 679px) {
	#gwd-recommended-for-you #gwd-sr-cards-grid.gwd-sr-grid--carousel {
		--gwd-sr-carousel-gap: 0.75rem;
	}

	#gwd-recommended-for-you #gwd-sr-cards-grid.gwd-sr-grid--carousel > .gwd-sr-card {
		flex: 0 0 calc((100% - var(--gwd-sr-carousel-gap)) / 1.18) !important;
		width: calc((100% - var(--gwd-sr-carousel-gap)) / 1.18) !important;
		max-width: calc((100% - var(--gwd-sr-carousel-gap)) / 1.18) !important;
		min-width: 220px;
	}
}

/* Multi-row Grid View Mode */
#gwd-recommended-for-you #gwd-sr-cards-grid.gwd-sr-grid--grid {
	display: grid !important;
	grid-template-columns: repeat(auto-fill, minmax(265px, 1fr)) !important;
	gap: 1rem !important;
}

/* Recommendation Cards — matches native `.gwd-similar-card` */
.gwd-sr-card {
	position: relative;
	display: flex;
	flex-direction: column;
}

.gwd-sr-card--sponsored {
	background: var(--gwd-sr-surface-elevated);
}

.gwd-sr-card__hero {
	position: relative;
}

.gwd-sr-sponsored-badge {
	position: absolute;
	top: 0.55rem;
	left: 0.55rem;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	padding: 0.2rem 0.52rem;
	border-radius: 5px;
	font-size: 0.68rem;
	font-weight: 800;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	background: var(--gwd-sr-sponsor-bg);
	color: var(--gwd-sr-sponsor-text);
}

.gwd-sr-card__pills {
	display: flex;
	flex-wrap: wrap;
	gap: 0.32rem;
	margin-top: 0.4rem;
}

.gwd-sr-suitability-pill {
	background: var(--gwd-sr-teal-soft) !important;
	color: var(--gwd-sr-teal) !important;
	font-weight: 700;
	font-size: 0.72rem;
}

.gwd-sr-reason-box {
	margin: 0.48rem 0 0.25rem;
	padding: 0;
	color: var(--gwd-sr-muted);
	font-size: 0.8rem;
	font-weight: 600;
	line-height: 1.38;
}

.gwd-sr-sponsor-copy {
	margin: 0.2rem 0 0.3rem;
	font-size: 0.78rem;
	line-height: 1.38;
	color: var(--gwd-sr-muted);
}

.gwd-sr-promoted-offer-pill {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.3rem 0.45rem;
	margin: 0.3rem 0;
	padding: 0.3rem 0.55rem;
	border-radius: 6px;
	background: var(--gwd-sr-promo-bg);
	color: var(--gwd-sr-promo-text);
	font-size: 0.74rem;
	font-weight: 600;
	text-decoration: none;
}

.gwd-sr-promoted-offer-link {
	cursor: pointer;
	transition: opacity 140ms ease;
}

@media (hover: hover) and (pointer: fine) {
	.gwd-sr-promoted-offer-link:hover {
		opacity: 0.88;
		text-decoration: underline;
	}
}

.gwd-sr-promoted-tag {
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	font-size: 0.66rem;
}

.gwd-sr-price-row {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.35rem;
	margin-top: 0.35rem;
}

.gwd-sr-stock-meta {
	display: inline-flex;
	align-items: center;
	gap: 0.32rem;
	font-size: 0.75rem;
	color: var(--gwd-sr-muted);
}

.gwd-sr-stock-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #9ca3af;
	flex-shrink: 0;
}

.gwd-sr-stock-dot.is-local {
	background: #10b981;
}

.gwd-sr-stock-dot.is-global {
	background: #0b6e69;
}

/* Compact Card Action Hierarchy */
.gwd-sr-card-actions {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	margin-top: 0.5rem;
}

.gwd-sr-card-actions > .gwd-toggle-drawer-btn {
	width: 100%;
	justify-content: center;
}

.gwd-sr-secondary-actions {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
	gap: 0.4rem;
	width: 100%;
}

.gwd-sr-secondary-actions > .btn {
	width: 100%;
	justify-content: center;
	padding-left: 0.45rem;
	padding-right: 0.45rem;
	font-size: 0.78rem;
}

/* Debug Panel */
.gwd-sr-debug-panel {
	margin-top: 0.55rem;
	padding: 0.45rem 0.6rem;
	border-radius: 6px;
	background: var(--gwd-sr-surface);
	font-size: 0.72rem;
	line-height: 1.4;
	color: var(--gwd-sr-muted);
	word-break: break-word;
}

/* Loading State */
.gwd-sr-grid.is-loading {
	opacity: 0.6;
	pointer-events: none;
	transition: opacity 0.15s ease;
}

/* PDGA Rating Matcher Integration Prompt */
.gwd-sr-pdga-remember-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	margin-top: 0.85rem;
	padding: 0.7rem 0.95rem;
	border-radius: 8px;
	background: var(--gwd-sr-teal-soft);
	font-size: 0.86rem;
}

.gwd-sr-pdga-remember-bar__btn {
	min-height: 38px;
	cursor: pointer;
}

@media (max-width: 767px) {
	.gwd-sr-header {
		flex-direction: column;
		align-items: stretch;
	}

	.gwd-sr-header__actions {
		justify-content: space-between;
	}

	.gwd-sr-inline-input {
		flex-direction: column;
	}

	.gwd-sr-context-bar__hint {
		margin-left: 0;
		width: 100%;
	}
}

@media (pointer: coarse) {
	#gwd-recommended-for-you .gwd-sr-input,
	#gwd-recommended-for-you .gwd-sr-select {
		font-size: 16px;
	}
}

@media (prefers-reduced-motion: reduce) {
	#gwd-recommended-for-you .gwd-sr-strategy-tabs,
	#gwd-recommended-for-you .gwd-sr-grid--carousel {
		scroll-behavior: auto;
	}

	#gwd-recommended-for-you .gwd-sr-strategy-tab,
	#gwd-recommended-for-you .gwd-sr-rail-nav,
	#gwd-recommended-for-you .gwd-sr-carousel-btn,
	#gwd-recommended-for-you .gwd-sr-layout-btn {
		transition-duration: 0ms;
	}
}
