/**
 * Small Calendar Widget – Styles
 *
 * BEM block: achtbit-small-cal
 * Fluid-width mini month-grid + two-level bottom-sheet modals.
 * No forced full-width — adapts to whatever container it receives.
 *
 * @package achtbit-bookings
 */

/* ── Widget wrapper ─────────────────────────────────── */
.achtbit-small-cal {
	font-family: system-ui, -apple-system, sans-serif;
	color: #1a1a1a;
	line-height: 1.5;
	box-sizing: border-box;
	width: 100%;
}

.achtbit-small-cal *,
.achtbit-small-cal *::before,
.achtbit-small-cal *::after {
	box-sizing: inherit;
}

/* ── Inner wrapper ──────────────────────────────────── */
.achtbit-small-cal__inner {
	width: 100%;
}

/* ── Navigation bar ─────────────────────────────────── */
.achtbit-small-cal__nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 0.75rem;
	padding: 0 1.1rem;
}

.achtbit-small-cal__title {
	font-size: 1rem;
	font-weight: 700;
	color: #1a1a1a;
}

.achtbit-small-cal__nav-arrows {
	display: flex;
	gap: 0.25rem;
}

.achtbit-small-cal__nav-btn {
	background: transparent;
	border: 2px solid var( --blue, #1d71b8 );
	border-radius: 8px;
	padding: 0.25rem 0.6rem;
	font-size: 1rem;
	cursor: pointer;
	color: var( --blue, #1d71b8 );
	line-height: 1.4;
	font-weight: 800;
	transition: all 0.3s ease;
}

.achtbit-small-cal__nav-btn:hover {
	background: var( --blue, #1d71b8 );
	color: #fff;
	transform: translateY( -2px );
}

/* ── Grid ───────────────────────────────────────────── */
.achtbit-small-cal__grid {
	display: grid;
	grid-template-columns: repeat( 7, 1fr );
	gap: 2px;
	width: 100%;
}

.achtbit-small-cal__weekday {
	text-align: center;
	font-size: 0.7rem;
	font-weight: 600;
	color: #9ca3af;
	padding: 0.25rem 0;
	text-transform: uppercase;
}


/* ── Day cells ──────────────────────────────────────── */
.achtbit-small-cal__day {
	min-height: 44px;
	border-radius: 6px;
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 4px 2px;
	cursor: default;
	transition: background 0.12s;
}

.achtbit-small-cal__day--other-month {
	opacity: 0.3;
}

.achtbit-small-cal__day--today .achtbit-small-cal__day-num {
	background: var( --blue, #1d71b8 );
	color: #fff;
	border-radius: 50%;
	width: 26px;
	height: 26px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.achtbit-small-cal__day--has-events {
	cursor: pointer;
}

.achtbit-small-cal__day--has-events:hover {
	background: #f0f7ff;
}

.achtbit-small-cal__day-num {
	font-size: 0.8rem;
	font-weight: 500;
	color: #374151;
	width: 26px;
	height: 26px;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* ── Event dots ─────────────────────────────────────── */
.achtbit-small-cal__dots {
	display: flex;
	gap: 2px;
	flex-wrap: wrap;
	justify-content: center;
	margin-top: 2px;
}

.achtbit-small-cal__dot {
	display: inline-block;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	flex-shrink: 0;
}

.achtbit-small-cal__dot--more {
	width: auto;
	height: auto;
	border-radius: 3px;
	background: #e5e7eb;
	font-size: 0.6rem;
	color: #6b7280;
	padding: 0 2px;
	line-height: 1.4;
}

/* ── Modal backdrop ─────────────────────────────────── */
.achtbit-small-cal-modal-backdrop {
	position: fixed;
	inset: 0;
	background: rgba( 0, 0, 0, 0.45 );
	z-index: 200000;
}

@media ( min-width: 600px ) {
	.achtbit-small-cal-modal-backdrop {
		background: transparent;
	}
}

/* ── Modal sheet (mobile: bottom-sheet) ─────────────── */
@keyframes achtbit-small-cal-slide-in {
	from { transform: translateY( 100% ); }
	to   { transform: translateY( 0 ); }
}

.achtbit-small-cal-modal {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	background: #fff;
	border-radius: 16px 16px 0 0;
	z-index: 200001;
	max-height: 85vh;
	overflow-y: auto;
	animation: achtbit-small-cal-slide-in 0.22s ease-out;
	-webkit-overflow-scrolling: touch;
}

/* ── Modal desktop: klappt am angeklickten Tag auf ──── */
@keyframes achtbit-small-cal-pop-in {
	from { opacity: 0; transform: scale( 0.92 ); }
	to   { opacity: 1; transform: scale( 1 ); }
}

@media ( min-width: 600px ) {
	.achtbit-small-cal-modal {
		position: absolute;
		bottom: auto;
		left: -9999px;
		top: -9999px;
		right: auto;
		width: 320px;
		max-height: 70vh;
		border-radius: 16px;
		background: #fff;
		animation: achtbit-small-cal-pop-in 0.18s ease-out;
		transform-origin: top left;
		display: flex;
		flex-direction: column;
		overflow: hidden;
	}

	.achtbit-small-cal-modal .achtbit-small-cal-modal__body {
		flex: 1;
		overflow-y: auto;
		overflow-x: hidden;
	}

	.achtbit-small-cal-modal--detail {
		width: 420px;
	}

}

/* ── Modal header ───────────────────────────────────── */
.achtbit-small-cal-modal__header {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 1rem 1rem 0.75rem;
	border-bottom: 1px solid #f3f4f6;
	position: sticky;
	top: 0;
	background: #fff;
	z-index: 1;
}

.achtbit-small-cal-modal__title {
	flex: 1;
	font-size: 1rem;
	font-weight: 700;
	color: #1a1a1a;
	margin: 0;
	padding: 0;
}

/* Modal 2: Zurück + X oben, Titel darunter */
.achtbit-small-cal-modal--detail .achtbit-small-cal-modal__header {
	display: grid;
	grid-template-columns: 1fr auto;
	grid-template-rows: auto auto;
	gap: 0.25rem 0.5rem;
	align-items: start;
}

.achtbit-small-cal-modal--detail .achtbit-small-cal-modal__back {
	grid-column: 1;
	grid-row: 1;
}

.achtbit-small-cal-modal--detail .achtbit-small-cal-modal__close {
	grid-column: 2;
	grid-row: 1;
}

.achtbit-small-cal-modal--detail .achtbit-small-cal-modal__title {
	grid-column: 1 / -1;
	grid-row: 2;
}

.achtbit-small-cal-modal__close {
	background: none;
	border: none;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	color: #6b7280;
	padding: 0 0.25rem;
	flex-shrink: 0;
}

.achtbit-small-cal-modal__close:hover {
	color: #1a1a1a;
}

.achtbit-small-cal-modal__back {
	display: flex;
	align-items: center;
	gap: 0.25rem;
	background: none;
	border: none;
	font-size: 0.875rem;
	color: var( --blue, #1d71b8 );
	cursor: pointer;
	padding: 0;
	white-space: nowrap;
	flex-shrink: 0;
}

.achtbit-small-cal-modal__back:hover {
	text-decoration: underline;
}

.achtbit-small-cal-modal__body {
	padding: 0.75rem 1rem 1.5rem;
	overflow-x: hidden;
	overflow-y: auto;
}

/* ── Day event cards (Modal 1) ──────────────────────── */
.achtbit-small-cal-day-card {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	width: 100%;
	background: #f9fafb;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	padding: 0.75rem;
	margin-bottom: 0.5rem;
	cursor: pointer;
	text-align: left;
	transition: background 0.12s;
}

.achtbit-small-cal-day-card:hover {
	background: #f0f7ff;
	border-color: var( --turquiose, #36a9e1 );
}

.achtbit-small-cal-day-card__color {
	width: 4px;
	border-radius: 2px;
	align-self: stretch;
	flex-shrink: 0;
	min-height: 32px;
}

.achtbit-small-cal-day-card__content {
	flex: 1;
	min-width: 0;
}

.achtbit-small-cal-day-card__title {
	font-size: 0.9rem;
	font-weight: 600;
	color: #1a1a1a;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.achtbit-small-cal-day-card__time {
	font-size: 0.8rem;
	color: #6b7280;
	margin-top: 0.15rem;
}

.achtbit-small-cal-day-card__arrow {
	color: #9ca3af;
	flex-shrink: 0;
}

/* ── Event detail (Modal 2) ─────────────────────────── */
.achtbit-small-cal-detail-image {
	margin: -0.75rem -1rem 0.75rem;
	overflow: hidden;
}

.achtbit-small-cal-detail-image img {
	width: 100%;
	height: 180px;
	object-fit: cover;
	display: block;
}

.achtbit-small-cal-detail-excerpt {
	font-size: 0.875rem;
	color: #4b5563;
	margin: 0 0 0.75rem;
}

.achtbit-small-cal-detail-meta {
	margin-bottom: 0.75rem;
}

.achtbit-small-cal-detail-meta-row {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.875rem;
	color: #374151;
	margin-bottom: 0.35rem;
}

.achtbit-small-cal-detail-icon {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
	fill: #6b7280;
}

.achtbit-small-cal-detail-bar {
	background: #e5e7eb;
	border-radius: 4px;
	height: 6px;
	overflow: hidden;
	margin-bottom: 1rem;
}

.achtbit-small-cal-detail-bar__fill {
	height: 100%;
	border-radius: 4px;
	transition: width 0.3s;
}

.achtbit-small-cal-detail-waitlist-hint {
	font-size: 0.8rem;
	color: #92400e;
	background: #fef3c7;
	border-radius: 6px;
	padding: 0.5rem 0.75rem;
	margin-bottom: 0.75rem;
}

.achtbit-small-cal-detail-btn {
	display: block;
	width: 100%;
	box-sizing: border-box;
	padding: 0.75rem 1rem;
	background: var( --blue, #1d71b8 );
	color: #fff;
	border: none;
	border-radius: 8px;
	font-size: 0.95rem;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: opacity 0.15s;
}

.achtbit-small-cal-detail-btn:hover {
	opacity: 0.9;
	color: #fff;
}

.achtbit-small-cal-detail-btn--waitlist {
	background: #f59e0b;
}

.achtbit-small-cal-detail-btn--sold-out {
	background: #9ca3af;
	cursor: default;
}

.achtbit-small-cal-detail-btn--sold-out:hover {
	opacity: 1;
}
