/**
 * ALG Post-Submit Calendar Scheduler — modal styles
 * Tokens and layout per Designs/design_handoff_scheduler_modal (final).
 * Desktop (>=768px): centered dialog. Mobile (<768px): bottom sheet.
 * Fonts (Unna, Avenir Book/Medium/Heavy) are already loaded by the theme.
 */

:root {
	--alg-sched-navy: #222766;
	--alg-sched-gold: #9b9679;
	--alg-sched-gold-hover: #8a8569;
	--alg-sched-text: #3a3a3a;
	--alg-sched-muted: #6b7784;
	--alg-sched-border: #dddcd6;
	--alg-sched-border-light: #e1dfd7;
	--alg-sched-disabled: #c8c7c7;
	--alg-sched-day-hover: #f1f0ea;
	--alg-sched-overlay: rgba(13, 22, 33, 0.62);
	--alg-sched-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
	--alg-sched-error: #b3261e;
}

body.alg-sched-noscroll { overflow: hidden; }

/* -------------------------------------------------- Overlay + dialog shell */

.alg-sched-overlay {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: var(--alg-sched-overlay);
	opacity: 0;
	transition: opacity 0.15s ease;
}
.alg-sched-overlay.is-open { display: flex; opacity: 1; }

.alg-sched {
	position: relative;
	width: 100%;
	max-width: 520px;
	max-height: 92vh;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: #fff;
	color: var(--alg-sched-text);
	font-family: 'Avenir Book', 'Helvetica Neue', Arial, sans-serif;
	border-radius: 6px;
	box-shadow: var(--alg-sched-shadow);
	transform: scale(0.98);
	opacity: 0;
	transition: transform 0.2s ease-out, opacity 0.2s ease-out;
}
.alg-sched-overlay.is-open .alg-sched { transform: scale(1); opacity: 1; }
.alg-sched[data-state="picker"] { max-width: 760px; }

/* State-to-state crossfade: header persists, body content fades in. */
.alg-sched__body > * { animation: alg-sched-fade 0.15s ease; }
@keyframes alg-sched-fade { from { opacity: 0; } to { opacity: 1; } }

/* -------------------------------------------------------------- Navy header */

