/* ═══════════════════════════════════════════════
   Woo Book Suggester — Styles
   Designed for Flatsome compatibility
   ═══════════════════════════════════════════════ */

/* ─── Variables ─────────────────────────────── */
:root {
	--wbs-primary: var(--primary-color, #446084);
	--wbs-primary-light: var(--fs-color-secondary, #5a7ba5);
	--wbs-accent: var(--fs-color-secondary, #c9956b);
	--wbs-accent-dark: var(--primary-color, #a87542);
	--wbs-success: var(--fs-color-success, #28a745);
	--wbs-success-dark: #1e7e34;
	--wbs-danger: var(--fs-color-alert, #dc3545);
	--wbs-bg: #ffffff;
	--wbs-bg-light: #f8f9fa;
	--wbs-border: #e0e0e0;
	--wbs-text: #333333;
	--wbs-text-light: #777777;
	--wbs-radius: 25px;
	--wbs-radius-sm: 8px;
	--wbs-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
	--wbs-shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.15);
	--wbs-transition: 0.25s ease;
}

/* ─── Container ─────────────────────────────── */
.wbs-container {
	max-width: 960px;
	margin: 30px auto;
	padding: 40px 36px;
	background: var(--wbs-bg);
	border-radius: var(--wbs-radius-sm);
	box-shadow: var(--wbs-shadow);
	font-family: inherit;
	position: relative;
}

/* ─── Sections ──────────────────────────────── */
.wbs-section {
	margin-bottom: 32px;
}

.wbs-section-title {
	font-size: 1.35em;
	font-weight: 700;
	font-style: italic;
	color: var(--wbs-primary);
	margin: 0 0 18px 0;
	padding-bottom: 8px;
	border-bottom: none;
}

.wbs-num {
	color: var(--wbs-accent);
	margin-right: 6px;
	font-style: italic;
}



/* ─── Pill Buttons ──────────────────────────── */
.wbs-pills-group {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.wbs-pill {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 10px 22px;
	border: 1.5px solid var(--wbs-border);
	border-radius: var(--wbs-radius);
	background: var(--wbs-bg);
	color: var(--wbs-text);
	font-size: 0.95em;
	cursor: pointer;
	transition: all var(--wbs-transition);
	white-space: nowrap;
	min-width: 120px;
	text-align: center;
	user-select: none;
}

.wbs-pill:hover {
	border-color: var(--wbs-accent);
	color: var(--wbs-accent);
	background: rgba(201, 149, 107, 0.06);
}

.wbs-pill.active {
	border-color: var(--wbs-accent);
	background: var(--wbs-accent);
	color: #fff;
	box-shadow: 0 2px 8px rgba(201, 149, 107, 0.35);
}

.wbs-pill.wbs-pill-hidden {
	display: none;
}


/* ─── Submit Button ─────────────────────────── */
.wbs-form-actions {
	text-align: center;
	margin-top: 28px;
}

.wbs-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 14px 36px;
	border: none;
	border-radius: var(--wbs-radius);
	font-size: 1.05em;
	font-weight: 600;
	cursor: pointer;
	transition: all var(--wbs-transition);
	text-decoration: none;
}

.wbs-btn-primary {
	background: linear-gradient(135deg, var(--wbs-primary), var(--wbs-primary-light));
	color: #fff;
	box-shadow: 0 4px 14px rgba(68, 96, 132, 0.35);
}

.wbs-btn-primary:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(68, 96, 132, 0.45);
}

.wbs-btn-success {
	/* background: linear-gradient(135deg, var(--wbs-success), #34c759); */
	/* color: #fff; */
	/* box-shadow: 0 4px 14px rgba(40, 167, 69, 0.35); */
	background: #a72828;
}

.wbs-btn-success:hover {
	transform: translateY(-2px);
	/* box-shadow: 0 6px 20px rgba(40, 167, 69, 0.45); */
}

.wbs-btn-outline {
	background: transparent;
	border: 1.5px solid var(--wbs-border);
	color: var(--wbs-text-light);
}

.wbs-btn-outline:hover {
	border-color: var(--wbs-primary);
	color: var(--wbs-primary);
}

.wbs-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
	transform: none !important;
}

.wbs-btn-icon {
	font-size: 1.2em;
}

/* ═══════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════ */
.wbs-modal {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 999999;
}

.wbs-modal.active {
	display: flex;
	align-items: center;
	justify-content: center;
}

.wbs-modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	backdrop-filter: blur(4px);
}

.wbs-modal-dialog {
	position: relative;
	width: 94%;
	max-width: 1100px;
	max-height: 94vh;
	background: var(--wbs-bg);
	border-radius: 16px;
	box-shadow: var(--wbs-shadow-lg);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: wbsSlideUp 0.35s ease;
}

@keyframes wbsSlideUp {
	from { opacity: 0; transform: translateY(40px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* Modal Header */
.wbs-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20px 28px;
	border-bottom: 1px solid var(--wbs-border);
	background: var(--wbs-bg-light);
}

.wbs-modal-title {
	margin: 0;
	font-size: 1.3em;
	color: var(--wbs-primary);
	font-weight: 700;
}

.wbs-modal-close {
	background: none;
	border: none;
	font-size: 1.8em;
	color: var(--wbs-text-light);
	cursor: pointer;
	padding: 0;
	line-height: 1;
	transition: color var(--wbs-transition);
}

.wbs-modal-close:hover {
	color: var(--wbs-danger);
}

/* Modal Meta */
.wbs-modal-meta {
	display: flex;
	gap: 16px;
	padding: 14px 28px;
	background: var(--wbs-bg-light);
	flex-wrap: wrap;
}

.wbs-meta-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 14px;
	background: #fff;
	border: 1px solid var(--wbs-border);
	border-radius: var(--wbs-radius);
	font-size: 0.9em;
}

.wbs-meta-label {
	color: var(--wbs-text-light);
}

.wbs-meta-value {
	font-weight: 600;
	color: var(--wbs-primary);
}

/* Modal Search */
.wbs-modal-search {
	padding: 16px 28px 8px;
	position: relative;
}

.wbs-search-input-wrap {
	position: relative;
}

.wbs-search-input-wrap input {
	width: 100%;
	padding: 12px 16px 12px 42px;
	border: 1.5px solid var(--wbs-border);
	border-radius: var(--wbs-radius);
	font-size: 0.95em;
	outline: none;
	transition: border-color var(--wbs-transition);
}

.wbs-search-input-wrap input:focus {
	border-color: var(--wbs-accent);
}

.wbs-search-icon {
	position: absolute;
	left: 14px;
	top: 50%;
	transform: translateY(-50%);
	font-size: 1.1em;
	pointer-events: none;
}

/* Search Dropdown */
.wbs-search-dropdown {
	position: absolute;
	left: 28px;
	right: 28px;
	top: 100%;
	background: #fff;
	border: 1px solid var(--wbs-border);
	border-radius: var(--wbs-radius-sm);
	box-shadow: var(--wbs-shadow);
	max-height: 280px;
	overflow-y: auto;
	z-index: 10;
	display: none;
}

.wbs-search-dropdown.active {
	display: block;
}

.wbs-search-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 16px;
	cursor: pointer;
	transition: background var(--wbs-transition);
	border-bottom: 1px solid #f0f0f0;
}

.wbs-search-item:last-child {
	border-bottom: none;
}

.wbs-search-item:hover {
	background: var(--wbs-bg-light);
}

.wbs-search-item img {
	width: 40px;
	height: 40px;
	object-fit: cover;
	border-radius: 6px;
	flex-shrink: 0;
}

.wbs-search-item-info {
	flex: 1;
	min-width: 0;
}

.wbs-search-item-name {
	font-size: 0.9em;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.wbs-search-item-price {
	font-size: 0.85em;
	color: var(--wbs-accent-dark);
	font-weight: 600;
}

.wbs-search-item-toggle {
	flex-shrink: 0;
	background: var(--wbs-success);
	color: #fff;
	border: none;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	font-size: 1.2em;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all var(--wbs-transition);
}

.wbs-search-item-toggle:hover {
	background: var(--wbs-success-dark);
	transform: scale(1.1);
}

.wbs-search-item-toggle.added {
	background: #999;
	width: auto;
	padding: 4px 12px;
	border-radius: var(--wbs-radius);
	font-size: 0.8em;
	font-weight: 600;
}

.wbs-search-item-toggle.added:hover {
	background: var(--wbs-danger);
	color: #fff;
}

.wbs-search-empty {
	padding: 16px;
	text-align: center;
	color: var(--wbs-text-light);
	font-size: 0.9em;
}

/* Modal Body — Product List */
.wbs-modal-body {
	flex: 1;
	overflow-y: auto;
	padding: 20px 28px;
}

.wbs-product-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 16px;
}

.wbs-product-card {
	background: #fff;
	border: 1px solid var(--wbs-border);
	border-radius: 12px;
	overflow: hidden;
	transition: transform var(--wbs-transition), box-shadow var(--wbs-transition);
	position: relative;
	display: flex;
	flex-direction: column;
}

.wbs-product-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
}

.wbs-product-card-imgwrap {
	width: 100%;
	aspect-ratio: 3 / 4;
	overflow: hidden;
	background: #f5f5f5;
}

.wbs-product-card-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.3s ease;
}

