/* ═══════════════════════════════════════
   Bracelet Customizer – Overlay & Modal
   ═══════════════════════════════════════ */

/* Body scroll lock when modal is open */
body.bc-modal-open,
html.bc-modal-open {
	overflow: hidden !important;
	height: 100% !important;
	position: fixed !important;
	width: 100% !important;
}

/* Override parent theme button styles globally inside modal */
.bc-modal button,
.bc-modal button:hover,
.bc-modal button:focus,
.bc-modal button:active {
	box-shadow: none !important;
	text-shadow: none !important;
	outline: none;
}

.bc-overlay {
	position: fixed;
	inset: 0;
	z-index: 999999;
	background: rgba(0, 0, 0, .55);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	overflow: auto;
}

.bc-modal {
	background: #fff;
	border-radius: 0;
	width: 100%;
	max-width: 1300px;
	height: 90vh;
	display: flex;
	flex-direction: row;
	box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
	animation: bcFadeIn .25s ease;
	overflow: hidden;
}

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

/* ── Header (inside right column) ── */
.bc-modal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 20px;
	border-bottom: 1px solid #eee;
	flex-shrink: 0;
}

.bc-modal__title {
	margin: 0;
	font-size: 18px;
	font-weight: 600;
	color: #222;
}

.bc-modal__close {
	background: none !important;
	border: none !important;
	font-size: 28px;
	cursor: pointer;
	color: #999;
	line-height: 1;
	padding: 0;
	box-shadow: none !important;
	text-shadow: none !important;
	transition: color .2s;
}
.bc-modal__close:hover,
.bc-modal__close:focus,
.bc-modal__close:active {
	color: #222;
	background: none !important;
	box-shadow: none !important;
	text-shadow: none !important;
	outline: none;
}

/* ── Left: Preview (full height) ── */
.bc-preview {
	position: relative;
	width: 50%;
	flex-shrink: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 24px;
	border-right: 1px solid #eee;
	background: #faf8f5;
	overflow-y: auto;
}

.bc-preview__close {
	display: none;
	position: absolute;
	top: 10px;
	right: 14px;
	font-size: 26px;
	color: #999;
	cursor: pointer;
	z-index: 2;
	line-height: 1;
}
.bc-preview__close:hover { color: #222; }

.bc-preview__top {
	display: contents;
}

/* ── Right: Header + Controls + Footer ── */
.bc-right {
	flex: 1;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	min-width: 0;
}

.bc-preview__canvas-wrap {
	position: relative;
	width: 100%;
	max-width: 460px;
	aspect-ratio: 1;
}

.bc-preview__canvas-wrap canvas {
	width: 100%;
	height: 100%;
	display: block;
}

/* ── Toolbar ── */
.bc-toolbar {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 0;
	width: 100%;
	max-width: 460px;
	margin-top: 14px;
}

.bc-toolbar__btn {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 5px;
	padding: 8px 0;
	font-size: 11px;
	color: #888;
	cursor: pointer;
	transition: color .2s;
	user-select: none;
}
.bc-toolbar__btn:hover {
	color: #222;
}
.bc-toolbar__btn:hover .bc-toolbar__icon {
	border-color: #222;
}
.bc-toolbar__btn[data-disabled="true"] {
	opacity: .3;
	cursor: not-allowed;
	pointer-events: none;
}
.bc-toolbar__btn--danger:hover {
	color: #d9534f;
}
.bc-toolbar__btn--danger:hover .bc-toolbar__icon {
	border-color: #d9534f;
}
.bc-toolbar__text {
	white-space: nowrap;
}
.bc-toolbar__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 0;
	border: 1px solid #ddd;
	background: #fff;
	box-shadow: none;
	transition: all .2s;
}
.bc-toolbar__btn svg {
	flex-shrink: 0;
}

.bc-preview__stats {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px 20px;
	width: 100%;
	max-width: 460px;
	margin-top: 30px;
}

