/* ==========================================================================
   Chapitre WooCommerce Product Search Modal - Style Sheet
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. TRIGGER BUTTON & INPUT BAR
   -------------------------------------------------------------------------- */
.chapitre-search-trigger-wrapper {
	width: 100%;
}

.chapitre-search-trigger {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	background-color: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	padding: 12px 18px;
	cursor: pointer;
	transition: all 0.25s ease;
	box-shadow: none !important;
	user-select: none;
	width: 100%;
	box-sizing: border-box;
	font-family: inherit;
}

.chapitre-search-trigger:hover,
.chapitre-search-trigger:focus-visible {
	border-color: #c4161c;
	box-shadow: 0 4px 16px rgba(196, 22, 28, 0.08) !important;
	transform: translateY(-1px);
	outline: none;
}

.chapitre-trigger-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 16px;
	color: #c4161c;
	flex-shrink: 0;
}

.chapitre-trigger-icon svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

.chapitre-trigger-text {
	flex-grow: 1;
	font-size: 14px;
	font-weight: 500;
	color: #64748b;
	text-align: left;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.chapitre-trigger-kbd {
	font-family: system-ui, -apple-system, sans-serif;
	font-size: 11px;
	font-weight: 600;
	color: #94a3b8;
	background: #f1f5f9;
	border: 1px solid #cbd5e1;
	border-radius: 6px;
	padding: 3px 7px;
	letter-spacing: 0.5px;
	flex-shrink: 0;
}

.chapitre-trigger-button {
	justify-content: center;
	background: #c4161c !important;
	border-color: #c4161c !important;
	color: #ffffff !important;
}

.chapitre-trigger-button .chapitre-trigger-text {
	color: #ffffff !important;
	font-weight: 600;
	flex-grow: 0;
}

.chapitre-trigger-button .chapitre-trigger-icon {
	color: #ffffff !important;
}

.chapitre-trigger-icon-only {
	width: 44px;
	height: 44px;
	padding: 0;
	justify-content: center;
	border-radius: 50%;
}


/* --------------------------------------------------------------------------
   2. MODAL OVERLAY & CONTAINER
   -------------------------------------------------------------------------- */
.chapitre-search-modal-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	background-color: rgba(15, 23, 42, 0.65);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	z-index: 999999;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 60px 20px 20px;
	box-sizing: border-box;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.chapitre-search-modal-overlay.active {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.chapitre-search-modal-container {
	width: 100%;
	max-width: 760px;
	background-color: #ffffff;
	border-radius: 20px;
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	max-height: calc(100vh - 100px);
	transform: scale(0.95) translateY(-12px);
	transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
	box-sizing: border-box;
}

.chapitre-search-modal-overlay.active .chapitre-search-modal-container {
	transform: scale(1) translateY(0);
}


/* --------------------------------------------------------------------------
   3. MODAL HEADER & SEARCH INPUT
   -------------------------------------------------------------------------- */
.chapitre-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20px 24px 14px;
}

.chapitre-modal-title {
	margin: 0;
	font-size: 18px;
	font-weight: 700;
	color: #0f172a;
	letter-spacing: -0.02em;
}

/* Close Button Fix */
.chapitre-modal-close {
	background: #f1f5f9 !important;
	border: none !important;
	border-radius: 50% !important;
	width: 36px !important;
	height: 36px !important;
	min-width: 36px !important;
	min-height: 36px !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	color: #475569 !important;
	cursor: pointer !important;
	padding: 0 !important;
	margin: 0 !important;
	transition: all 0.2s ease !important;
	box-shadow: none !important;
	outline: none !important;
	-webkit-appearance: none !important;
	appearance: none !important;
}

.chapitre-modal-close:hover {
	background: #fee2e2 !important;
	color: #c4161c !important;
	transform: rotate(90deg) !important;
}

.chapitre-modal-close svg {
	width: 18px !important;
	height: 18px !important;
	stroke: currentColor !important;
	stroke-width: 2.2px !important;
	fill: none !important;
}

/* Search Box Container */
.chapitre-modal-search-box {
	position: relative;
	margin: 0 24px 16px !important;
	display: flex;
	align-items: center;
	background-color: #ffffff !important;
	border: 1.5px solid #e2e8f0 !important;
	border-radius: 12px !important;
	padding: 0 16px !important;
	transition: all 0.2s ease !important;
	box-shadow: none !important;
	outline: none !important;
}

.chapitre-modal-search-box:focus-within {
	border-color: #c4161c !important;
	box-shadow: 0 0 0 3px rgba(196, 22, 28, 0.12) !important;
}

.chapitre-modal-search-icon {
	color: #c4161c !important;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-right: 12px;
	flex-shrink: 0;
}

.chapitre-modal-search-icon svg {
	width: 20px !important;
	height: 20px !important;
	stroke: currentColor !important;
	stroke-width: 2.2px !important;
	fill: none !important;
}

/* Search Input Fix */
.chapitre-modal-search-input,
.chapitre-modal-search-input:focus,
.chapitre-modal-search-input:active {
	width: 100% !important;
	height: 48px !important;
	background: transparent !important;
	border: none !important;
	outline: none !important;
	box-shadow: none !important;
	border-radius: 0 !important;
	font-size: 16px !important; /* 16px prevents automatic iOS Safari zoom */
	font-weight: 500 !important;
	color: #0f172a !important;
	font-family: inherit !important;
	padding: 0 !important;
	margin: 0 !important;
	-webkit-appearance: none !important;
	appearance: none !important;
}

.chapitre-modal-search-input::placeholder {
	color: #94a3b8 !important;
}

/* Clear Button Fix */
.chapitre-modal-clear-btn {
	background: #cbd5e1 !important;
	border: none !important;
	border-radius: 50% !important;
	width: 22px !important;
	height: 22px !important;
	min-width: 22px !important;
	min-height: 22px !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	color: #ffffff !important;
	cursor: pointer !important;
	flex-shrink: 0 !important;
	padding: 0 !important;
	margin: 0 !important;
	box-shadow: none !important;
	transition: background 0.2s ease !important;
}

.chapitre-modal-clear-btn:hover {
	background: #c4161c !important;
}

.chapitre-modal-clear-btn svg {
	width: 12px !important;
	height: 12px !important;
	stroke: currentColor !important;
	stroke-width: 2.5px !important;
	fill: none !important;
}


/* --------------------------------------------------------------------------
   4. CATEGORY PILLS & SUGGESTION TAGS
   -------------------------------------------------------------------------- */
.chapitre-modal-categories {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 0 24px 16px;
	overflow-x: auto;
	scrollbar-width: none;
	-ms-overflow-style: none;
	-webkit-overflow-scrolling: touch;
}

.chapitre-modal-categories::-webkit-scrollbar {
	display: none;
}

.chapitre-cat-pill {
	background: #f8fafc !important;
	border: 1px solid #e2e8f0 !important;
	border-radius: 8px !important;
	padding: 7px 14px !important;
	font-size: 13px !important;
	font-weight: 600 !important;
	color: #475569 !important;
	cursor: pointer !important;
	white-space: nowrap !important;
	transition: all 0.2s ease !important;
	box-shadow: none !important;
	flex-shrink: 0 !important;
}

.chapitre-cat-pill:hover {
	background: #fff5f5 !important;
	border-color: #c4161c !important;
	color: #c4161c !important;
}

.chapitre-cat-pill.active {
	background: #c4161c !important;
	border-color: #c4161c !important;
	color: #ffffff !important;
	font-weight: 600 !important;
	box-shadow: 0 2px 8px rgba(196, 22, 28, 0.25) !important;
}

.chapitre-modal-suggestions {
	padding: 0 24px 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.chapitre-suggestions-label {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #94a3b8;
}

.chapitre-suggestion-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.chapitre-tag-chip {
	background: #ffffff !important;
	border: 1px solid #e2e8f0 !important;
	border-radius: 8px !important;
	padding: 6px 14px !important;
	font-size: 13px !important;
	font-weight: 600 !important;
	color: #334155 !important;
	cursor: pointer !important;
	transition: all 0.2s ease !important;
	box-shadow: none !important;
}

.chapitre-tag-chip:hover {
	border-color: #c4161c !important;
	color: #c4161c !important;
	background: #fff5f5 !important;
	transform: translateY(-1px);
}


/* --------------------------------------------------------------------------
   5. RESULTS CONTAINER & CARDS
   -------------------------------------------------------------------------- */
.chapitre-modal-results-container {
	flex: 1;
	overflow-y: auto;
	padding: 0 24px 16px;
	max-height: 420px;
	scrollbar-width: thin;
	scrollbar-color: #cbd5e1 transparent;
	-webkit-overflow-scrolling: touch;
}

.chapitre-modal-results-container::-webkit-scrollbar {
	width: 6px;
}

.chapitre-modal-results-container::-webkit-scrollbar-thumb {
	background-color: #cbd5e1;
	border-radius: 3px;
}

.chapitre-results-status {
	font-size: 13px;
	font-weight: 600;
	color: #64748b;
	margin-bottom: 12px;
}

.chapitre-results-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

/* Product Card */
.chapitre-product-card {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 12px 14px;
	border-radius: 14px;
	background: #ffffff;
	border: 1px solid #f1f5f9;
	text-decoration: none !important;
	transition: all 0.2s ease;
	position: relative;
}

.chapitre-product-card:hover,
.chapitre-product-card.is-selected {
	background: #f8fafc;
	border-color: #e2e8f0;
	transform: translateX(4px);
	box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.chapitre-product-thumb {
	width: 60px;
	height: 60px;
	border-radius: 8px;
	object-fit: cover;
	flex-shrink: 0;
	background: #f1f5f9;
	border: 1px solid #e2e8f0;
}

.chapitre-product-info {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.chapitre-product-meta {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 11px;
	font-weight: 700;
	color: #64748b;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.chapitre-product-cat {
	color: #c4161c !important;
}

.chapitre-product-sku {
	color: #94a3b8;
}

.chapitre-product-title {
	margin: 0;
	font-size: 15px;
	font-weight: 700;
	color: #1e293b;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	line-height: 1.3;
}

.chapitre-highlight {
	background-color: #fef08a;
	color: #854d0e;
	padding: 1px 3px;
	border-radius: 3px;
	font-weight: 700;
}

.chapitre-product-price-wrapper {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 2px;
	flex-wrap: wrap;
}

.chapitre-product-price {
	font-size: 14px;
	font-weight: 700;
	color: #0f172a;
}

.chapitre-product-price del {
	color: #94a3b8;
	font-weight: 400;
	font-size: 12px;
	margin-right: 4px;
}

.chapitre-product-price ins {
	text-decoration: none;
	color: #c4161c;
}

.chapitre-badge-sale {
	background: #c4161c;
	color: #ffffff;
	font-size: 11px;
	font-weight: 700;
	padding: 2px 7px;
	border-radius: 12px;
}

.chapitre-badge-stock {
	font-size: 11px;
	font-weight: 600;
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.chapitre-badge-stock.in-stock {
	color: #16a34a;
}

.chapitre-badge-stock.out-of-stock {
	color: #dc2626;
}

.chapitre-badge-stock-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: currentColor;
}

.chapitre-product-action {
	flex-shrink: 0;
}

.chapitre-product-view-btn {
	background: #c4161c !important;
	color: #ffffff !important;
	border: none;
	border-radius: 8px;
	padding: 8px 14px;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.chapitre-product-card:hover .chapitre-product-view-btn {
	background: #990f14 !important;
	color: #ffffff !important;
}


/* --------------------------------------------------------------------------
   6. SKELETON LOADER & EMPTY STATE
   -------------------------------------------------------------------------- */
.chapitre-skeleton-card {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 12px;
	border-radius: 14px;
	background: #f8fafc;
}

.chapitre-skeleton-thumb {
	width: 60px;
	height: 60px;
	border-radius: 8px;
	background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
	background-size: 200% 100%;
	animation: chapitre-shimmer 1.5s infinite;
}

.chapitre-skeleton-lines {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.chapitre-skeleton-line {
	height: 12px;
	border-radius: 6px;
	background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
	background-size: 200% 100%;
	animation: chapitre-shimmer 1.5s infinite;
}

.chapitre-skeleton-line.w-50 { width: 50%; }
.chapitre-skeleton-line.w-75 { width: 75%; }
.chapitre-skeleton-line.w-30 { width: 30%; }

@keyframes chapitre-shimmer {
	0% { background-position: 200% 0; }
	100% { background-position: -200% 0; }
}

.chapitre-empty-results {
	text-align: center;
	padding: 40px 20px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	color: #64748b;
}

.chapitre-empty-icon {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	background: #f1f5f9;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #94a3b8;
}

.chapitre-empty-title {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	color: #1e293b;
}

.chapitre-empty-desc {
	margin: 0;
	font-size: 13px;
}


/* --------------------------------------------------------------------------
   7. MODAL FOOTER
   -------------------------------------------------------------------------- */
.chapitre-modal-footer {
	padding: 14px 24px;
	background: #f8fafc;
	border-top: 1px solid #e2e8f0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 12px;
	color: #64748b;
}

.chapitre-footer-tips {
	display: flex;
	align-items: center;
	gap: 14px;
}

.chapitre-footer-tips kbd {
	background: #ffffff;
	border: 1px solid #cbd5e1;
	border-radius: 4px;
	padding: 1px 5px;
	font-size: 10px;
	font-weight: 600;
	color: #475569;
}


/* --------------------------------------------------------------------------
   8. RESPONSIVE BREAKPOINTS (MOBILE TOP ANCHOR FIX)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
	.chapitre-search-modal-overlay {
		position: fixed !important;
		top: 0 !important;
		left: 0 !important;
		right: 0 !important;
		bottom: 0 !important;
		width: 100% !important;
		height: 100% !important;
		height: 100dvh !important;
		padding: 12px !important;
		align-items: flex-start !important;
		justify-content: center !important;
		z-index: 99999999 !important;
	}

	.chapitre-search-modal-container {
		width: 100% !important;
		max-width: 100% !important;
		height: auto !important;
		max-height: calc(100dvh - 24px) !important;
		max-height: calc(100vh - 24px) !important;
		border-radius: 16px !important;
		margin: 0 auto !important;
		display: flex !important;
		flex-direction: column !important;
		overflow: hidden !important;
		transform: none !important;
	}

	.chapitre-search-modal-overlay.active .chapitre-search-modal-container {
		transform: none !important;
	}

	.chapitre-modal-header {
		padding: 14px 16px 8px !important;
	}

	.chapitre-modal-title {
		font-size: 16px !important;
	}

	.chapitre-modal-search-box {
		margin: 0 14px 10px !important;
		padding: 0 12px !important;
	}

	.chapitre-modal-search-input {
		height: 46px !important;
		font-size: 16px !important; /* Prevents auto zoom on mobile browsers */
	}

	.chapitre-modal-categories,
	.chapitre-modal-suggestions {
		padding-left: 14px !important;
		padding-right: 14px !important;
		padding-bottom: 10px !important;
	}

	.chapitre-modal-results-container {
		padding-left: 14px !important;
		padding-right: 14px !important;
		padding-bottom: 14px !important;
		flex: 1 !important;
		max-height: none !important;
		overflow-y: auto !important;
		-webkit-overflow-scrolling: touch;
	}

	.chapitre-cat-pill {
		padding: 6px 12px !important;
		font-size: 12px !important;
	}

	.chapitre-tag-chip {
		padding: 5px 10px !important;
		font-size: 12px !important;
	}

	.chapitre-product-card {
		padding: 10px !important;
		gap: 10px !important;
		border-radius: 12px !important;
	}

	.chapitre-product-thumb {
		width: 50px !important;
		height: 50px !important;
		border-radius: 6px !important;
	}

	.chapitre-product-title {
		font-size: 13.5px !important;
	}

	.chapitre-product-price {
		font-size: 13px !important;
	}

	.chapitre-product-view-btn {
		padding: 6px 10px !important;
		font-size: 11px !important;
		border-radius: 6px !important;
	}

	.chapitre-modal-footer {
		display: none !important;
	}
}