.wbs-product-card:hover .wbs-product-card-img {
	transform: scale(1.05);
}

.wbs-product-card-body {
	padding: 12px 14px;
	display: flex;
	flex-direction: column;
	flex: 1;
}

.wbs-product-card-name {
	font-size: 0.88em;
	font-weight: 600;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	margin: 0 0 8px 0;
	line-height: 1.35;
	min-height: 2.4em;
	color: var(--wbs-text);
}

.wbs-product-card-meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 6px;
	margin-bottom: 10px;
}

.wbs-product-card-price {
	font-size: 0.95em;
	font-weight: 700;
	color: var(--wbs-accent-dark);
	white-space: nowrap;
}

.wbs-product-card-stock {
	font-size: 0.75em;
	color: var(--wbs-text-light);
	background: var(--wbs-bg-light);
	padding: 2px 8px;
	border-radius: 10px;
	white-space: nowrap;
	font-weight: 600;
}

.wbs-product-card-stock.in-stock {
	color: var(--wbs-success);
	background: rgba(40, 167, 69, 0.1);
}

.wbs-product-card-stock.out-stock {
	color: var(--wbs-danger);
	background: rgba(220, 53, 69, 0.1);
}

/* Quantity Controls */
.wbs-qty-control {
	display: inline-flex;
	align-items: center;
	align-self: center;
	gap: 0;
	margin-top: auto;
	border: 1px solid var(--wbs-border);
	border-radius: 4px;
	overflow: hidden;
	height: 30px;
}

