/* ============================================================
   UAE Calendar – Frontend Booking Widget
   ============================================================ */

/* ── CSS Custom Properties ─────────────────────────────────── */
:root {
	--uae-primary:       #4f82f6;
	--uae-primary-dark:  #3b6ce0;
	--uae-primary-light: #e8efff;
	--uae-success:       #22c55e;
	--uae-danger:        #ef4444;
	--uae-text:          #1e293b;
	--uae-muted:         #64748b;
	--uae-border:        #e2e8f0;
	--uae-bg:            #f8fafc;
	--uae-white:         #ffffff;
	--uae-radius:        12px;
	--uae-shadow:        0 4px 24px rgba(0,0,0,.1);
	--uae-transition:    .2s cubic-bezier(.4,0,.2,1);
}

/* ── Widget Container ──────────────────────────────────────── */
#uae-booking-widget {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	max-width: 680px;
	margin: 0 auto;
	background: var(--uae-white);
	border-radius: var(--uae-radius);
	box-shadow: var(--uae-shadow);
	overflow: hidden;
	color: var(--uae-text);
	position: relative;
}

/* ── Step Indicators ───────────────────────────────────────── */
.uae-steps {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.5rem 2rem;
	background: linear-gradient(135deg, var(--uae-primary), var(--uae-primary-dark));
	gap: 0;
}

.uae-step {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: .35rem;
	cursor: default;
}

.uae-step-dot {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: rgba(255,255,255,.25);
	color: rgba(255,255,255,.7);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: .85rem;
	transition: var(--uae-transition);
	border: 2px solid rgba(255,255,255,.3);
}

.uae-step.active .uae-step-dot,
.uae-step.done .uae-step-dot {
	background: var(--uae-white);
	color: var(--uae-primary);
	border-color: var(--uae-white);
}

.uae-step.done .uae-step-dot::before {
	content: '✓';
}
.uae-step.done .uae-step-dot { font-size: 0; }
.uae-step.done .uae-step-dot::before { font-size: .85rem; }

.uae-step span {
	font-size: .72rem;
	color: rgba(255,255,255,.75);
	font-weight: 500;
}
.uae-step.active span { color: var(--uae-white); font-weight: 700; }

.uae-step-line {
	flex: 1;
	height: 2px;
	background: rgba(255,255,255,.25);
	margin: 0 .5rem;
	margin-bottom: 1.3rem;
	max-width: 80px;
}

/* ── Panels ────────────────────────────────────────────────── */
.uae-panel {
	display: none;
	padding: 2rem;
	animation: uaeFadeIn .3s ease forwards;
}
.uae-panel-active { display: block; }

@keyframes uaeFadeIn {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: translateY(0); }
}

.uae-panel-title {
	font-size: 1.2rem;
	font-weight: 700;
	color: var(--uae-text);
	margin: 0 0 1.5rem;
}

/* ── Back Button ───────────────────────────────────────────── */
.uae-back-btn {
	background: none;
	border: none;
	color: var(--uae-primary);
	cursor: pointer;
	font-size: .85rem;
	padding: 0;
	margin-bottom: 1rem;
	display: flex;
	align-items: center;
	gap: .3rem;
	font-weight: 600;
}
.uae-back-btn:hover { opacity: .75; }

/* ── Calendar ──────────────────────────────────────────────── */
.uae-calendar-wrap {
	background: var(--uae-bg);
	border-radius: var(--uae-radius);
	padding: 1.25rem;
	border: 1px solid var(--uae-border);
}

.uae-cal-nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 1rem;
}

.uae-cal-nav button {
	background: var(--uae-white);
	border: 1px solid var(--uae-border);
	border-radius: 8px;
	width: 36px;
	height: 36px;
	cursor: pointer;
	font-size: 1.2rem;
	transition: var(--uae-transition);
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--uae-text);
}
.uae-cal-nav button:hover {
	background: var(--uae-primary);
	border-color: var(--uae-primary);
	color: var(--uae-white);
}

#uae-month-label {
	font-weight: 700;
	font-size: 1rem;
	color: var(--uae-text);
}

.uae-cal-weekdays,
.uae-cal-grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 4px;
}

.uae-cal-weekday {
	text-align: center;
	font-size: .72rem;
	font-weight: 600;
	color: var(--uae-muted);
	padding: .25rem 0;
	text-transform: uppercase;
	letter-spacing: .06em;
}