.bc-stat {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 13px;
}
.bc-stat__label { color: #888; }
.bc-stat__value { font-weight: 600; color: #222; }

.bc-preview__hint {
	margin-top: 14px;
	font-size: 12px;
	color: #bbb;
}

/* ── Controls (inside right column) ── */
.bc-controls {
	flex: 1;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	min-height: 0;
}

/* Wrist bar */
.bc-wrist-bar {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 20px;
	border-bottom: 1px solid #eee;
	flex-shrink: 0;
}

.bc-wrist-bar__btn {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	background: none;
	border: 1px solid #ddd;
	border-radius: 0;
	padding: 6px 12px;
	font-size: 13px;
	cursor: pointer;
	transition: border-color .2s;
}
.bc-wrist-bar__btn:hover { border-color: #222; }
.bc-wrist-bar__info { font-size: 13px; color: #666; }

/* Wrist settings panel */
.bc-wrist-panel {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 10;
	background: #fff;
	border-radius: 0;
	box-shadow: 0 8px 40px rgba(0,0,0,.2);
	padding: 28px 32px;
	width: 380px;
	max-width: 90vw;
}

.bc-wrist-panel h3 {
	margin: 0 0 20px;
	font-size: 16px;
	font-weight: 600;
}

.bc-wrist-panel__field {
	margin-bottom: 18px;
}
.bc-wrist-panel__field > label {
	display: block;
	font-size: 13px;
	color: #666;
	margin-bottom: 8px;
}

.bc-wrist-panel__input-wrap {
	display: flex;
	align-items: center;
	border: 1px solid #ddd;
	border-radius: 0;
	overflow: hidden;
}
.bc-wrist-panel__input-wrap input {
	flex: 1;
	border: none;
	padding: 10px 14px;
	font-size: 16px;
	outline: none;
	-moz-appearance: textfield;
}
.bc-wrist-panel__input-wrap input::-webkit-inner-spin-button { -webkit-appearance: none; }
.bc-wrist-panel__input-wrap span {
	padding: 0 14px;
	color: #999;
	font-size: 14px;
}

.bc-wrist-panel__styles {
	display: flex;
	gap: 12px;
}

.bc-wear-option {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	padding: 12px 16px;
	border: 2px solid #eee;
	border-radius: 0;
	cursor: pointer;
	transition: border-color .2s;
}
.bc-wear-option input { display: none; }
.bc-wear-option strong { font-size: 14px; }
.bc-wear-option small { font-size: 11px; color: #999; margin-top: 2px; }
.bc-wear-option--active { border-color: #222; }

.bc-wrist-panel__max {
	text-align: center;
	font-size: 13px;
	color: #888;
	margin: 16px 0;
}

/* ── Tabs ── */
.bc-tabs {
	display: flex;
	gap: 0;
	border-bottom: 1px solid #eee;
	padding: 0 20px;
	flex-shrink: 0;
	overflow-x: auto;
}

.bc-tab {
	background: none;
	border: none;
	border-bottom: 2px solid transparent;
	padding: 12px 16px;
	font-size: 14px;
	color: #666;
	cursor: pointer;
	white-space: nowrap;
	transition: color .2s, border-color .2s;
}
.bc-tab:hover { color: #222; }
.bc-tab--active {
	color: #222;
	font-weight: 600;
	border-bottom-color: #222;
}

/* ── Search Bar ── */
.bc-search-bar {
	padding: 8px 20px;
	border-bottom: 1px solid #eee;
	flex-shrink: 0;
}
.bc-search-bar input {
	border: 1px solid #ddd;
	border-radius: 0;
	padding: 6px 12px;
	font-size: 13px;
	width: 100%;
	outline: none;
	transition: border-color .2s;
	box-sizing: border-box;
}
.bc-search-bar input:focus { border-color: #222; }

/* ── Content: Subcategory sidebar + Grid ── */
.bc-content {
	flex: 1;
	display: flex;
	overflow: hidden;
	min-height: 0;
}

.bc-subcategories {
	width: 90px;
	flex-shrink: 0;
	overflow-y: auto;
	border-right: 1px solid #eee;
	display: flex;
	flex-direction: column;
	padding: 8px 0;
}

.bc-subcat {
	display: block;
	width: 100%;
	background: none;
	border: none;
	padding: 10px 12px;
	font-size: 13px;
	color: #666;
	cursor: pointer;
	text-align: center;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	transition: color .2s, background .2s;
	border-radius: 0;
}
.bc-subcat:hover { color: #222; background: #fafafa; }
.bc-subcat--active {
	color: #222;
	font-weight: 600;
	background: #f5f5f5;
	position: relative;
}
.bc-subcat--active::after {
	content: '';
	position: absolute;
	right: 0;
	top: 50%;
	transform: translateY(-50%);
	width: 3px;
	height: 60%;
	background: #222;
}

/* ── Material Grid ── */
.bc-materials {
	flex: 1;
	overflow-y: auto;
	padding: 16px 12px;
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
	align-content: start;
}

.bc-materials__loading {
	grid-column: 1 / -1;
	text-align: center;
	padding: 40px;
	color: #999;
}

.bc-materials__empty {
	grid-column: 1 / -1;
	text-align: center;
	padding: 40px;
	color: #999;
	font-size: 14px;
}

.bc-material-card {
	background: #faf8f5;
	border-radius: 0;
	padding: 10px;
	text-align: center;
	cursor: pointer;
	transition: box-shadow .2s, transform .15s;
	border: 1px solid transparent;
}
.bc-material-card:hover {
	box-shadow: 0 2px 12px rgba(0,0,0,.1);
	transform: translateY(-2px);
}
.bc-material-card:active { transform: scale(.97); }

.bc-material-card__img {
	width: 60px;
	height: 60px;
	object-fit: cover;
	border-radius: 50%;
	margin: 0 auto 8px;
	display: block;
	background: #eee;
}

.bc-material-card__name {
	font-size: 12px;
	color: #333;
	margin: 0 0 2px;
	line-height: 1.3;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.bc-material-card__price {
	font-size: 12px;
	color: #c9a050;
	font-weight: 600;
}

.bc-material-card__size {
	font-size: 11px;
	color: #aaa;
	margin-top: 1px;
}

.bc-material-card__stock {
	font-size: 10px;
	color: #888;
	margin-top: 2px;
}

.bc-material-card--disabled {
	opacity: 0.42;
	cursor: not-allowed;
	pointer-events: none;
	filter: grayscale(60%);
}

.bc-material-card--disabled .bc-material-card__stock {
	color: #c00;
	font-weight: 600;
}

/* ── Pagination ── */
.bc-materials__pagination {
	padding: 10px 20px;
	text-align: center;
	flex-shrink: 0;
}

/* ── Footer ── */
.bc-modal__footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 24px;
	border-top: 1px solid #eee;
	flex-shrink: 0;
}

/* ── Buttons ── */
.bc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: none;
	border-radius: 0;
	padding: 10px 24px;
	font-size: 14px;
	cursor: pointer;
	transition: background .2s, opacity .2s;
}
.bc-btn--primary {
	background: #222;
	color: #fff;
}
.bc-btn--primary:hover { background: #444; }
.bc-btn--secondary {
	background: #f5f5f5;
	color: #666;
}
.bc-btn--secondary:hover { background: #e8e8e8; }
.bc-btn--outline {
	background: #fff;
	border: 1px solid #ddd;
	color: #666;
}
.bc-btn--outline:hover { border-color: #222; color: #222; }
.bc-btn--lg { padding: 12px 36px; font-size: 15px; font-weight: 600; }
.bc-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Trigger Button (product page) ── */
.bc-trigger-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	width: 100%;
	margin-top: 10px;
	padding: 12px 20px;
	background: #fff;
	color: #222;
	border: 2px solid #222;
	border-radius: 0;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: all .25s;
}
.bc-trigger-btn:hover {
	background: #222;
	color: #fff;
}

/* ═══════════════════════════════════════
   Responsive
   ═══════════════════════════════════════ */
@media (max-width: 860px) {
	.bc-modal {
		flex-direction: column;
		height: 100vh;
	}
	.bc-overlay { padding: 0; }

	/* Hide header, show preview close icon */
	.bc-modal__header { display: none; }
	.bc-preview__close { display: block; }

	.bc-preview {
		width: 100%;
		flex-shrink: 0;
		border-right: none;
		border-bottom: 1px solid #eee;
		padding: 12px 12px 8px;
		max-height: none;
		justify-content: flex-start;
		align-items: stretch;
	}

	/* Canvas (80%) + Stats (20%) side by side */
	.bc-preview__top {
		display: flex;
		align-items: center;
		gap: 8px;
	}
	.bc-preview__canvas-wrap {
		flex: 4;
		max-width: none;
		min-width: 0;
	}
	.bc-preview__stats {
		flex: 1;
		display: flex;
		flex-direction: column;
		gap: 6px;
		max-width: none;
		margin-top: 0;
	}
	.bc-stat {
		flex-direction: column;
		align-items: flex-start;
		gap: 1px;
	}
	.bc-stat__label { font-size: 10px; }
	.bc-stat__value { font-size: 12px; }

	/* Toolbar compact */
	.bc-toolbar {
		max-width: none;
		margin-top: 8px;
		grid-template-columns: repeat(5, 1fr);
		gap: 0;
	}
	.bc-toolbar__btn { font-size: 10px; padding: 6px 0; }
	.bc-toolbar__icon { width: 32px; height: 32px; }

	.bc-preview__hint { display: none; }

	.bc-right {
		flex: 1;
		min-height: 0;
	}
	.bc-subcategories { width: 70px; }
	.bc-subcat { font-size: 12px; padding: 8px 6px; }
	.bc-materials {
		grid-template-columns: repeat(3, 1fr);
	}

	/* Footer: full width */
	.bc-modal__footer {
		justify-content: space-between;
	}
	.bc-btn--lg { flex: 1; }

	.bc-wrist-panel { width: 95vw; padding: 20px; }
}

/* ── Toast Notification ── */
.bc-toast {
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 9999999;
	background: rgba(0, 0, 0, .72);
	color: #fff;
	padding: 14px 32px;
	border-radius: 0;
	font-size: 14px;
	line-height: 1.5;
	text-align: center;
	pointer-events: none;
	animation: bcToastIn .25s ease;
	max-width: 80vw;
}
.bc-toast--out {
	animation: bcToastOut .3s ease forwards;
}
@keyframes bcToastIn {
	from { opacity: 0; transform: translate(-50%, -50%) scale(.9); }
	to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes bcToastOut {
	from { opacity: 1; transform: translate(-50%, -50%) scale(1); }
	to   { opacity: 0; transform: translate(-50%, -50%) scale(.9); }
}
