/* Cart coupon drawer — see includes/class-coupon-drawer.php */
.h2-cd {
	--h2-cd-accent: #0f52d6;
	--h2-cd-accent-dark: #0b40a8;
	--h2-cd-accent-soft: #e7eefb;
	--h2-cd-text: #1d2327;
	--h2-cd-muted: #646970;
	--h2-cd-border: #e2e4e7;
	--h2-cd-bg: #fff;
	--h2-cd-width: 400px;
	font-family: inherit;
	box-sizing: border-box;
}

.h2-cd *,
.h2-cd *::before,
.h2-cd *::after {
	box-sizing: inherit;
}

html.h2-cd-lock {
	overflow: hidden;
}

/* Overlay + panel */
.h2-cd-overlay {
	position: fixed;
	inset: 0;
	z-index: 99998;
	background: rgba(0, 0, 0, .4);
	animation: h2-cd-fade .25s ease;
}

.h2-cd-overlay[hidden] {
	display: none;
}

.h2-cd {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	z-index: 99999;
	display: flex;
	flex-direction: column;
	width: min(var(--h2-cd-width), 100vw);
	background: var(--h2-cd-bg);
	color: var(--h2-cd-text);
	box-shadow: -8px 0 30px rgba(0, 0, 0, .15);
	transform: translateX(100%);
	visibility: hidden;
	transition: transform .3s ease, visibility 0s linear .3s;
	outline: none;
}

.h2-cd.is-open {
	transform: translateX(0);
	visibility: visible;
	transition: transform .3s ease;
}

.h2-cd__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 20px;
	border-bottom: 1px solid var(--h2-cd-border);
}

.h2-cd__title {
	margin: 0;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.3;
}

.h2-cd .h2-cd__close {
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--h2-cd-muted);
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
}

.h2-cd .h2-cd__close:hover,
.h2-cd .h2-cd__close:focus {
	background: #f0f0f1;
	color: var(--h2-cd-text);
}

/* Manual code entry: one rounded field with the button inside */
.h2-cd .h2-cd__form {
	display: flex;
	align-items: center;
	gap: 4px;
	margin: 16px 20px 0;
	padding: 4px;
	border: 1.5px solid var(--h2-cd-border);
	border-radius: 12px;
	background: #f6f7f7;
	transition: border-color .15s, box-shadow .15s, background-color .15s, opacity .15s;
}

/* Tag icon */
.h2-cd .h2-cd__form::before {
	content: "";
	flex: 0 0 18px;
	height: 18px;
	margin-left: 10px;
	background: var(--h2-cd-muted);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.6 13.4 13.4 20.6a2 2 0 0 1-2.8 0L3 13V3h10l7.6 7.6a2 2 0 0 1 0 2.8Z'/%3E%3Ccircle cx='7.5' cy='7.5' r='1.5'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.6 13.4 13.4 20.6a2 2 0 0 1-2.8 0L3 13V3h10l7.6 7.6a2 2 0 0 1 0 2.8Z'/%3E%3Ccircle cx='7.5' cy='7.5' r='1.5'/%3E%3C/svg%3E") center / contain no-repeat;
	transition: background-color .15s;
}

.h2-cd .h2-cd__form:hover {
	border-color: #c3c4c7;
}

.h2-cd .h2-cd__form:focus-within {
	border-color: var(--h2-cd-accent);
	background: var(--h2-cd-bg);
	box-shadow: 0 0 0 3px var(--h2-cd-accent-soft);
}

.h2-cd .h2-cd__form:focus-within::before {
	background: var(--h2-cd-accent);
}

.h2-cd .h2-cd__form.is-busy {
	opacity: .6;
	pointer-events: none;
	cursor: progress;
}

.h2-cd .h2-cd__input {
	flex: 1;
	min-width: 0;
	width: auto;
	height: 40px;
	margin: 0;
	padding: 0 8px;
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
	color: var(--h2-cd-text);
	font: inherit;
	font-size: 15px;
	font-weight: 600;
	letter-spacing: .06em;
	text-transform: uppercase;
}

.h2-cd .h2-cd__input:focus {
	border: 0;
	outline: none;
	box-shadow: none;
}

.h2-cd .h2-cd__input::placeholder {
	color: #8c8f94;
	font-weight: 400;
	letter-spacing: 0;
	text-transform: none;
	opacity: 1;
}

.h2-cd .h2-cd__submit {
	flex: 0 0 auto;
	height: 40px;
	margin: 0;
	padding: 0 18px;
	border: 0;
	border-radius: 9px;
	background: var(--h2-cd-accent);
	color: #fff;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	text-transform: none;
	cursor: pointer;
	box-shadow: 0 2px 6px rgba(15, 82, 214, .3);
	transition: background-color .15s, box-shadow .15s, opacity .15s, transform .1s;
}

.h2-cd .h2-cd__submit:hover,
.h2-cd .h2-cd__submit:focus-visible {
	background: var(--h2-cd-accent-dark);
	color: #fff;
	box-shadow: 0 4px 10px rgba(15, 82, 214, .35);
}

.h2-cd .h2-cd__submit:active {
	transform: scale(.97);
}

/* Muted until something is typed */
.h2-cd .h2-cd__input:placeholder-shown + .h2-cd__submit {
	background: #c3c4c7;
	box-shadow: none;
	cursor: default;
}

