/**
 * Design 1:1 podle btms-repeater-prototype.html (2026-08-14) — SafeRange
 * premium engineering paleta (Carbon × Technical Silver × SafeRange Bronze).
 * Všechny třídy prefixované btms- (prototyp měl krátké obecné názvy jako
 * .panel/.btn — tady jsou namespacované, ať nekolidují s tématem/pluginy).
 * Custom properties scoped na .btms-builder, ne na :root, ze stejného
 * důvodu.
 */

.btms-builder {
	--carbon: #17191B;
	--gunmetal: #303438;
	--silver: #A7ADB2;
	--silver-light: #D8DADD;
	--bronze: #B9864F;
	--bronze-dark: #956A38;
	--bronze-soft: #F4EBDD;
	--bronze-light: #D2AA76;

	--bg: #F5F3EF;
	--panel: #ffffff;
	--ink: #17191B;
	--ink-soft: #62676B;
	--line: #D8DADD;
	--line-strong: #A7ADB2;

	--steel: #303438;
	--steel-hover: #17191B;
	--brass: #B9864F;
	--brass-hover: #956A38;
	--brass-soft: #F4EBDD;

	--success: #397A51;
	--ok-bg: #EEF4EF;
	--mono: ui-monospace, SFMono-Regular, "Roboto Mono", Menlo, Consolas, monospace;

	max-width: 760px;
	font-size: 1rem;
	line-height: 1.45;
	color: var(--ink);
}

.btms-builder *,
.btms-builder *::before,
.btms-builder *::after {
	box-sizing: border-box;
}

/* ---- Název sestavy (nepovinné, statické pole mimo render()) ---- */

.btms-unit-name-field {
	margin: 0 0 16px;
}

.btms-unit-name-field label {
	display: block;
	font-size: 0.85rem;
	color: var(--ink-soft);
	margin-bottom: 0.3em;
}

.btms-input {
	display: block;
	width: 100%;
	max-width: 420px;
	padding: 0.6em 0.8em;
	border: 1.5px solid var(--line-strong);
	border-radius: 6px;
	font-size: 1rem;
	font-family: inherit;
	box-sizing: border-box;
	background: #fff;
	color: var(--ink);
}

.btms-input:focus {
	outline: none;
	border-color: var(--steel);
}

/* ---- Panel (řádek sestavy) ---- */

.btms-panel {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 10px;
	padding: 24px;
	margin-bottom: 16px;
}

.btms-row-label {
	font-size: 13px;
	font-weight: 600;
	color: var(--steel);
	margin-bottom: 10px;
	display: flex;
	align-items: baseline;
	gap: 6px;
	flex-wrap: wrap;
}

.btms-raze-name {
	font-weight: 700;
	color: var(--brass-hover);
}

.btms-row-naboj {
	font-size: 13px;
	color: var(--ink-soft);
	margin: -4px 0 12px;
}

.btms-picker__hint {
	font-size: 14px;
	color: var(--steel);
	margin: 0 0 12px;
}

.btms-hero-img-wrap {
	max-width: 340px;
	margin: 0 auto 18px;
}

.btms-hero-img {
	width: 100%;
	display: block;
	border-radius: 6px;
}

/* ---- Vyhledávání náboje ---- */

.btms-search-field {
	position: relative;
	max-width: 420px;
}

.btms-search-field input {
	width: 100%;
	font-size: 15px;
	padding: 11px 14px;
	border: 1.5px solid var(--line-strong);
	border-radius: 6px;
	font-family: inherit;
	background: #fff;
	color: var(--ink);
}

.btms-search-field input:focus {
	outline: none;
	border-color: var(--steel);
}

.btms-tooltip {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	background: var(--steel);
	color: #fff;
	font-size: 12.5px;
	padding: 8px 11px;
	border-radius: 6px;
	max-width: 320px;
	z-index: 20;
	box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
	pointer-events: none;
	opacity: 0;
	visibility: hidden;
	transition: opacity .12s ease;
}

/* Čistě CSS řízené — žádný JS re-render na focus. */
.btms-search-field input:focus:placeholder-shown ~ .btms-tooltip {
	opacity: 1;
	visibility: visible;
}

.btms-tooltip::before {
	content: "";
	position: absolute;
	top: -5px;
	left: 16px;
	border: 5px solid transparent;
	border-bottom-color: var(--steel);
}

.btms-dropdown {
	position: absolute;
	top: calc(100% + 2px);
	left: 0;
	right: 0;
	background: #fff;
	border: 1px solid var(--line-strong);
	border-radius: 6px;
	box-shadow: 0 8px 20px rgba(0, 0, 0, .10);
	max-height: 260px;
	overflow-y: auto;
	z-index: 15;
}

.btms-dropdown-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 10px 14px;
	cursor: pointer;
	font-size: 14px;
	border-bottom: 1px solid #f0f0ee;
}

