/* Custom variables for a premium festive look */
:root {
	--advent-primary: #d4af37; /* Festive Gold */
	--advent-primary-hover: #f3e5ab;
	--advent-bg-dark: #121824; /* Sleek Deep Blue-Gray */
	--advent-card-bg: rgba(255, 255, 255, 0.07);
	--advent-card-border: rgba(255, 255, 255, 0.15);
	--advent-text-light: #f3f4f6;
	--advent-text-muted: #9ca3af;
	--advent-glass-blur: blur(12px);
	--advent-card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
	--advent-font: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ============================================
   CONTAINER & BACKGROUND
   ============================================ */

.advent-calendar-container {
	font-family: var(--advent-font);
	position: relative;
	padding: 40px 20px;
	border-radius: 16px;
	box-shadow: var(--advent-card-shadow);
	margin: 20px auto;
	max-width: 1100px;
	color: var(--advent-text-light);
	overflow: hidden;
	/* Default dark gradient if no background image is set */
	background: radial-gradient(circle at center, #1e293b 0%, var(--advent-bg-dark) 100%);
	background-size: cover;
	background-position: center;
}

/* Semi-transparent overlay to ensure legibility over bg images */
.advent-calendar-overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(
		135deg,
		rgba(10, 15, 26, 0.72) 0%,
		rgba(18, 24, 36, 0.80) 100%
	);
	z-index: 0;
	pointer-events: none;
}

/* Ensure grid and content sit above the overlay */
.advent-calendar-grid,
.advent-modal-backdrop {
	position: relative;
	z-index: 1;
}

.advent-inactive-msg {
	position: relative;
	z-index: 1;
	text-align: center;
	padding: 30px;
	background: rgba(239, 68, 68, 0.1);
	border: 1px solid rgba(239, 68, 68, 0.2);
	color: #ef4444;
	border-radius: 8px;
	font-size: 1.1em;
}

/* ============================================
   GRID LAYOUT
   ============================================ */

.advent-calendar-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 20px;
	perspective: 1000px;
}

/* ============================================
   CARD – 3D FLIP CONTAINER
   ============================================ */

.advent-day-card {
	position: relative;
	width: 100%;
	aspect-ratio: 3 / 4;
	cursor: pointer;
	border-radius: 14px;
}

