/**
 * Shrike Packs
 *
 * Square selectable cards. Built for the dark ShrikeFi product page
 * (--theme-text-color is #fff there), using the same palette as the sticky bar:
 *   text        #F4F5F8
 *   borders     #6F6F6F
 *   muted       #aaaaaa
 *   accent      #4caf50  (same green the stock label already uses)
 */

.shpk-wrap {
	--shpk-text: #f4f5f8;
	--shpk-muted: #aaaaaa;
	--shpk-border: #6f6f6f;
	--shpk-border-active: #f4f5f8;
	--shpk-accent: #4caf50;
	--shpk-fill: rgba(244, 245, 248, 0.06);

	margin: 22px 0;
}

.shpk-title {
	margin: 0 0 10px;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.6px;
	text-transform: uppercase;
	color: var(--shpk-text);
}

/**
 * Equal-width, equal-height cards.
 *
 * Grid rather than flex-wrap: with flex, a card that wrapped onto its own row
 * grew to the full container width, which is why "Pack of 3" looked bigger than
 * the others. Fixed columns keep every card identical at all widths.
 */
.shpk-options {
	display: grid;
	grid-template-columns: repeat(var(--shpk-cols, 3), minmax(0, 1fr));
	gap: 12px;
	align-items: stretch;
}

/* Square card */
.shpk-option {
	position: relative;
	min-width: 0;
	height: 100%;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	gap: 10px;
	padding: 14px;
	border: 1px solid var(--shpk-border);
	border-radius: 4px;
	background: transparent;
	color: var(--shpk-text);
	cursor: pointer;
	transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
	-webkit-tap-highlight-color: transparent;
	box-sizing: border-box;
}

.shpk-option:hover {
	border-color: var(--shpk-border-active);
	background: var(--shpk-fill);
}

.shpk-option.is-selected {
	border-color: var(--shpk-border-active);
	background: var(--shpk-fill);
	box-shadow: inset 0 0 0 1px var(--shpk-border-active);
}

/* Keyboard focus */
.shpk-option input[type='radio'] {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.shpk-option input[type='radio']:focus-visible + .shpk-option-top .shpk-dot {
	outline: 2px solid var(--shpk-border-active);
	outline-offset: 2px;
}

/* Label row with the radio dot */
.shpk-option-top {
	display: flex;
	align-items: center;
	gap: 8px;
}

.shpk-dot {
	flex-shrink: 0;
	width: 15px;
	height: 15px;
	border: 1px solid var(--shpk-border);
	border-radius: 50%;
	background: transparent;
	transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.shpk-option.is-selected .shpk-dot {
	border-color: var(--shpk-border-active);
	box-shadow: inset 0 0 0 4px var(--shpk-border-active);
}

.shpk-option-label {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.25;
	color: var(--shpk-text);
}

/* Price block */
.shpk-option-price {
	display: flex;
	flex-direction: column;
	gap: 1px;
	line-height: 1.2;
}

.shpk-option-price ins {
	text-decoration: none;
	font-size: 19px;
	font-weight: 700;
	color: var(--shpk-text);
}

.shpk-option-price del {
	font-size: 12px;
	font-weight: 400;
	color: var(--shpk-muted);
	text-decoration: line-through;
}

/* Invisible stand-in so cards without a saving keep the same two-line
   price block, and every price sits on the same baseline. */
.shpk-option-price del.shpk-was-empty {
	visibility: hidden;
	text-decoration: none;
}

/* Force the nested WooCommerce price markup to inherit, otherwise the theme
   palette colours it (this is what made prices show up blue elsewhere). */
.shpk-option-price ins,
.shpk-option-price ins *,
.shpk-option-price del,
.shpk-option-price del * {
	color: inherit !important;
}

/* Saving badge. The empty variant keeps all cards the same height. */
.shpk-option-badge {
	align-self: flex-start;
	padding: 3px 8px;
	border-radius: 2px;
	background: rgba(76, 175, 80, 0.14);
	color: var(--shpk-accent);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.4px;
	text-transform: uppercase;
	white-space: nowrap;
}

.shpk-option-badge--empty {
	background: transparent;
	padding: 3px 0;
}

.shpk-option-badge--empty::after {
	content: '\00a0';
}

.shpk-note {
	margin: 12px 0 0;
	font-size: 12px;
	line-height: 1.5;
	color: var(--shpk-muted);
}

.shpk-note a {
	color: var(--shpk-text);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.shpk-note a:hover,
.shpk-note a:focus {
	color: var(--shpk-text);
	opacity: 0.8;
}

/* Pack total shown in the sticky footer bar */
.shpk-bar-was {
	margin-left: 6px;
	font-size: 12px;
	font-weight: 400;
	color: var(--shpk-muted, #aaa);
	text-decoration: line-through;
}

@media (max-width: 600px) {
	.shpk-options {
		grid-template-columns: 1fr;
		gap: 8px;
	}

	.shpk-option {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		padding: 12px 14px;
	}

	.shpk-option-price {
		align-items: flex-end;
		margin-left: auto;
	}

	.shpk-option-price ins {
		font-size: 17px;
	}

	.shpk-option-price del.shpk-was-empty {
		display: none;
	}

	.shpk-option-badge {
		align-self: center;
		order: 3;
	}

	.shpk-option-badge--empty {
		display: none;
	}
}

/* ------------------------------------------------------------------
 * Admin
 * --------------------------------------------------------------- */

#shpk_panel .shpk-heading {
	margin: 12px 12px 4px;
	font-size: 14px;
}

#shpk_panel .shpk-help {
	margin: 0 12px 10px;
	max-width: 760px;
	font-size: 12px;
	color: #555;
}

#shpk_panel .shpk-table {
	margin: 0 12px 8px;
	width: calc(100% - 24px);
}

#shpk_panel .shpk-table input[type='text'] {
	width: 100%;
}