.btms-dropdown-item:last-child {
	border-bottom: none;
}

.btms-dropdown-item:hover,
.btms-dropdown-item.btms-dropdown-item--active {
	background: var(--brass-soft);
}

.btms-alt-name {
	color: var(--ink-soft);
	font-size: 12px;
	margin-left: 6px;
}

.btms-dropdown-empty {
	padding: 12px 14px;
	font-size: 13.5px;
	color: var(--ink-soft);
}

.btms-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.5em;
	height: 1.5em;
	flex-shrink: 0;
	border-radius: 50%;
	font-size: 0.75rem;
	font-weight: bold;
}

.btms-badge--ok {
	background: #e6f4ea;
	color: #1e7e34;
}

.btms-badge--check {
	background: #fff4e5;
	color: #b25e00;
}

/* ---- Detail náboje (fáze2/4) ---- */

.btms-detail-card {
	margin-top: 18px;
	border: 1px solid var(--line);
	border-radius: 8px;
	padding: 18px;
	background: #fbfbfa;
	position: relative;
	animation: btms-fade-in .15s ease;
}

@keyframes btms-fade-in {
	from { opacity: 0; transform: translateY(-4px); }
	to { opacity: 1; transform: none; }
}

.btms-detail-close {
	position: absolute;
	top: 10px;
	right: 12px;
	border: none;
	background: none;
	font-size: 18px;
	color: var(--ink-soft);
	cursor: pointer;
	line-height: 1;
	padding: 4px;
}

.btms-detail-close:hover {
	color: var(--ink);
}

.btms-detail-loading {
	color: var(--ink-soft);
	font-size: 14px;
	padding: 12px 0;
}

.btms-detail-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 16px;
}

@media (min-width: 600px) {
	.btms-detail-grid {
		grid-template-columns: 1.1fr 1fr;
	}
}

.btms-nakres-svg,
.btms-nakres-img {
	width: 100%;
	height: auto;
	max-height: 260px;
	object-fit: contain;
	background: #fff;
	border: 1px solid var(--line);
	border-radius: 6px;
}

.btms-spec-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
}

.btms-spec-table tr {
	border-bottom: 1px solid var(--line);
}

.btms-spec-table tr:last-child {
	border-bottom: none;
}

.btms-spec-table td {
	padding: 7px 4px;
}

.btms-spec-table td:first-child {
	color: var(--ink-soft);
	width: 52%;
}

.btms-spec-table td:last-child {
	font-family: var(--mono);
	font-weight: 600;
	text-align: right;
}

.btms-availability {
	margin-top: 12px;
	font-size: 13px;
	font-weight: 600;
}

.btms-availability--ok {
	color: #1e7e34;
}

.btms-availability--ok::before {
	content: '✓ ';
}

.btms-availability--check {
	color: #b25e00;
}

/* ---- Vlastní náboj (fallback, mimo katalog) ---- */

.btms-naboj-custom {
	margin-top: 14px;
	border: 1px solid var(--line);
	border-radius: 8px;
	padding: 18px;
	background: #fbfbfa;
}

.btms-field-label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: var(--steel);
	margin-bottom: 12px;
}

.btms-field-label input[type="text"] {
	display: block;
	width: 100%;
	font-size: 15px;
	font-weight: 400;
	color: var(--ink);
	padding: 10px 12px;
	margin-top: 6px;
	border: 1.5px solid var(--line-strong);
	border-radius: 6px;
	font-family: inherit;
	background: #fff;
}

.btms-field-label input[type="text"]:focus {
	outline: none;
	border-color: var(--steel);
}

.btms-field-label input[type="file"] {
	display: block;
	margin-top: 6px;
	font-size: 13px;
}

.btms-naboj-photos {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 4px 0 12px;
}

.btms-naboj-photo {
	position: relative;
	display: block;
	width: 72px;
	height: 72px;
}

.btms-naboj-photo img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 6px;
	border: 1px solid var(--line);
	display: block;
}

.btms-naboj-photo-remove {
	position: absolute;
	top: -6px;
	right: -6px;
	border: 1px solid var(--line-strong);
	background: #fff;
	color: var(--ink-soft);
	font-size: 10.5px;
	line-height: 1;
	padding: 3px 5px;
	border-radius: 10px;
	cursor: pointer;
}

.btms-naboj-photo-remove:hover {
	color: var(--ink);
}

/* ---- Tlačítka ---- */

.btms-btn {
	border: none;
	border-radius: 6px;
	font-size: 14.5px;
	font-weight: 600;
	padding: 12px 20px;
	cursor: pointer;
	font-family: inherit;
	transition: background .12s ease;
}

.btms-btn:disabled {
	opacity: .6;
	cursor: not-allowed;
}

.btms-btn-confirm {
	background: var(--brass);
	color: #fff;
	width: 100%;
	margin-top: 16px;
}