.advent-day-inner {
	position: relative;
	width: 100%;
	height: 100%;
	text-align: center;
	transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
	transform-style: preserve-3d;
	border-radius: 14px;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Front & Back Sides */
.advent-day-front,
.advent-day-back {
	position: absolute;
	width: 100%;
	height: 100%;
	backface-visibility: hidden;
	border-radius: 14px;
	border: 1px solid var(--advent-card-border);
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	box-sizing: border-box;
}

/* ============================================
   CARD FRONT – Glassmorphism
   ============================================ */

.advent-day-front {
	background: var(--advent-card-bg);
	backdrop-filter: var(--advent-glass-blur);
	-webkit-backdrop-filter: var(--advent-glass-blur);
	color: var(--advent-text-light);
	overflow: hidden;
	transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
	padding: 0;
	justify-content: flex-start;
}

/* ── Date Banner (replaces number badge) ── */
.advent-day-date-banner {
	width: 100%;
	background: rgba(0, 0, 0, 0.35);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
	font-weight: 700;
	font-size: 0.72rem;
	color: var(--advent-text-light);
	letter-spacing: 0.4px;
	text-align: center;
	padding: 7px 6px;
	box-sizing: border-box;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	transition: background 0.3s ease, color 0.3s ease;
	flex-shrink: 0;
}

/* ── Icon Area ── */
.advent-day-icon {
	flex: 1;
	width: 70%;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 10px 0;
}

.advent-day-icon img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.advent-day-icon-placeholder {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
}

.advent-day-icon-placeholder .dashicons {
	font-size: 42px;
	width: 42px;
	height: 42px;
	color: var(--advent-primary);
	opacity: 0.85;
	transition: transform 0.3s ease, opacity 0.3s ease;
}

/* ── Hover Shine Sweep ── */
.advent-day-shine {
	position: absolute;
	top: 0;
	left: -100%;
	width: 50%;
	height: 100%;
	background: linear-gradient(
		to right,
		rgba(255, 255, 255, 0) 0%,
		rgba(255, 255, 255, 0.13) 50%,
		rgba(255, 255, 255, 0) 100%
	);
	transform: skewX(-25deg);
	transition: left 0.75s ease;
	pointer-events: none;
}

.advent-day-card.advent-available:hover .advent-day-shine {
	left: 150%;
}

.advent-day-card.advent-available:hover .advent-day-front {
	border-color: var(--advent-primary);
	transform: translateY(-5px);
	box-shadow: 0 10px 28px rgba(212, 175, 55, 0.3);
}

.advent-day-card.advent-available:hover .advent-day-date-banner {
	background: linear-gradient(90deg, rgba(212, 175, 55, 0.35) 0%, rgba(212, 175, 55, 0.15) 100%);
	color: var(--advent-primary-hover);
}

.advent-day-card.advent-available:hover .advent-day-icon-placeholder .dashicons {
	transform: scale(1.15) rotate(5deg);
	opacity: 1;
}

/* ============================================
   LOCKED STATE
   ============================================ */

.advent-day-card.advent-locked {
	cursor: not-allowed;
}

.advent-day-card.advent-locked .advent-day-front {
	background: rgba(255, 255, 255, 0.02);
	filter: grayscale(1);
	border-color: rgba(255, 255, 255, 0.05);
	opacity: 0.65;
}

.advent-day-lock-indicator {
	position: absolute;
	bottom: 10px;
	right: 10px;
	background: rgba(0, 0, 0, 0.45);
	border-radius: 50%;
	width: 24px;
	height: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.advent-day-lock-indicator .dashicons {
	font-size: 13px;
	width: 13px;
	height: 13px;
	color: var(--advent-text-muted);
}

/* ============================================
   OPENED STATE – Card Flip to Back
   ============================================ */

.advent-day-card.advent-opened .advent-day-inner {
	transform: rotateY(180deg);
}

/* ── Back of Card ── */
.advent-day-back {
	background: linear-gradient(135deg, rgba(212, 175, 55, 0.15) 0%, rgba(212, 175, 55, 0.05) 100%);
	backdrop-filter: var(--advent-glass-blur);
	-webkit-backdrop-filter: var(--advent-glass-blur);
	border-color: rgba(212, 175, 55, 0.4);
	transform: rotateY(180deg);
	color: var(--advent-primary);
	flex-direction: column;
	gap: 6px;
}

.advent-day-back-content .dashicons {
	font-size: 34px;
	width: 34px;
	height: 34px;
	animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.advent-day-back-content p {
	margin: 0;
	font-weight: 700;
	font-size: 0.8rem;
	text-transform: uppercase;
	letter-spacing: 1.2px;
}

/* ============================================
   MODAL – Backdrop & Card
   ============================================ */

.advent-modal-backdrop {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(10, 15, 26, 0.80);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.35s ease;
}

.advent-modal-backdrop.is-active {
	opacity: 1;
	pointer-events: auto;
}

.advent-modal-wrapper {
	padding: 20px;
	width: 100%;
	max-width: 520px;
	box-sizing: border-box;
}

.advent-modal-card {
	background: radial-gradient(circle at top right, #1e293b 0%, #0f172a 100%);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 20px;
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
	padding: 30px 28px;
	position: relative;
	transform: scale(0.9) translateY(20px);
	transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
	color: var(--advent-text-light);
}

.advent-modal-backdrop.is-active .advent-modal-card {
	transform: scale(1) translateY(0);
}

/* ── Close Button ── */
.advent-modal-close {
	position: absolute;
	top: 14px;
	right: 14px;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid rgba(255, 255, 255, 0.1);
	color: var(--advent-text-light);
	font-size: 22px;
	line-height: 1;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.3s ease, transform 0.3s ease;
}

.advent-modal-close:hover {
	background: #ef4444;
	border-color: #ef4444;
	color: #ffffff;
	transform: rotate(90deg);
}

/* ── Header ── */
.advent-modal-header {
	text-align: center;
	margin-bottom: 22px;
}

.advent-modal-day-badge {
	display: inline-block;
	background: linear-gradient(135deg, var(--advent-primary) 0%, #b45309 100%);
	color: var(--advent-bg-dark);
	font-weight: 800;
	padding: 5px 18px;
	border-radius: 30px;
	font-size: 0.85rem;
	text-transform: uppercase;
	letter-spacing: 1px;
	margin-bottom: 10px;
	box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

.advent-modal-title {
	font-size: 1.4rem;
	margin: 0;
	font-weight: 700;
	color: var(--advent-text-light);
}

/* ── Body ── */
.advent-modal-body {
	font-size: 1rem;
	line-height: 1.65;
	text-align: center;
}

/* Custom text surprise */
.advent-surprise-html {
	text-align: left;
	background: rgba(255, 255, 255, 0.03);
	border-radius: 12px;
	padding: 18px 20px;
	border: 1px solid rgba(255, 255, 255, 0.05);
}

/* ── Coupon Box ── */
.advent-coupon-box {
	background: rgba(212, 175, 55, 0.06);
	border: 2px dashed rgba(212, 175, 55, 0.6);
	border-radius: 14px;
	padding: 24px 16px;
	margin: 10px 0;
}

.advent-coupon-code {
	display: block;
	font-family: monospace;
	font-size: 1.9rem;
	font-weight: 800;
	color: var(--advent-primary);
	letter-spacing: 3px;
	margin-bottom: 16px;
	text-shadow: 0 0 12px rgba(212, 175, 55, 0.2);
}

.advent-coupon-btn {
	background: var(--advent-primary);
	color: var(--advent-bg-dark);
	border: none;
	padding: 10px 26px;
	border-radius: 30px;
	font-weight: 700;
	cursor: pointer;
	font-size: 0.9rem;
	transition: all 0.3s ease;
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.advent-coupon-btn:hover {
	background: var(--advent-primary-hover);
	transform: scale(1.04);
	box-shadow: 0 6px 18px rgba(212, 175, 55, 0.45);
}

.advent-coupon-btn.copied {
	background: #10b981;
	color: #ffffff;
}

/* ── Product Box ── */
.advent-product-box {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
}

.advent-product-image {
	width: 140px;
	height: 140px;
	border-radius: 12px;
	overflow: hidden;
	border: 2px solid rgba(255, 255, 255, 0.08);
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
	flex-shrink: 0;
}

.advent-product-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.advent-product-title {
	font-size: 1.15rem;
	font-weight: 700;
	color: var(--advent-text-light);
	margin: 0;
}

.advent-product-price {
	color: var(--advent-primary);
	font-weight: 600;
	font-size: 1rem;
}

.advent-product-price .woocommerce-Price-amount {
	color: var(--advent-primary);
}

.advent-claim-btn {
	background: linear-gradient(135deg, var(--advent-primary) 0%, #b45309 100%);
	color: #ffffff;
	text-decoration: none;
	padding: 12px 34px;
	border-radius: 30px;
	font-weight: 700;
	display: inline-block;
	transition: all 0.3s ease;
	box-shadow: 0 4px 16px rgba(180, 83, 9, 0.35);
	font-size: 0.95rem;
}

.advent-claim-btn:hover {
	transform: translateY(-3px);
	box-shadow: 0 8px 24px rgba(180, 83, 9, 0.55);
	color: #ffffff;
}

/* ── URL / Link Box ── */
.advent-link-box {
	margin: 14px 0;
}

.advent-link-btn {
	background: linear-gradient(135deg, var(--advent-primary) 0%, #b45309 100%);
	color: #ffffff;
	text-decoration: none;
	padding: 12px 30px;
	border-radius: 30px;
	font-weight: 700;
	display: inline-block;
	transition: all 0.3s ease;
	box-shadow: 0 4px 15px rgba(180, 83, 9, 0.3);
}

.advent-link-btn:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 25px rgba(180, 83, 9, 0.5);
	color: #ffffff;
}

/* ── Loading Spinner ── */
.advent-loading-spinner {
	border: 3px solid rgba(255, 255, 255, 0.08);
	border-top: 3px solid var(--advent-primary);
	border-radius: 50%;
	width: 32px;
	height: 32px;
	animation: spin 0.9s linear infinite;
	margin: 24px auto;
}

/* ── Error text ── */
.advent-error-text {
	color: #f87171;
	padding: 10px;
}

/* ============================================
   KEYFRAMES
   ============================================ */

@keyframes spin {
	0%   { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

@keyframes popIn {
	0%   { transform: scale(0.7); opacity: 0; }
	100% { transform: scale(1);   opacity: 1; }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 600px) {
	.advent-calendar-grid {
		grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
		gap: 12px;
	}

	.advent-calendar-container {
		padding: 24px 12px;
		border-radius: 10px;
	}

	.advent-modal-card {
		padding: 22px 18px;
	}
}