/* Day cells */
.uae-cal-day {
	aspect-ratio: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 8px;
	cursor: pointer;
	font-size: .88rem;
	font-weight: 500;
	transition: var(--uae-transition);
	border: 2px solid transparent;
	background: var(--uae-white);
	color: var(--uae-text);
	min-height: 40px;
}

.uae-cal-day:hover:not(.disabled):not(.empty) {
	background: var(--uae-primary-light);
	border-color: var(--uae-primary);
	color: var(--uae-primary);
}

.uae-cal-day.selected {
	background: var(--uae-primary) !important;
	color: var(--uae-white) !important;
	border-color: var(--uae-primary) !important;
	font-weight: 700;
}

.uae-cal-day.disabled {
	color: #c5cfd9;
	cursor: not-allowed;
	background: transparent;
}

.uae-cal-day.today {
	border-color: var(--uae-primary);
	color: var(--uae-primary);
	font-weight: 700;
}

.uae-cal-day.empty {
	cursor: default;
	background: transparent;
}

/* Skeleton loader */
.uae-cal-skeleton {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 4px;
	grid-column: 1 / -1;
}
.uae-skeleton-cell {
	aspect-ratio: 1;
	min-height: 40px;
	border-radius: 8px;
	background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
	background-size: 200% 100%;
	animation: uaeShimmer 1.4s infinite;
}
@keyframes uaeShimmer {
	0%   { background-position: 200% 0; }
	100% { background-position: -200% 0; }
}

/* Timezone note */
.uae-tz-note {
	margin-top: 1rem;
	font-size: .8rem;
	color: var(--uae-muted);
	text-align: center;
}

/* ── Time Slots ────────────────────────────────────────────── */
.uae-slots-wrap { }

.uae-slot-group { margin-bottom: 1.5rem; }

.uae-slot-group-label {
	font-size: .75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .08em;
	color: var(--uae-muted);
	margin-bottom: .75rem;
	display: flex;
	align-items: center;
	gap: .5rem;
}
.uae-slot-group-label::after {
	content: '';
	flex: 1;
	height: 1px;
	background: var(--uae-border);
}

.uae-slots-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
	gap: .5rem;
}

.uae-slot {
	padding: .6rem .5rem;
	text-align: center;
	border-radius: 8px;
	border: 2px solid var(--uae-border);
	background: var(--uae-white);
	cursor: pointer;
	font-size: .85rem;
	font-weight: 600;
	transition: var(--uae-transition);
	color: var(--uae-text);
}
.uae-slot:hover {
	border-color: var(--uae-primary);
	color: var(--uae-primary);
	background: var(--uae-primary-light);
}
.uae-slot.selected {
	background: var(--uae-primary);
	border-color: var(--uae-primary);
	color: var(--uae-white);
}

.uae-no-slots {
	text-align: center;
	padding: 2rem;
	color: var(--uae-muted);
	font-size: .9rem;
}

.uae-slots-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: .75rem;
	padding: 2rem;
	color: var(--uae-muted);
}

/* ── Booking Summary ───────────────────────────────────────── */
.uae-booking-summary {
	background: var(--uae-primary-light);
	border-radius: 10px;
	padding: 1rem 1.25rem;
	margin-bottom: 1.5rem;
	display: flex;
	gap: 1.5rem;
	flex-wrap: wrap;
}

.uae-summary-item {
	display: flex;
	align-items: center;
	gap: .5rem;
	font-weight: 600;
	font-size: .9rem;
	color: var(--uae-primary-dark);
}

/* ── Form Fields ───────────────────────────────────────────── */
.uae-field {
	margin-bottom: 1.25rem;
}

.uae-field label {
	display: block;
	font-size: .88rem;
	font-weight: 600;
	color: var(--uae-text);
	margin-bottom: .4rem;
}

.uae-required { color: var(--uae-danger); }

.uae-field input,
.uae-field select,
.uae-field textarea {
	width: 100%;
	padding: .7rem 1rem;
	border: 2px solid var(--uae-border);
	border-radius: 8px;
	font-size: .95rem;
	color: var(--uae-text);
	background: var(--uae-white);
	transition: var(--uae-transition);
	box-sizing: border-box;
	outline: none;
	-webkit-appearance: none;
}

.uae-field input:focus,
.uae-field select:focus {
	border-color: var(--uae-primary);
	box-shadow: 0 0 0 3px rgba(79,130,246,.15);
}