.h2-cd__notice {
	margin: 12px 20px 0;
	padding: 10px 12px;
	border-radius: 6px;
	background: #edfaef;
	color: #00450c;
	font-size: 13px;
}

.h2-cd__notice.is-error {
	background: #fdecec;
	color: #8a2424;
}

.h2-cd__notice[hidden] {
	display: none;
}

.h2-cd__body {
	flex: 1;
	overflow-y: auto;
	padding: 16px 20px 24px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	transition: opacity .2s;
}

.h2-cd.is-loading .h2-cd__body {
	opacity: .5;
	pointer-events: none;
}

.h2-cd__empty {
	margin: 40px 0;
	color: var(--h2-cd-muted);
	text-align: center;
}

/* Coupon card: fixed height so long and short coupons line up evenly */
.h2-cd .h2-cd-coupon {
	display: flex;
	flex: 0 0 auto;
	align-items: stretch;
	width: 100%;
	height: 112px;
	padding: 0;
	border: 1px solid var(--h2-cd-border);
	border-radius: 10px;
	background: var(--h2-cd-bg);
	color: inherit;
	font: inherit;
	text-align: left;
	white-space: normal;
	text-transform: none;
	cursor: pointer;
	overflow: hidden;
	transition: border-color .15s, box-shadow .15s, opacity .15s;
}

.h2-cd .h2-cd-coupon:hover,
.h2-cd .h2-cd-coupon:focus,
.h2-cd .h2-cd-coupon:focus-visible {
	border-color: var(--h2-cd-accent);
	box-shadow: 0 2px 10px rgba(15, 82, 214, .15);
	background: var(--h2-cd-bg);
	color: inherit;
}

.h2-cd .h2-cd-coupon__amount {
	position: relative;
	display: grid;
	place-items: center;
	flex: 0 0 92px;
	padding: 12px 8px;
	background: var(--h2-cd-accent);
	color: #fff;
	font-size: 17px;
	font-weight: 700;
	line-height: 1.2;
	text-align: center;
	word-break: break-word;
}

/* Ticket notch */
.h2-cd .h2-cd-coupon__amount::after {
	content: "";
	position: absolute;
	top: 0;
	right: -1px;
	bottom: 0;
	width: 6px;
	background: radial-gradient(circle at 100% 50%, var(--h2-cd-bg) 3px, transparent 3.5px) 0 0 / 6px 12px repeat-y;
}

.h2-cd .h2-cd-coupon__info {
	display: flex;
	flex: 1;
	flex-direction: column;
	justify-content: center;
	gap: 4px;
	min-width: 0;
	padding: 12px 10px 12px 14px;
	overflow: hidden;
}

.h2-cd .h2-cd-coupon__head {
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
}

.h2-cd .h2-cd-coupon__code {
	overflow: hidden;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: .04em;
	white-space: nowrap;
	text-overflow: ellipsis;
}

/* Max 2 lines; full text in the title tooltip */
.h2-cd .h2-cd-coupon__desc {
	display: -webkit-box;
	overflow: hidden;
	color: var(--h2-cd-muted);
	font-size: 13px;
	line-height: 1.4;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
}

.h2-cd .h2-cd-coupon__exp {
	color: var(--h2-cd-muted);
	font-size: 12px;
	line-height: 1.4;
	white-space: nowrap;
}

.h2-cd .h2-cd-coupon__badge {
	flex: 0 0 auto;
	padding: 2px 8px;
	border-radius: 10px;
	background: #1d2327;
	color: #fff;
	font-size: 11px;
	font-weight: 600;
}

.h2-cd .h2-cd-coupon__action {
	display: flex;
	align-items: center;
	padding: 0 14px;
	color: var(--h2-cd-accent);
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
}

/* Applied: dimmed, labelled "Đang sử dụng", click to remove */
.h2-cd .h2-cd-coupon.is-applied {
	background: #f6f7f7;
	opacity: .65;
}

.h2-cd .h2-cd-coupon.is-applied .h2-cd-coupon__amount {
	background: #8c8f94;
}

.h2-cd .h2-cd-coupon.is-applied .h2-cd-coupon__amount::after {
	background-image: radial-gradient(circle at 100% 50%, #f6f7f7 3px, transparent 3.5px);
}

.h2-cd .h2-cd-coupon.is-applied .h2-cd-coupon__action {
	color: var(--h2-cd-muted);
}

.h2-cd .h2-cd-coupon.is-applied:hover,
.h2-cd .h2-cd-coupon.is-applied:focus {
	background: #f6f7f7;
	opacity: 1;
}

.h2-cd .h2-cd-coupon.is-busy {
	opacity: .4;
	cursor: progress;
}

@keyframes h2-cd-fade {
	from { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
	.h2-cd,
	.h2-cd.is-open,
	.h2-cd-overlay {
		transition: none;
		animation: none;
	}
}

@media (max-width: 480px) {
	.h2-cd__header,
	.h2-cd__body {
		padding-left: 16px;
		padding-right: 16px;
	}

	.h2-cd .h2-cd__form {
		margin-left: 16px;
		margin-right: 16px;
	}

	.h2-cd-coupon__amount {
		flex-basis: 80px;
		font-size: 15px;
	}
}