.btms-btn-confirm:hover {
	background: var(--brass-hover);
}

.btms-btn-confirm:disabled {
	background: #d8d3c8;
}

.btms-btn-secondary {
	background: #fff;
	color: var(--steel);
	border: 1.5px solid var(--steel);
}

.btms-btn-secondary:hover {
	background: #eef1f2;
}

.btms-btn-dark {
	background: var(--steel);
	color: #fff;
	text-decoration: none;
	text-align: center;
	display: inline-block;
}

.btms-btn-dark:hover {
	background: var(--steel-hover);
}

.btms-btn-ghost {
	background: none;
	color: var(--ink-soft);
	font-size: 12.5px;
	text-decoration: underline;
	padding: 4px 0;
}

.btms-naboj-not-found-link {
	display: block;
	margin-bottom: 10px;
}

/* ---- Volby (fáze3/5) ---- */

.btms-rada-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
	margin-top: 14px;
}

.btms-rada-card {
	display: block;
	border: 1.5px solid var(--line);
	border-radius: 8px;
	padding: 11px 13px;
	cursor: pointer;
	transition: border-color .12s ease, background .12s ease;
}

.btms-rada-card--selected {
	border-color: var(--brass);
	background: var(--brass-soft);
}

.btms-rada-card-head {
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 600;
	font-size: 14px;
}

.btms-rada-card-head input {
	width: 16px;
	height: 16px;
	accent-color: var(--brass);
	cursor: pointer;
	flex-shrink: 0;
}

.btms-addons-row {
	display: flex;
	flex-wrap: wrap;
	gap: 12px 22px;
	margin-top: 16px;
	padding-top: 14px;
	border-top: 1px solid var(--line);
}

.btms-addon-item {
	display: block;
	flex: 1 1 150px;
	min-width: 140px;
	cursor: pointer;
}

.btms-addon-head {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13.5px;
}

.btms-addon-head input {
	width: 16px;
	height: 16px;
	accent-color: var(--brass);
	cursor: pointer;
	flex-shrink: 0;
}

.btms-opt-price {
	display: block;
	margin-top: 5px;
	margin-left: 24px;
	font-family: var(--mono);
	font-size: 12.5px;
	color: var(--ink-soft);
}

.btms-opt-price--shared {
	color: var(--success);
	font-weight: 600;
}

.btms-breakdown-line {
	margin-top: 10px;
	font-size: 12px;
	color: var(--ink-soft);
	font-family: var(--mono);
}

.btms-hint-line {
	margin-top: 12px;
	font-size: 12.5px;
	color: var(--brass-hover);
	background: var(--brass-soft);
	border-radius: 6px;
	padding: 8px 11px;
}

.btms-row-total {
	margin-top: 16px;
	padding-top: 14px;
	border-top: 1px solid var(--line);
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	font-size: 14px;
}

.btms-row-total__val {
	font-family: var(--mono);
	font-size: 18px;
	font-weight: 700;
	color: var(--steel);
}

/* ---- Přidat funkcionalitu / celková cena / footer ---- */

.btms-add-funkcionalita {
	display: block;
	width: 100%;
	margin: 6px 0 16px;
	padding: 13px;
	background: var(--brass-soft);
	color: var(--brass-hover);
	border: 1.5px solid var(--brass);
	border-radius: 7px;
	font-weight: 600;
	font-size: 14.5px;
	cursor: pointer;
	font-family: inherit;
}

.btms-add-funkcionalita:hover {
	background: #eeddc0;
}

.btms-grand-total {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	padding: 16px 24px;
	background: var(--carbon);
	color: var(--bg);
	border-radius: 10px;
	margin-bottom: 14px;
}

.btms-grand-total__label {
	font-size: 14px;
	opacity: .85;
}

.btms-grand-total__val {
	font-family: var(--mono);
	font-size: 26px;
	font-weight: 700;
	color: var(--bronze-light);
}

.btms-footer-actions {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
}

.btms-footer-actions .btms-btn {
	flex: 1;
	min-width: 180px;
	text-align: center;
}

.btms-btn-cart {
	background: #FFC000;
	color: #FF0000;
}

.btms-btn-cart:hover {
	background: #e6ac00;
}

.btms-btn-cart:disabled {
	background: #FFC000;
	color: #FF0000;
	opacity: .45;
}

.btms-row-sep {
	height: 1px;
	background: var(--line);
	margin: 0 0 16px;
}

/* ---- Hotovo (po odeslání do košíku) ---- */

.btms-done-message {
	font-size: 1.1rem;
	margin: 0 0 16px;
}

/* ---- Chyba ---- */

.btms-error {
	margin-top: 1rem;
	padding: .8em 1em;
	border-radius: 4px;
	background: #fdecea;
	color: #a12622;
	border: 1px solid #f5c6cb;
}
