/* ────────────────────────────────────────────────────────────
   iCal Availability Calendar – Frontend Styles  v1.9.0
   ──────────────────────────────────────────────────────────── */

.iac-calendar-widget {
	font-family: inherit;
	width: 100%;
}

/* ── Loading state ──────────────────────────────────────── */
.iac-loading {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 24px 16px;
	color: #6b7280;
	font-size: 14px;
}

.iac-spinner {
	display: inline-block;
	width: 18px;
	height: 18px;
	border: 2px solid #e5e7eb;
	border-top-color: #6b7280;
	border-radius: 50%;
	animation: iac-spin 0.75s linear infinite;
	flex-shrink: 0;
}

@keyframes iac-spin {
	to { transform: rotate(360deg); }
}

/* ── Error state ────────────────────────────────────────── */
.iac-error {
	padding: 16px;
	background: #fef2f2;
	border: 1px solid #fecaca;
	border-radius: 8px;
	color: #991b1b;
	font-size: 14px;
	line-height: 1.5;
}

/* ── Grid of month blocks ───────────────────────────────── */
.iac-calendars {
	display: flex;
	flex-wrap: wrap;
	gap: 20px;
	align-items: flex-start;
}

/* ── Single month block ─────────────────────────────────── */
.iac-month-wrap {
	flex: 1 1 260px;
	min-width: 0;
	border-radius: 12px;
	box-shadow: 0 1px 4px rgba(0,0,0,.10);
	background: #fff;
	/* No overflow:hidden — it clips bottom rows */
}

/* ── Month header ───────────────────────────────────────── */
.iac-month-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	background-color: #1e293b;
	color: #fff;
	padding: 10px 14px;
	user-select: none;
	border-radius: 12px 12px 0 0;
}

.iac-month-title {
	font-size: 14px;
	font-weight: 600;
	letter-spacing: .02em;
}

/* ── Nav buttons ────────────────────────────────────────── */
.iac-nav-btn {
	background: none;
	border: none;
	color: #fff;
	cursor: pointer;
	padding: 4px 8px;
	font-size: 16px;
	border-radius: 4px;
	line-height: 1;
	transition: background .15s;
}

.iac-nav-btn:hover       { background: rgba(255,255,255,.15); }
.iac-nav-btn[hidden]     { visibility: hidden; pointer-events: none; }
.iac-nav-btn:focus-visible {
	outline: 2px solid rgba(255,255,255,.6);
	outline-offset: 2px;
}

/* ── Weekday row ────────────────────────────────────────── */
.iac-weekdays {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	background: #f1f5f9;
}

.iac-weekday {
	text-align: center;
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .06em;
	color: #64748b;
	padding: 6px 0;
}

/* ── Day grid ───────────────────────────────────────────── */
.iac-days-grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	/* Fixed row height — each row is exactly 40px tall, no tricks needed */
	grid-auto-rows: 40px;
	gap: 4px;
	padding: 8px;
	background: #f8fafc;
	border-radius: 0 0 12px 12px;
	box-sizing: border-box;
	/* Ensure the grid itself is never clipped */
	overflow: visible;
}

/* ── Individual day cell ────────────────────────────────── */
.iac-day {
	/* Fill the fixed 40px row completely */
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 6px;
	font-size: 13px;
	font-weight: 500;
	cursor: default;
	transition: transform .1s, box-shadow .1s;
	box-sizing: border-box;
	color: #374151;
	outline: 2px solid transparent;
	outline-offset: -2px;
	/* Prevent any inherited height/overflow from theme collapsing the cell */
	min-height: 0;
	overflow: visible;
}

/* Empty cells */
.iac-day.iac-empty {
	background: transparent;
	pointer-events: none;
}

/* Past */
.iac-day.iac-past {
	background-color: #e5e7eb;
	color: #9ca3af;
	cursor: not-allowed;
}

/* Today */
.iac-day.iac-today {
	outline-color: #3b82f6;
	color: #3b82f6;
	font-weight: 700;
}

/* Available */
.iac-day.iac-available {
	background-color: #22c55e;
	color: #fff;
}

.iac-day.iac-available:hover {
	transform: scale(1.08);
	box-shadow: 0 2px 8px rgba(34,197,94,.35);
}

/* Booked */
.iac-day.iac-booked {
	background-color: #ef4444;
	color: #fff;
	position: relative;
}

.iac-day.iac-booked::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background: repeating-linear-gradient(
		-45deg,
		rgba(255,255,255,.12) 0px,
		rgba(255,255,255,.12) 2px,
		transparent 2px,
		transparent 6px
	);
	pointer-events: none;
}

/* ── Legend ─────────────────────────────────────────────── */
.iac-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	margin-top: 14px;
	padding: 0 4px;
}

.iac-legend-item {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	color: #6b7280;
	font-weight: 500;
}

.iac-legend-dot {
	width: 14px;
	height: 14px;
	border-radius: 3px;
	flex-shrink: 0;
}

.iac-legend-dot.iac-available { background-color: #22c55e; }
.iac-legend-dot.iac-booked    { background-color: #ef4444; }
.iac-legend-dot.iac-past      { background-color: #e5e7eb; }

/* ── Editor placeholder ─────────────────────────────────── */
.iac-placeholder {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 40px 20px;
	background: #f8fafc;
	border: 2px dashed #cbd5e1;
	border-radius: 12px;
	color: #94a3b8;
	text-align: center;
	gap: 10px;
}

.iac-placeholder .eicon-calendar { font-size: 36px; }

.iac-placeholder p {
	font-size: 13px;
	margin: 0;
	line-height: 1.5;
	max-width: 260px;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 680px) {
	.iac-calendars {
		flex-direction: column;
	}

	.iac-month-wrap {
		width: 100%;
	}

	/* Slightly smaller cells on narrow screens */
	.iac-days-grid {
		grid-auto-rows: 34px;
		gap: 3px;
		padding: 6px;
	}

	.iac-day {
		font-size: 12px;
	}
}

/* ── Reduced motion ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
	.iac-spinner { animation: none; }
	.iac-day     { transition: none; }
}