.uae-field input.is-invalid,
.uae-field select.is-invalid {
	border-color: var(--uae-danger);
}

.uae-error {
	display: block;
	font-size: .78rem;
	color: var(--uae-danger);
	margin-top: .3rem;
	min-height: 1em;
}

.uae-form-error {
	background: #fef2f2;
	border: 1px solid #fecaca;
	border-radius: 8px;
	padding: .75rem 1rem;
	color: #b91c1c;
	font-size: .88rem;
	margin-bottom: 1.25rem;
}

/* ── Submit Button ─────────────────────────────────────────── */
.uae-submit-btn {
	width: 100%;
	padding: 1rem;
	background: var(--uae-primary);
	color: var(--uae-white);
	border: none;
	border-radius: 10px;
	font-size: 1rem;
	font-weight: 700;
	cursor: pointer;
	transition: var(--uae-transition);
	display: flex;
	align-items: center;
	justify-content: center;
	gap: .5rem;
	letter-spacing: .02em;
}
.uae-submit-btn:hover:not(:disabled) {
	background: var(--uae-primary-dark);
	transform: translateY(-1px);
	box-shadow: 0 4px 16px rgba(79,130,246,.35);
}
.uae-submit-btn:disabled {
	opacity: .7;
	cursor: not-allowed;
	transform: none;
}

/* Spinner */
.uae-spinner {
	animation: uaeSpin .8s linear infinite;
}
@keyframes uaeSpin {
	to { transform: rotate(360deg); }
}

/* ── Success Screen ────────────────────────────────────────── */
.uae-success-wrap {
	text-align: center;
	padding: 1rem 0;
}

.uae-success-icon svg {
	width: 72px;
	height: 72px;
	display: block;
	margin: 0 auto 1.25rem;
}

.uae-checkmark {
	stroke-dasharray: 50;
	stroke-dashoffset: 50;
	animation: uaeDrawCheck .5s .2s ease forwards;
}
@keyframes uaeDrawCheck {
	to { stroke-dashoffset: 0; }
}

.uae-success-title {
	font-size: 1.5rem;
	font-weight: 800;
	color: var(--uae-text);
	margin: 0 0 .5rem;
}

.uae-success-sub {
	color: var(--uae-muted);
	margin: 0 0 1.5rem;
}

.uae-success-details {
	background: var(--uae-bg);
	border: 1px solid var(--uae-border);
	border-radius: var(--uae-radius);
	padding: 1.25rem 1.5rem;
	margin: 0 auto 1.5rem;
	max-width: 420px;
	text-align: left;
}

.uae-detail-row {
	display: flex;
	justify-content: space-between;
	padding: .5rem 0;
	border-bottom: 1px solid var(--uae-border);
	font-size: .9rem;
}
.uae-detail-row:last-child { border-bottom: none; }

.uae-detail-key {
	font-weight: 600;
	color: var(--uae-muted);
}

.uae-ref-id {
	font-family: monospace;
	font-size: .78rem;
	color: var(--uae-primary);
}

.uae-cal-actions {
	display: flex;
	gap: .75rem;
	justify-content: center;
	flex-wrap: wrap;
	margin-bottom: 1.25rem;
}

.uae-cal-btn {
	padding: .65rem 1.25rem;
	border-radius: 8px;
	font-size: .85rem;
	font-weight: 600;
	text-decoration: none;
	transition: var(--uae-transition);
	display: inline-flex;
	align-items: center;
	gap: .4rem;
}

.uae-cal-btn-google {
	background: #fff;
	color: #ea4335;
	border: 2px solid #ea4335;
}
.uae-cal-btn-google:hover {
	background: #ea4335;
	color: #fff;
}

.uae-cal-btn-ics {
	background: var(--uae-primary-light);
	color: var(--uae-primary);
	border: 2px solid var(--uae-primary);
}
.uae-cal-btn-ics:hover {
	background: var(--uae-primary);
	color: #fff;
}

.uae-link-btn {
	background: none;
	border: none;
	color: var(--uae-primary);
	cursor: pointer;
	font-size: .88rem;
	font-weight: 600;
	text-decoration: underline;
	padding: 0;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 500px) {
	.uae-panel { padding: 1.25rem; }
	.uae-steps { padding: 1rem; }
	.uae-step-line { max-width: 40px; }
	.uae-slots-grid { grid-template-columns: repeat(3, 1fr); }
	.uae-cal-actions { flex-direction: column; align-items: center; }
}