.wbs-qty-btn {
	width: 28px;
	height: 30px;
	border: none;
	background: var(--wbs-bg-light);
	color: var(--wbs-text);
	font-size: 1em;
	font-weight: 700;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all var(--wbs-transition);
	padding: 0;
	line-height: 1;
}

.wbs-qty-btn:hover {
	background: var(--wbs-accent);
	color: #fff;
}

.wbs-qty-btn:active {
	opacity: 0.8;
}

.wbs-qty-value {
	min-width: 32px;
	text-align: center;
	font-weight: 700;
	font-size: 0.9em;
	color: var(--wbs-primary);
	background: #fff;
	line-height: 30px;
	border-left: 1px solid var(--wbs-border);
	border-right: 1px solid var(--wbs-border);
}

/* Remove button */
.wbs-product-remove {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: rgba(220, 53, 69, 0.9);
	color: #fff;
	border: none;
	font-size: 1.1em;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all var(--wbs-transition);
	opacity: 0; /* Ẩn mặc định */
	z-index: 5;
}

.wbs-product-card:hover .wbs-product-remove {
	opacity: 1;
	transform: scale(1.1);
}

.wbs-product-remove:hover {
	background: var(--wbs-danger);
	box-shadow: 0 2px 8px rgba(220, 53, 69, 0.4);
}

