/* =============================================================================
   WC Tier Pricing — Frontend Widget Styles
   Compatible with WoodMart theme — no hardcoded colors, no global overrides.
   ============================================================================= */

/* Hide native WC quantity input when tier widget is active */
.wc-tier-active-product form.cart .quantity {
	display: none !important;
}

/* =============================================================================
   Widget wrapper
   ============================================================================= */

.wc-tier-widget {
	margin: 0 0 20px;
	font-size: 1em;
}

/* =============================================================================
   Section title
   ============================================================================= */

.wc-tier-section-title {
	font-size: 1em;
	font-weight: 600;
	margin: 0 0 12px;
	color: inherit;
}

/* =============================================================================
   Cards grid
   ============================================================================= */

.wc-tier-cards-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
	gap: 10px;
	max-width: 100%;
	margin-bottom: 16px;
}

/* =============================================================================
   Individual card
   ============================================================================= */

.tier-card {
	position: relative;
	border: 2px solid var(--wc-tier-border, #e0e0e0);
	border-radius: 8px;
	padding: 14px 10px 10px;
	cursor: pointer;
	background: var(--wc-tier-card-bg, #fff);
	text-align: center;
	transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
	user-select: none;
	outline: none;
	-webkit-tap-highlight-color: transparent;
}

.tier-card:hover {
	border-color: var(--wc-tier-accent, currentColor);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tier-card.is-active {
	border-color: var(--wc-tier-accent, currentColor);
	background: var(--wc-tier-active-bg, rgba(0, 0, 0, 0.03));
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.10);
}

.tier-card:focus-visible {
	box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.15);
}

/* --- Checkmark (visible only when active) --- */
.tier-card-check {
	position: absolute;
	top: 6px;
	right: 8px;
	font-size: 11px;
	font-weight: 700;
	color: var(--wc-tier-accent, currentColor);
	opacity: 0;
	transition: opacity 0.15s;
	line-height: 1;
}

.tier-card.is-active .tier-card-check {
	opacity: 1;
}

/* --- Badge (pill, floats above card top border) --- */
.tier-card-badge {
	display: inline-block;
	position: absolute;
	top: -11px;
	left: 50%;
	transform: translateX(-50%);
	background: var(--wc-tier-accent, currentColor);
	color: #fff;
	font-size: 10px;
	font-weight: 600;
	padding: 2px 9px;
	border-radius: 20px;
	white-space: nowrap;
	line-height: 1.4;
	pointer-events: none;
}

.tier-card-badge:empty {
	display: none;
}

/* --- Icon / emoji --- */
.tier-card-icon {
	display: block;
	font-size: 22px;
	margin-bottom: 5px;
	line-height: 1;
}

/* --- Quantity range text --- */
.tier-card-range {
	display: block;
	font-size: 0.78em;
	color: var(--wc-tier-muted, #777);
	margin-bottom: 4px;
	line-height: 1.2;
}

/* --- Main price --- */
.tier-card-price {
	display: block;
	font-size: 1em;
	font-weight: 700;
	color: inherit;
	line-height: 1.3;
}

.tier-card-price .woocommerce-Price-amount {
	font-weight: 700;
}

/* Price type label (c/u, total, /grupo) */
.tier-price-type {
	display: inline;
	font-size: 0.72em;
	font-weight: 400;
	color: var(--wc-tier-muted, #777);
}

/* --- Per-unit breakdown for 'total' type tiers --- */
.tier-card-unit-price {
	display: block;
	font-size: 0.7em;
	color: var(--wc-tier-muted, #888);
	margin-top: 3px;
}

/* --- Card sub-label --- */
.tier-card-label {
	display: block;
	font-size: 0.7em;
	color: var(--wc-tier-muted, #888);
	margin-top: 4px;
}

/* --- Saving chip --- */
.tier-card-saving-chip {
	display: inline-block;
	background: #e8f5e9;
	color: #388e3c;
	border-radius: 12px;
	font-size: 0.68em;
	font-weight: 600;
	padding: 2px 7px;
	margin-top: 5px;
}

/* =============================================================================
   Summary bar
   ============================================================================= */

.wc-tier-summary-bar {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 14px;
	background: var(--wc-tier-summary-bg, rgba(0, 0, 0, 0.03));
	border: 1px solid var(--wc-tier-border, #e0e0e0);
	border-radius: 8px;
	flex-wrap: wrap;
	margin-bottom: 10px;
}

.wc-tier-summary-info {
	flex: 1;
	font-size: 0.85em;
	color: var(--wc-tier-muted, #666);
	min-width: 80px;
}

.wc-tier-summary-tier-name {
	font-weight: 600;
	color: inherit;
}

/* --- Quantity control --- */
.wc-tier-qty-control {
	display: inline-flex;
	align-items: center;
	border: 1px solid var(--wc-tier-border, #ddd);
	border-radius: 6px;
	overflow: hidden;
	background: #fff;
	flex-shrink: 0;
}

.wc-tier-qty-minus,
.wc-tier-qty-plus {
	background: none;
	border: none;
	padding: 6px 11px;
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
	color: inherit;
	transition: background 0.1s;
	touch-action: manipulation;
}

.wc-tier-qty-minus:hover,
.wc-tier-qty-plus:hover {
	background: var(--wc-tier-active-bg, rgba(0, 0, 0, 0.05));
}

.wc-tier-qty-input {
	border: none;
	border-left: 1px solid var(--wc-tier-border, #ddd);
	border-right: 1px solid var(--wc-tier-border, #ddd);
	width: 46px;
	text-align: center;
	font-size: 14px;
	padding: 6px 4px;
	-moz-appearance: textfield;
	background: transparent;
}

.wc-tier-qty-input::-webkit-inner-spin-button,
.wc-tier-qty-input::-webkit-outer-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.wc-tier-qty-input:focus {
	outline: none;
	background: rgba(255, 255, 150, 0.25);
}

/* --- Total amount --- */
.wc-tier-summary-total {
	font-size: 1.1em;
	font-weight: 700;
	color: inherit;
	white-space: nowrap;
	flex-shrink: 0;
}

.wc-tier-summary-total .woocommerce-Price-amount {
	font-weight: 700;
	font-size: inherit;
}

/* =============================================================================
   Savings message
   ============================================================================= */

.wc-tier-savings-message {
	padding: 8px 14px;
	background: #e8f5e9;
	color: #2e7d32;
	border-radius: 6px;
	font-size: 0.85em;
	font-weight: 500;
	margin-bottom: 10px;
}

/* =============================================================================
   Price table
   ============================================================================= */

.wc-tier-price-table-wrap {
	margin-top: 12px;
	overflow-x: auto;
}

.wc-tier-price-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.85em;
}

.wc-tier-price-table th,
.wc-tier-price-table td {
	padding: 7px 12px;
	text-align: left;
	border-bottom: 1px solid var(--wc-tier-border, #ececec);
}

.wc-tier-price-table th {
	font-weight: 600;
	color: var(--wc-tier-muted, #666);
	background: var(--wc-tier-summary-bg, rgba(0, 0, 0, 0.03));
	font-size: 0.93em;
}

.wc-tier-price-table tr.is-active td {
	background: var(--wc-tier-active-bg, rgba(0, 0, 0, 0.03));
	font-weight: 600;
}

.wc-tier-table-saving {
	display: inline-block;
	background: #e8f5e9;
	color: #388e3c;
	border-radius: 10px;
	font-size: 0.9em;
	font-weight: 600;
	padding: 2px 7px;
}

/* =============================================================================
   Responsive
   ============================================================================= */

@media (max-width: 480px) {
	.wc-tier-cards-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.wc-tier-summary-bar {
		flex-direction: column;
		align-items: stretch;
		text-align: center;
		gap: 8px;
	}

	.wc-tier-summary-info {
		text-align: center;
	}

	.wc-tier-qty-control {
		justify-content: center;
		align-self: center;
	}

	.wc-tier-summary-total {
		text-align: center;
	}
}

@media (max-width: 360px) {
	.wc-tier-cards-grid {
		grid-template-columns: 1fr;
	}
}

/* Sticky summary bar on mobile when there are 4+ tiers */
@media (max-width: 768px) {
	.wc-tier-widget[data-tier-count="4"] .wc-tier-summary-bar,
	.wc-tier-widget[data-tier-count="5"] .wc-tier-summary-bar,
	.wc-tier-widget[data-tier-count="6"] .wc-tier-summary-bar,
	.wc-tier-widget[data-tier-count="7"] .wc-tier-summary-bar,
	.wc-tier-widget[data-tier-count="8"] .wc-tier-summary-bar {
		position: sticky;
		bottom: 0;
		z-index: 10;
		box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.12);
	}
}
