/* Illusion Gift Card - product page fields.
   Deliberately quiet: it borrows the theme's fonts and colours and only owns
   spacing, the amount buttons and the field grid.

   Two things are NOT here on purpose - the custom amount toggle and the mobile
   form.cart override live in IGC_Frontend::critical_css(), printed inline next
   to the markup. That keeps them working when a cache plugin loads this file
   asynchronously, and puts them after the theme's stylesheets in the cascade. */

.igc-fields {
	--igc-line: rgba(0, 0, 0, .16);
	--igc-line-strong: rgba(0, 0, 0, .38);
	--igc-radius: 8px;
	--igc-gap: 14px;
	--igc-selected-bg: #111;
	--igc-selected-fg: #fff;

	margin: 0 0 26px;
	clear: both;
}

.igc-block + .igc-block {
	margin-top: 26px;
}

.igc-legend {
	display: block;
	margin-bottom: 10px;
	font-weight: 600;
	line-height: 1.4;
}

/* --- card designs ------------------------------------------------------- */

.igc-designs {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
	gap: 10px;
}

.igc-design {
	position: relative;
	margin: 0;
	cursor: pointer;
}

.igc-design input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}

.igc-design__media {
	display: block;
	border: 2px solid var(--igc-line);
	border-radius: var(--igc-radius);
	padding: 3px;
	transition: border-color .15s ease, box-shadow .15s ease;
}

.igc-design__media img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 8 / 5;
	object-fit: cover;
	border-radius: calc(var(--igc-radius) - 3px);
}

.igc-design:hover .igc-design__media {
	border-color: var(--igc-line-strong);
}

.igc-design input:checked ~ .igc-design__media {
	border-color: var(--igc-selected-bg);
	box-shadow: 0 0 0 1px var(--igc-selected-bg);
}

.igc-design input:focus-visible ~ .igc-design__media {
	outline: 2px solid var(--igc-selected-bg);
	outline-offset: 2px;
}

.igc-design__label {
	display: block;
	margin-top: 6px;
	text-align: center;
	font-size: .88em;
	line-height: 1.3;
}

.igc-design input:checked ~ .igc-design__label {
	font-weight: 600;
}

/* --- amounts ------------------------------------------------------------ */

.igc-amounts {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.igc-amount {
	position: relative;
	margin: 0;
	flex: 1 1 auto;
	min-width: 92px;
}

.igc-amount input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}

.igc-amount span {
	display: block;
	padding: 13px 16px;
	border: 1px solid var(--igc-line);
	border-radius: var(--igc-radius);
	text-align: center;
	line-height: 1.2;
	white-space: nowrap;
	cursor: pointer;
	transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}

.igc-amount span:hover {
	border-color: var(--igc-line-strong);
}

.igc-amount input:checked ~ span {
	background: var(--igc-selected-bg);
	border-color: var(--igc-selected-bg);
	color: var(--igc-selected-fg);
	font-weight: 600;
}

.igc-amount input:focus-visible ~ span {
	outline: 2px solid var(--igc-selected-bg);
	outline-offset: 2px;
}

.igc-custom-wrap {
	margin-top: 12px;
	max-width: 260px;
}

/* The custom amount box is toggled by CSS, not JS, so a cache plugin that
   defers or delays scripts cannot leave it hanging open. Browsers without
   :has() simply keep it visible, which still works. */
@supports selector(:has(*)) {

	.igc-block--amount .igc-custom-wrap {
		display: none;
	}

	.igc-block--amount:has( .igc-amount--custom input:checked ) .igc-custom-wrap,
	.igc-block--amount .igc-custom-wrap.is-visible {
		display: block;
	}
}

.igc-custom-input {
	width: 100%;
}

.igc-hint {
	display: block;
	margin-top: 6px;
	opacity: .7;
	font-size: .85em;
}

.igc-total {
	margin: 12px 0 0;
	font-weight: 600;
}

.igc-total:empty {
	display: none;
}

/* --- recipient fields --------------------------------------------------- */

.igc-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--igc-gap);
}

.igc-field {
	margin: 0;
}