/* Modal Footer */
.wbs-modal-footer {
	padding: 18px 28px;
	border-top: 1px solid var(--wbs-border);
	background: var(--wbs-bg-light);
}

.wbs-summary-row {
	display: flex;
	justify-content: flex-start;
	gap: 32px;
	margin-bottom: 16px;
	flex-wrap: wrap;
}

.wbs-summary-item {
	display: flex;
	align-items: center;
	gap: 8px;
}

.wbs-summary-label {
	font-size: 0.95em;
	color: var(--wbs-text-light);
}

.wbs-summary-value {
	font-weight: 700;
	font-size: 1.1em;
}

.wbs-total-value {
	color: var(--wbs-primary);
}

.wbs-diff-value {
	color: var(--wbs-success);
}

.wbs-diff-value.negative {
	color: var(--wbs-danger);
}

.wbs-footer-actions {
	display: flex;
	justify-content: flex-end;
	gap: 12px;
}

/* ─── Loader ────────────────────────────────── */
.wbs-loader {
	position: fixed;
	inset: 0;
	z-index: 999998;
	background: rgba(255, 255, 255, 0.85);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	backdrop-filter: blur(3px);
}

.wbs-spinner {
	width: 48px;
	height: 48px;
	border: 4px solid var(--wbs-border);
	border-top: 4px solid var(--wbs-accent);
	border-radius: 50%;
	animation: wbsSpin 0.8s linear infinite;
	margin-bottom: 14px;
}

@keyframes wbsSpin {
	to { transform: rotate(360deg); }
}

.wbs-loader p {
	color: var(--wbs-text-light);
	font-size: 1em;
}

/* ─── Toast ─────────────────────────────────── */
.wbs-toast {
	position: fixed;
	bottom: 32px;
	right: 32px;
	z-index: 1000000;
	display: flex;
	flex-direction: column;
	gap: 10px;
	pointer-events: none;
}

.wbs-toast-item {
	padding: 14px 22px;
	border-radius: var(--wbs-radius-sm);
	color: #fff;
	font-weight: 600;
	font-size: 0.95em;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
	animation: wbsToastIn 0.3s ease;
	pointer-events: auto;
}

.wbs-toast-item.success {
	background: var(--wbs-success);
}

.wbs-toast-item.error {
	background: var(--wbs-danger);
}

.wbs-toast-item.info {
	background: var(--wbs-primary);
}

@keyframes wbsToastIn {
	from { opacity: 0; transform: translateY(20px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* ─── Empty state ───────────────────────────── */
.wbs-empty-state {
	text-align: center;
	padding: 40px 20px;
	color: var(--wbs-text-light);
}

.wbs-empty-state p {
	font-size: 1em;
	margin: 0;
}

/* ═══════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════ */
@media (max-width: 768px) {
	.wbs-container {
		margin: 16px;
		padding: 24px 18px;
	}


	.wbs-pill {
		min-width: 100px;
		padding: 8px 16px;
		font-size: 0.88em;
	}

	.wbs-modal-dialog {
		width: 98%;
		max-height: 96vh;
		border-radius: 12px;
	}

	.wbs-modal-header,
	.wbs-modal-meta,
	.wbs-modal-search,
	.wbs-modal-body,
	.wbs-modal-footer {
		padding-left: 16px;
		padding-right: 16px;
	}

	.wbs-product-list {
		grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
		gap: 10px;
	}

	.wbs-product-card-img {
		height: 140px;
	}

	.wbs-summary-row {
		flex-direction: column;
		gap: 8px;
	}

	.wbs-footer-actions {
		flex-direction: column;
	}

	.wbs-footer-actions .wbs-btn {
		width: 100%;
	}

	.wbs-search-dropdown {
		left: 16px;
		right: 16px;
	}

	.wbs-product-remove {
		opacity: 1;
	}
}

@media (max-width: 480px) {
	.wbs-product-list {
		grid-template-columns: 1fr 1fr;
		gap: 8px;
	}

	.wbs-product-card-img {
		height: 120px;
	}

	.wbs-product-card-body {
		padding: 8px 10px;
	}
}