#shpk_panel .shpk-table input[type='number'] {
	width: 90px;
}

#shpk_panel .shpk-variations {
	margin: 0 12px 12px;
}

#shpk_panel .shpk-variations li {
	margin-bottom: 6px;
}

/**
 * WooCommerce's panel CSS applies
 *   .woocommerce_options_panel label { float:left; width:150px; margin-left:-150px }
 * to every label in a product data panel, which drags these rows off the left
 * edge and clamps them to 150px, leaving the checkboxes unreachable. Undo it.
 */
#shpk_panel .shpk-variations label {
	float: none !important;
	width: auto !important;
	margin: 0 !important;
	padding: 4px 0 !important;
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
	line-height: 1.5;
	cursor: pointer;
}

#shpk_panel .shpk-variations label input[type='checkbox'] {
	flex-shrink: 0;
	width: 18px;
	height: 18px;
	margin: 0 !important;
}

#shpk_panel .shpk-variations label:hover {
	background: #f6f7f7;
}

#shpk_panel .shpk-variations code {
	font-size: 11px;
	color: #777;
}

#shpk_panel .shpk-sig {
	color: #999;
	background: #f6f7f7;
}

#shpk_panel .shpk-warning {
	margin: 0 12px 12px;
	max-width: 760px;
	padding: 10px 12px;
	background: #fcf5e6;
	border-left: 4px solid #dba617;
	font-size: 12px;
	line-height: 1.6;
	color: #6a4c00;
}

/* Formula / calculation table */

#shpk_panel .shpk-formula {
	margin: 0 12px 8px;
	width: calc(100% - 24px);
}

#shpk_panel .shpk-formula th {
	font-weight: 600;
	font-size: 12px;
}

#shpk_panel .shpk-formula td {
	vertical-align: top;
	padding: 8px 10px;
}

#shpk_panel .shpk-formula code {
	font-size: 11px;
	color: #777;
}

#shpk_panel .shpk-dim {
	font-weight: 400;
	color: #888;
}

#shpk_panel .shpk-calc {
	font-size: 12px;
	line-height: 1.5;
	color: #555;
	white-space: nowrap;
}

#shpk_panel .shpk-formula-line {
	display: block;
	font-family: Consolas, Monaco, monospace;
}

#shpk_panel .shpk-final {
	display: block;
	margin-top: 3px;
	font-size: 13px;
	color: #111;
}

#shpk_panel .shpk-final.is-override {
	color: #8a4b00;
}

#shpk_panel .shpk-final.is-override::after {
	content: ' (override)';
	font-weight: 400;
	font-size: 11px;
	color: #a0752f;
}

#shpk_panel .shpk-zone-input {
	width: 92px;
	margin-top: 6px;
}
