/* Nera DCMS Age Gate — dialog overlay, card. */

/* ------------------------------------------------------------------
   Overlay (full-screen backdrop)
   ------------------------------------------------------------------ */
.nera-age-overlay {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.55);
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);
	animation: nera-fade-in 0.18s ease both;
}

/* ------------------------------------------------------------------
   Dialog card
   ------------------------------------------------------------------ */
.nera-age-dialog-card {
	position: relative;
	max-height: 90vh;
	overflow-y: auto;
	animation: nera-slide-up 0.22s cubic-bezier(0.34, 1.12, 0.64, 1) both;
}

.nera-age-dialog-close {
	position: absolute;
	top: 1rem;
	right: 1rem;
	z-index: 1;
	width: 32px;
	height: 32px;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: none;
	color: var(--color-text-secondary, #6b7280);
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
	flex-shrink: 0;
}

.nera-age-dialog-close:hover {
	background: color-mix(in srgb, var(--color-text-primary, #111827) 8%, transparent);
	color: var(--color-text-primary, #111827);
}

.nera-age-dialog-close:focus-visible {
	outline: none;
	box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary, #111827) 25%, transparent);
}

.nera-age-dialog-close:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.nera-age-dialog-close .material-symbols-outlined {
	font-size: 20px;
}

@media (max-width: 640px) {
	.nera-age-dialog-close {
		top: 0.75rem;
		right: 0.75rem;
	}
}

/* ------------------------------------------------------------------
   Animations
   ------------------------------------------------------------------ */
@keyframes nera-fade-in {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes nera-slide-up {
	from { opacity: 0; transform: translateY(18px) scale(0.98); }
	to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* ------------------------------------------------------------------
   DOB fields — 3-column grid (plugin-owned, no Tailwind dependency)
   ------------------------------------------------------------------ */
.nera-dob-fields {
	display: grid;
	grid-template-columns: minmax(4.5rem, 1fr) minmax(7rem, 1.6fr) minmax(5rem, 1.2fr);
	gap: 0.75rem;
	align-items: end;
}

.nera-dob-field {
	display: flex;
	flex-direction: column;
	gap: 0.375rem;
	min-width: 0;
}

.nera-dob-field-label {
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--color-text-secondary, #6b7280);
	line-height: 1.2;
}

.nera-dob-select {
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	width: 100%;
	box-sizing: border-box;
	padding: 0.625rem 2rem 0.625rem 0.75rem;
	border: 2px solid var(--color-gray-200, #e5e7eb);
	border-radius: 0.75rem;
	background-color: var(--color-surface, #fff);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.625rem center;
	background-size: 1rem 1rem;
	color: var(--color-text-primary, #111827);
	font-size: 0.875rem;
	line-height: 1.25;
	transition: border-color 0.15s, box-shadow 0.15s;
	cursor: pointer;
}

.nera-dob-select:focus,
.nera-dob-select:focus-visible {
	outline: none;
	border-color: var(--color-gray-200, #e5e7eb);
	box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary, #111827) 25%, transparent);
}

/* Isolate dialog selects from checkout/theme focus rings (prevents double outline). */
#nera-age-dialog .nera-dob-select:focus,
#nera-age-dialog .nera-dob-select:focus-visible {
	outline: none !important;
	--tw-ring-shadow: 0 0 #0000;
	--tw-ring-offset-shadow: 0 0 #0000;
	box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary, #111827) 25%, transparent) !important;
	border-color: var(--color-gray-200, #e5e7eb);
}

@media (max-width: 400px) {
	.nera-dob-fields {
		grid-template-columns: 1fr 1fr 1fr;
		gap: 0.5rem;
	}

	.nera-dob-select {
		padding: 0.5rem 1.75rem 0.5rem 0.375rem;
		background-position: right 0.5rem center;
		font-size: 0.8125rem;
	}
}

/* ------------------------------------------------------------------
   Dialog actions (DOB fields, error, submit)
   ------------------------------------------------------------------ */
.nera-age-dialog-actions {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

/* ------------------------------------------------------------------
   Dialog inline error
   ------------------------------------------------------------------ */
.nera-age-dialog-error {
	font-size: 0.875rem;
	line-height: 1.4;
	color: var(--color-danger, #dc2626);
	background: color-mix(in srgb, var(--color-danger, #dc2626) 10%, transparent);
	border-radius: 0.75rem;
	padding: 0.75rem 1rem;
	margin: 0;
}

.nera-age-dialog-error.hidden {
	display: none;
}

/* Extra spacing between visible error and submit button */
.nera-age-dialog-error:not(.hidden) + .nera-age-dialog-submit {
	margin-top: 0.25rem;
}

/* ------------------------------------------------------------------
   Dialog submit button — loading state
   ------------------------------------------------------------------ */
.nera-age-dialog-submit.is-loading {
	opacity: 0.85;
	cursor: wait;
}

.nera-age-dialog-submit-icon.is-spinning {
	animation: nera-spin 0.8s linear infinite;
}

@keyframes nera-spin {
	from { transform: rotate(0deg); }
	to   { transform: rotate(360deg); }
}

/* ------------------------------------------------------------------
   Phone number field (optional; above the date of birth on both age
   forms). Deliberately mirrors .nera-dob-select so the two blocks read
   as one group, minus the select chevron.
   ------------------------------------------------------------------ */
.nera-phone-field {
	display: flex;
	flex-direction: column;
	gap: 0.375rem;
	min-width: 0;
	margin-bottom: 1rem;
}

.nera-phone-field-label {
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--color-text-secondary, #6b7280);
	line-height: 1.2;
}

.nera-phone-required {
	color: var(--color-danger, #dc2626);
}

.nera-phone-input {
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	width: 100%;
	box-sizing: border-box;
	padding: 0.625rem 0.75rem;
	border: 2px solid var(--color-gray-200, #e5e7eb);
	border-radius: 0.75rem;
	background-color: var(--color-surface, #fff);
	color: var(--color-text-primary, #111827);
	font-size: 0.875rem;
	line-height: 1.25;
	transition: border-color 0.15s, box-shadow 0.15s;
}

.nera-phone-input:focus,
.nera-phone-input:focus-visible {
	outline: none;
	border-color: var(--color-primary, #2563eb);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