.igc-field--wide {
	grid-column: 1 / -1;
}

.igc-field label {
	display: block;
	margin-bottom: 6px;
	font-size: .92em;
	line-height: 1.3;
}

.igc-field input,
.igc-field textarea {
	width: 100%;
	box-sizing: border-box;
}

.igc-field textarea {
	resize: vertical;
	min-height: 92px;
}

.igc-field abbr.required {
	border: 0;
	text-decoration: none;
	color: #c0392b;
}

.igc-phone {
	display: flex;
	align-items: stretch;
	gap: 8px;
	/* A phone number always reads left to right: country first, then the number,
	   even on an Arabic store. Only this row is forced - the label, the error
	   and the country list below stay in the page direction. */
	direction: ltr;
}

.igc-phone__code {
	display: flex;
	align-items: center;
	padding: 0 12px;
	border: 1px solid var(--igc-line);
	border-radius: var(--igc-radius);
	white-space: nowrap;
	opacity: .85;
}

.igc-phone input[type="tel"] {
	flex: 1 1 auto;
	min-width: 0;
}

/* --- country dropdown ------------------------------------------------ */

.igc-phone__country {
	position: relative;
	flex: 0 0 auto;
}

.igc-phone__toggle {
	display: flex;
	align-items: center;
	gap: 6px;
	height: 100%;
	min-height: 42px;
	margin: 0;
	padding: 0 10px;
	border: 1px solid var(--igc-line);
	border-radius: var(--igc-radius);
	background: transparent;
	color: inherit;
	font-size: inherit;
	line-height: 1.2;
	cursor: pointer;
	white-space: nowrap;
}

.igc-phone__toggle:hover,
.igc-phone.is-open .igc-phone__toggle {
	border-color: currentColor;
}

.igc-phone__caret {
	width: 0;
	height: 0;
	border-inline: 4px solid transparent;
	border-top: 5px solid currentColor;
	opacity: .6;
}

.igc-flag {
	font-size: 18px;
	line-height: 1;
	font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif;
}

.igc-flag--img {
	display: block;
	width: 20px;
	object-fit: cover;
	border-radius: 2px;
}

.igc-phone__panel {
	position: absolute;
	z-index: 60;
	top: calc(100% + 4px);
	display: block;
	width: 290px;
	max-width: 78vw;
	padding: 8px;
	border: 1px solid var(--igc-line);
	border-radius: var(--igc-radius);
	background: #fff;
	box-shadow: 0 10px 30px rgba(0, 0, 0, .12);
}

.igc-phone__panel[hidden] {
	display: none;
}

/* Country names read in the page direction again inside the list. */
[dir="rtl"] .igc-phone__panel,
.rtl .igc-phone__panel {
	direction: rtl;
	text-align: right;
}

.igc-phone__search-wrap {
	display: block;
	margin-bottom: 6px;
}

.igc-phone__search {
	display: block;
	width: 100%;
	box-sizing: border-box;
}

.igc-phone__list {
	display: block;
	max-height: 260px;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.igc-phone__option {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 7px 8px;
	border-radius: var(--igc-radius);
	cursor: pointer;
	line-height: 1.3;
}

.igc-phone__option[hidden] {
	display: none;
}

.igc-phone__option:hover,
.igc-phone__option.is-selected {
	background: rgba(0, 0, 0, .05);
}

.igc-phone__name {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.igc-phone__option .igc-phone__dial {
	opacity: .6;
	font-size: .9em;
}

.igc-phone__empty {
	display: block;
	padding: 10px 8px;
	opacity: .7;
}

.igc-phone__empty[hidden] {
	display: none;
}

.igc-phone__error {
	display: block;
	margin-top: 6px;
	color: #c0392b;
	font-size: .875em;
}

.igc-phone__error:empty {
	display: none;
}

.igc-phone input.has-error {
	border-color: #c0392b;
}

@media (max-width: 600px) {
	.igc-grid {
		grid-template-columns: 1fr;
	}

	.igc-amount {
		min-width: 78px;
	}

	.igc-amount span {
		padding: 12px 10px;
	}
}
