/* ==========================================================================
   Quantity Tiers Pro - stiluri frontend
   Scrise defensiv (box-sizing propriu, fără dependență de reset-ul temei)
   ca să arate corect indiferent de tema/builder-ul folosit, pe orice
   dispozitiv, cu accent pe mobil (fără scroll orizontal, lățime 100%).
   ========================================================================== */

.qtp-price-table,
.qtp-price-table * {
	box-sizing: border-box;
}

.qtp-price-table {
	margin-top: var(--qtp-margin-top, 12px);
	margin-bottom: var(--qtp-margin-bottom, 12px);
	width: 100%;
	max-width: 100%;
	border: 1px solid var(--qtp-border-color, #e5e5e5);
	border-radius: var(--qtp-border-radius, 8px);
	overflow: hidden;
	font-size: var(--qtp-font-size, 14px);
	line-height: 1.4;
	color: var(--qtp-text-color, #333);
	background: var(--qtp-row-bg, #fff);
}

.qtp-price-table__title {
	padding: var(--qtp-cell-padding-v, 8px) var(--qtp-cell-padding-h, 14px);
	font-weight: 600;
	background: var(--qtp-header-bg, #f5f5f5);
	color: var(--qtp-header-color, #2c3e50);
	border-bottom: 1px solid var(--qtp-border-color, #e5e5e5);
	word-break: break-word;
}

/* Antetul tabelului: titlu (stânga) + cutia "preț de la" (dreapta), pe același rând,
   se rearanjează automat pe ecrane mici. */
.qtp-price-table__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 8px 14px;
	padding: var(--qtp-cell-padding-v, 8px) var(--qtp-cell-padding-h, 14px);
	background: var(--qtp-header-bg, #f5f5f5);
	border-bottom: 1px solid var(--qtp-border-color, #e5e5e5);
}

.qtp-price-table__header .qtp-price-table__title {
	padding: 0;
	background: none;
	border-bottom: none;
	flex: 1 1 auto;
	min-width: 0; /* permite trunchierea/wrap-ul textului lung în flex, în loc să împingă cutia în afara ecranului */
}

/* Wrapper de siguranță: în mod normal tabelul se încadrează mereu în 100% din lățimea
   containerului (table-layout: fixed + coloane procentuale + wrap de text mai jos), deci
   NU ar trebui să fie nevoie de scroll orizontal - overflow-ul rămâne doar ca plasă de
   siguranță, pentru cazuri extreme (text foarte lung netrunchiabil, ecrane sub 240px etc). */
.qtp-price-table__table-wrap {
	width: 100%;
	max-width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.qtp-price-table__table {
	width: 100%;
	max-width: 100%;
	border-collapse: collapse;
	table-layout: fixed; /* lățimi proporționale fixe, coloanele nu mai pot împinge tabelul peste ecran */
}

.qtp-price-table__table th:nth-child(1),
.qtp-price-table__table td:nth-child(1) {
	width: 34%;
}

.qtp-price-table__table th:nth-child(2),
.qtp-price-table__table td:nth-child(2) {
	width: 33%;
}

.qtp-price-table__table th:nth-child(3),
.qtp-price-table__table td:nth-child(3) {
	width: 33%;
}

.qtp-price-table__table thead th {
	text-align: left;
	padding: var(--qtp-cell-padding-v, 8px) var(--qtp-cell-padding-h, 14px);
	background: var(--qtp-columns-header-bg, #f5f5f5);
	color: var(--qtp-columns-header-color, #2c3e50);
	font-weight: 600;
	border-bottom: 1px solid var(--qtp-border-color, #e5e5e5);
	white-space: normal;
	word-break: break-word;
	overflow-wrap: break-word;
}

.qtp-price-table__table tbody td {
	padding: var(--qtp-cell-padding-v, 8px) var(--qtp-cell-padding-h, 14px);
	border-bottom: 1px solid var(--qtp-border-color, #e5e5e5);
	white-space: normal;
	word-break: break-word;
	overflow-wrap: break-word;
}

.qtp-price-table__row:nth-child(even) {
	background: var(--qtp-row-alt-bg, #fafafa);
}

.qtp-price-table__row:last-child td {
	border-bottom: none;
}

.qtp-price-table__row.qtp-active-row {
	background: var(--qtp-highlight-bg, #e8f6ec) !important;
	box-shadow: inset 3px 0 0 var(--qtp-highlight-border, #28a745);
	font-weight: 600;
}

/* Badge-ul clasic (shop/arhive/related), lipit de .price prin filtrul WooCommerce. */
.qtp-price-badge {
	display: inline-block;
	max-width: 100%;
	white-space: normal;
	word-break: break-word;
	font-size: 12px;
	color: #555;
	margin-top: 4px;
}

.qtp-variable-tables {
	max-width: 100%;
}

.qtp-variable-tables .qtp-variation-table {
	display: none;
	max-width: 100%;
}

/* Cutia "preț de la" din antetul tabelului - complet stilizabilă din admin via CSS variables. */
.qtp-from-box {
	flex: 0 1 auto;
	max-width: 100%;
	display: inline-flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 4px 6px;
	padding: var(--qtp-frombox-padding-v, 6px) var(--qtp-frombox-padding-h, 14px);
	background: var(--qtp-frombox-bg, #e8f6ec);
	border: var(--qtp-frombox-border-width, 1.5px) solid var(--qtp-frombox-border-color, #28a745);
	border-radius: var(--qtp-frombox-radius, 999px);
	line-height: 1.2;
}

.qtp-from-box__label {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	color: var(--qtp-frombox-label-color, #2c3e50);
	opacity: 0.75;
	white-space: nowrap;
}

.qtp-from-box__price {
	font-size: var(--qtp-frombox-font-size, 14px);
	font-weight: 700;
	color: var(--qtp-frombox-price-color, #28a745);
	word-break: break-word;
}

/* ==========================================================================
   Responsive - tablete și mobil
   ========================================================================== */

@media (max-width: 782px) {
	.qtp-price-table {
		font-size: calc(var(--qtp-font-size, 14px) - 1px);
	}
}

@media (max-width: 600px) {
	.qtp-price-table__header {
		flex-direction: column;
		align-items: flex-start;
	}

	.qtp-from-box {
		align-self: stretch;
		justify-content: center;
	}

	.qtp-price-table__table thead th,
	.qtp-price-table__table tbody td {
		padding: calc(var(--qtp-cell-padding-v, 8px) - 1px) calc(var(--qtp-cell-padding-h, 14px) * 0.6);
		font-size: 0.92em;
	}
}

@media (max-width: 380px) {
	.qtp-price-table__table thead th,
	.qtp-price-table__table tbody td {
		padding: calc(var(--qtp-cell-padding-v, 8px) - 2px) calc(var(--qtp-cell-padding-h, 14px) * 0.45);
		font-size: 0.85em;
	}

	.qtp-from-box__price {
		font-size: 13px;
	}

	.qtp-price-table__title,
	.qtp-price-table__header {
		padding: 8px 10px;
	}
}