.alg-sched__head {
	position: relative;
	padding: 26px 32px 20px;
	margin: 0;
	background: var(--alg-sched-navy);
	color: #fff;
}
.alg-sched__eyebrow {
	margin: 0 0 6px;
	font-family: 'Avenir Heavy', 'Helvetica Neue', Arial, sans-serif;
	font-size: 12px;
	letter-spacing: 3px;
	text-transform: uppercase;
	color: var(--alg-sched-gold);
}
.alg-sched__eyebrow:empty { display: none; }
.alg-sched__title {
	margin: 0;
	font-family: 'Unna', Georgia, serif;
	font-weight: bold;
	font-size: 28px;
	line-height: 1.2;
	color: #fff;
}
.alg-sched__sub {
	margin: 6px 0 0;
	font-size: 15px;
	color: rgba(255, 255, 255, 0.85);
}
.alg-sched__close {
	position: absolute;
	top: 14px;
	right: 16px;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 0;
	background: none;
	font-size: 22px;
	line-height: 1;
	color: rgba(255, 255, 255, 0.85);
	cursor: pointer;
}
.alg-sched__close:hover { color: #fff; }
.alg-sched__close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* --------------------------------------------------------------------- Body */

.alg-sched__body { overflow-y: auto; margin: 0; }

/* Centered states: loading / success / error */
.alg-sched__center {
	padding: 48px 32px 44px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	text-align: center;
}
.alg-sched__spinner {
	display: inline-block;
	width: 34px;
	height: 34px;
	border: 3px solid var(--alg-sched-border-light);
	border-top-color: var(--alg-sched-navy);
	border-radius: 50%;
	animation: alg-sched-spin 0.9s linear infinite;
}
.alg-sched__spinner--btn {
	width: 14px;
	height: 14px;
	border-width: 2px;
	border-color: rgba(255, 255, 255, 0.4);
	border-top-color: #fff;
	vertical-align: -2px;
}
@keyframes alg-sched-spin { to { transform: rotate(360deg); } }

.alg-sched__badge {
	width: 52px;
	height: 52px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
}
.alg-sched__badge--ok { background: var(--alg-sched-navy); color: #fff; font-size: 26px; }
.alg-sched__badge--warn {
	border: 2px solid var(--alg-sched-navy);
	color: var(--alg-sched-navy);
	font-family: 'Avenir Heavy', sans-serif;
	font-size: 24px;
}
.alg-sched__bigwhen {
	font-family: 'Avenir Heavy', sans-serif;
	font-size: 17px;
	color: var(--alg-sched-navy);
}
.alg-sched__bodycopy {
	margin: 0;
	max-width: 380px;
	font-size: 14px;
	line-height: 1.5;
	color: var(--alg-sched-text);
}
.alg-sched__muted { margin: 0; font-size: 13px; color: var(--alg-sched-muted); }
.alg-sched__bigphone {
	font-family: 'Avenir Heavy', sans-serif;
	font-size: 20px;
	color: var(--alg-sched-navy);
	text-decoration: none;
}
a[href^=tel].alg-sched__bigphone {
	color: var(--alg-sched-navy);
}

/* Notices (e.g. slot-taken) */
.alg-sched__notice {
	margin: 16px 32px 0;
	padding: 10px 14px;
	border-left: 3px solid var(--alg-sched-gold);
	background: var(--alg-sched-day-hover);
	font-family: 'Avenir Medium', sans-serif;
	font-size: 13px;
	color: var(--alg-sched-navy);
	border-radius: 3px;
}

/* ------------------------------------------------------- Two-pane picker */

.alg-sched__panes { display: grid; grid-template-columns: 1fr 300px; }

.alg-sched__cal {
	margin: 0;
	padding: 22px 28px 26px;
	border-right: 1px solid var(--alg-sched-border-light);
}
.alg-sched__calnav {
	margin: 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 14px;
}
.alg-sched__month {
	font-family: 'Avenir Heavy', sans-serif;
	font-size: 16px;
	color: var(--alg-sched-navy);
}
.alg-sched__navbtn {
	width: 30px;
	height: 30px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--alg-sched-border);
	border-radius: 3px;
	background: #fff;
	font-size: 15px;
	color: var(--alg-sched-text);
	cursor: pointer;
}
.alg-sched__navbtn:disabled { color: var(--alg-sched-disabled); cursor: default; }
.alg-sched__navbtn:not(:disabled):hover { border-color: var(--alg-sched-navy); }

.alg-sched__dow,
.alg-sched__days {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 4px;
	text-align: center;
	margin: 0;
}
.alg-sched__dow {
	margin-bottom: 6px;
	font-family: 'Avenir Heavy', sans-serif;
	font-size: 11px;
	letter-spacing: 1px;
	color: var(--alg-sched-muted);
}
.alg-sched__day {
	position: relative;
	padding: 9px 0;
	border: 0;
	background: none;
	border-radius: 3px;
	font-family: 'Avenir Medium', sans-serif;
	font-size: 14px;
	color: var(--alg-sched-disabled);
}
.alg-sched__day.is-avail { color: var(--alg-sched-navy); cursor: pointer; }
.alg-sched__day.is-avail::after {
	content: '';
	position: absolute;
	left: 50%;
	bottom: 3px;
	width: 4px;
	height: 4px;
	margin-left: -2px;
	border-radius: 50%;
	background: var(--alg-sched-gold);
}
.alg-sched__day.is-avail:hover { background: var(--alg-sched-day-hover); }
.alg-sched__day.is-selected {
	background: var(--alg-sched-navy);
	color: #fff;
	font-family: 'Avenir Heavy', sans-serif;
}
.alg-sched__day.is-selected::after { display: none; }

.alg-sched__tznote {
	margin: 16px 0 0;
	font-size: 12px;
	color: var(--alg-sched-muted);
}

/* Time pane */
.alg-sched__times {
	margin: 0;
	padding: 22px 24px 26px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.alg-sched__datelabel {
	margin: 0 0 4px;
	font-family: 'Avenir Heavy', sans-serif;
	font-size: 14px;
	color: var(--alg-sched-navy);
}
.alg-sched__slots {
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
	overflow-y: auto;
	max-height: 290px;
}
.alg-sched__slot {
	width: 100%;
	padding: 11px;
	border: 1px solid var(--alg-sched-border);
	border-radius: 3px;
	background: #fff;
	text-align: center;
	font-family: 'Avenir Medium', sans-serif;
	font-size: 14px;
	color: var(--alg-sched-text);
	cursor: pointer;
	transition: border-color 0.12s ease;
}
.alg-sched__slot:hover { border-color: var(--alg-sched-navy); }
.alg-sched__slot.is-selected {
	background: var(--alg-sched-navy);
	border-color: var(--alg-sched-navy);
	color: #fff;
	font-family: 'Avenir Heavy', sans-serif;
}
.alg-sched__slotrow { display: flex; gap: 6px; }
.alg-sched__slotrow .alg-sched__slot { flex: 1; }
.alg-sched__slotrow .alg-sched__btn-gold { flex: 1; padding: 11px; font-size: 13px; }

.alg-sched__phoneline {
	margin: auto 0 0;
	padding-top: 8px;
	text-align: center;
	font-size: 12px;
	color: var(--alg-sched-muted);
}
.alg-sched__phonelink,
.alg-sched__phoneline a {
	font-family: 'Avenir Heavy', sans-serif;
	color: var(--alg-sched-navy);
	text-decoration: none;
}

/* ------------------------------------------------------------------ Buttons */

.alg-sched__btn-gold {
	display: block;
	width: 100%;
	box-sizing: border-box;
	padding: 15px;
	border: 0;
	border-radius: 3px;
	background: var(--alg-sched-gold);
	color: #fff;
	font-family: 'Avenir Heavy', sans-serif;
	font-size: 14px;
	letter-spacing: 1px;
	text-transform: uppercase;
	text-align: center;
	cursor: pointer;
}
.alg-sched__btn-gold:hover:not(:disabled) { background: var(--alg-sched-gold-hover); }
.alg-sched__btn-gold:disabled { opacity: 0.55; cursor: not-allowed; }

.alg-sched__btn-navy {
	display: inline-block;
	padding: 13px 32px;
	border: 0;
	border-radius: 3px;
	background: var(--alg-sched-navy);
	color: #fff;
	font-family: 'Avenir Heavy', sans-serif;
	font-size: 13px;
	letter-spacing: 1px;
	text-transform: uppercase;
	text-align: center;
	cursor: pointer;
}
.alg-sched__btn-navy:hover { background: #1a1f52; }

.alg-sched__link {
	border: 0;
	background: none;
	padding: 0;
	font-family: 'Avenir Medium', sans-serif;
	font-size: 13px;
	color: var(--alg-sched-navy);
	text-align: center;
	text-decoration: underline;
	cursor: pointer;
}

.alg-sched__btn-gold:focus-visible,
.alg-sched__btn-navy:focus-visible,
.alg-sched__link:focus-visible,
.alg-sched__slot:focus-visible,
.alg-sched__day:focus-visible,
.alg-sched__navbtn:focus-visible {
	outline: 2px solid var(--alg-sched-navy);
	outline-offset: 2px;
}

/* ------------------------------------------------------------ Confirm state */

.alg-sched__confirm {
	padding: 24px 32px 28px;
	display: flex;
	flex-direction: column;
	gap: 16px;
}
.alg-sched__summary {
	border: 1px solid var(--alg-sched-border-light);
	border-radius: 3px;
	overflow: hidden;
}
.alg-sched__summary-when {
	padding: 12px 16px;
	background: var(--alg-sched-navy);
	color: #fff;
	font-family: 'Avenir Heavy', sans-serif;
	font-size: 15px;
}
.alg-sched__summary-meta {
	padding: 12px 16px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}
.alg-sched__summary-line1 {
	font-family: 'Avenir Medium', sans-serif;
	font-size: 13px;
	color: var(--alg-sched-text);
}
.alg-sched__summary-line2 { font-size: 12px; color: var(--alg-sched-muted); }
.alg-sched__contact-copy {
	margin: 0;
	font-size: 13px;
	line-height: 1.5;
	color: var(--alg-sched-text);
}
.alg-sched__contact-copy strong {
	font-family: 'Avenir Heavy', sans-serif;
	font-weight: normal;
}

/* ----------------------------------------- Lead / phone-capture step */

.alg-sched__phone-form {
	padding: 24px 32px 28px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}
.alg-sched__phone-form label {
	font-family: 'Avenir Heavy', sans-serif;
	font-size: 15px;
	color: var(--alg-sched-navy);
    margin: 0;
}
.alg-sched__phone-form--full label { margin-top: 4px; }
.alg-sched__phone-form--full label:first-of-type { margin-top: 0; }
.alg-sched__lead-prompt {
	margin: 0 0 4px;
	font-size: 14px;
	color: var(--alg-sched-muted);
}
.alg-sched__phone-form input[type="tel"],
.alg-sched__phone-form input[type="text"],
.alg-sched__phone-form input[type="email"] {
	width: 100%;
	box-sizing: border-box;
	padding: 12px 14px;
	border: 1px solid var(--alg-sched-border);
	border-radius: 3px;
	font-family: 'Avenir Medium', sans-serif;
	font-size: 15px;
	color: var(--alg-sched-text);
}
.alg-sched__phone-form input[type="tel"]:focus-visible,
.alg-sched__phone-form input[type="text"]:focus-visible,
.alg-sched__phone-form input[type="email"]:focus-visible {
	outline: 2px solid var(--alg-sched-navy);
	outline-offset: 1px;
}
.alg-sched__phone-form input[aria-invalid="true"] { border-color: var(--alg-sched-error); }
.alg-sched__field-error {
	margin: -6px 0 0;
	font-size: 13px;
	color: var(--alg-sched-error);
}

/* ------------------------------------------------- Mobile bottom sheet (<768) */

@media (max-width: 767px) {
	.alg-sched-overlay { padding: 0; align-items: flex-end; }
	.alg-sched,
	.alg-sched[data-state="picker"] {
		max-width: 100%;
		max-height: 92vh;
		border-radius: 8px 8px 0 0;
		transform: translateY(100%);
		opacity: 1;
		transition: transform 0.25s ease-out;
	}
	.alg-sched-overlay.is-open .alg-sched { transform: translateY(0); }

	.alg-sched__head { padding: 16px 18px 12px; }
	.alg-sched__eyebrow { display: none; } /* save height on mobile */
	.alg-sched__title { font-size: 20px; }
	.alg-sched__sub { font-size: 12px; margin-top: 2px; }
	.alg-sched__close {
		top: 4px;
		right: 4px;
		width: 44px;  /* min mobile hit target */
		height: 44px;
		font-size: 20px;
	}

	/* Compact one-week picker */
	.alg-sched__mbody {
		padding: 12px 16px 16px;
		display: flex;
		flex-direction: column;
		gap: 10px;
	}
	.alg-sched__calnav { margin-bottom: 0; }
	.alg-sched__month { font-size: 14px; }
	.alg-sched__dow,
	.alg-sched__days--week { gap: 2px; }
	.alg-sched__dow { margin-bottom: 0; margin: 0; font-size: 10px; letter-spacing: 0; }
	.alg-sched__days--week .alg-sched__day { padding: 6px 0; font-size: 12px; }
	.alg-sched__datelabel { margin: 2px 0 0; font-size: 13px; }

	.alg-sched__slots--grid {
		display: grid;
		grid-template-columns: repeat(3, 1fr);
		gap: 6px;
		max-height: 42vh;
		overflow-y: auto;
	}
	.alg-sched__slots--grid .alg-sched__slot { padding: 10px 4px; font-size: 12px; }
	.alg-sched__confirm-time { padding: 13px; font-size: 13px; }

	.alg-sched__center { padding: 24px 16px 22px; }
	.alg-sched__bigwhen { font-size: 16px; }
	.alg-sched__bodycopy { font-size: 13px; }
	.alg-sched__confirm { padding: 18px 16px 20px; gap: 14px; }
	.alg-sched__phone-form { padding: 18px 16px 20px; }
	.alg-sched__notice { margin: 12px 16px 0; }
	.alg-sched__btn-gold { padding: 13px; font-size: 13px; }
}

/* --------------------------------------------------------- Reduced motion */

@media (prefers-reduced-motion: reduce) {
	.alg-sched-overlay,
	.alg-sched { transition: none; }
	.alg-sched__body > * { animation: none; }
	.alg-sched__spinner { animation-duration: 1.6s; }
}

/* --------------------------- Shortcode button: [alg_schedule_button]
 * Button that submits its associated CF7 form and opens the scheduler.
 * Optional .alg-sched-btnrow wrapper lays it beside the form's [submit].
 */

.alg-sched-trigger {
	display: inline-block;
	font-size: 16px;
	font-family: 'Avenir heavy', 'Avenir Medium', 'Helvetica Neue', Arial, sans-serif;
	text-transform: uppercase;
	line-height: 20px;
	letter-spacing: 1px;
	padding: 15px 32px;
	background: var(--alg-sched-gold);
	border: hidden;
	color: #fff;
	cursor: pointer;
}
.alg-sched-trigger:hover {
	background: var(--alg-sched-gold-hover);
	color: #fff;
}

.alg-sched-trigger.navy {
	background: var(--alg-sched-navy);
}
.alg-sched-trigger.navy:hover {
	background: var(--alg-sched-navy)
}

.alg-sched-btnrow {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: stretch;
	position: relative;
}

.alg-sched-btnrow > input,
.alg-sched-btnrow > button {
	flex: 1 1 200px;
	width: auto;
	margin: 0;
	float: none;
}

.contact-form .form-group-btn.blockElement.alg-sched-btnrow input {
	display: inline-block;
    font-size: 16px;
    font-family: 'Avenir heavy', 'Avenir Medium', 'Helvetica Neue', Arial, sans-serif;
    text-transform: uppercase;
    line-height: 20px;
    letter-spacing: 1px;
    padding: 15px 32px;
    background: var(--alg-sched-navy);
    border: hidden;
    color: #fff;
    cursor: pointer;
}

.alg-sched-btnrow .wpcf7-spinner {
	position: absolute;
    left: calc(50% - 30px);
    bottom: -30px;
}

@media (max-width: 480px) {
	.alg-sched-btnrow > input,
	.alg-sched-btnrow > button { flex-basis: 100%; }
}
