/**
 * Bonspiel Event Calendar — Frontend Calendar Styles
 *
 * Intentionally minimal so themes can override easily.
 * Uses CSS custom properties for key colours.
 */

/* =========================================================================
   Custom properties (theme-overridable)
   ========================================================================= */

.bec-calendar-wrap {
	--bec-bg:            #ffffff;
	--bec-border:        #e2e4e7;
	--bec-text:          #1e1e1e;
	--bec-muted:         #757575;
	--bec-today-bg:      #f0f7ff;
	--bec-today-border:  #2271b1;
	--bec-nav-bg:        #2271b1;
	--bec-nav-text:      #ffffff;
	--bec-nav-hover:     #135e96;
	--bec-event-text:    #ffffff;
	--bec-tooltip-bg:    #1e1e1e;
	--bec-tooltip-text:  #ffffff;
	--bec-filter-bg:     #f6f7f7;
	--bec-radius:        4px;
}

/* =========================================================================
   Wrapper
   ========================================================================= */

.bec-calendar-wrap {
	font-family: inherit;
	color: var(--bec-text);
	background: var(--bec-bg);
	max-width: 100%;
	position: relative;
}

/* =========================================================================
   Filters bar
   ========================================================================= */

.bec-calendar-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: flex-end;
	padding: 12px 14px;
	background: var(--bec-filter-bg);
	border: 1px solid var(--bec-border);
	border-bottom: none;
	border-radius: var(--bec-radius) var(--bec-radius) 0 0;
}

.bec-filter-group {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.bec-filter-group label {
	font-size: 12px;
	font-weight: 600;
	color: var(--bec-muted);
	text-transform: uppercase;
	letter-spacing: .4px;
}

.bec-filter-group select,
.bec-filter-group input[type="text"] {
	padding: 6px 10px;
	border: 1px solid var(--bec-border);
	border-radius: var(--bec-radius);
	font-size: 14px;
	background: #fff;
	color: var(--bec-text);
	min-width: 140px;
}

/* =========================================================================
   Calendar header (month nav)
   ========================================================================= */

.bec-calendar-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 14px;
	background: var(--bec-nav-bg);
	color: var(--bec-nav-text);
	border-radius: var(--bec-radius) var(--bec-radius) 0 0;
}

/* When filters are present, the header loses its top radius. */
.bec-calendar-filters + .bec-calendar-header {
	border-radius: 0;
}

.bec-current-month {
	margin: 0;
	font-size: 18px;
	font-weight: 600;
	color: var(--bec-nav-text);
}

.bec-nav-btn {
	background: none;
	border: none;
	color: var(--bec-nav-text);
	font-size: 28px;
	line-height: 1;
	padding: 0 8px;
	cursor: pointer;
	border-radius: var(--bec-radius);
	transition: background .15s;
}

.bec-nav-btn:hover,
.bec-nav-btn:focus {
	background: var(--bec-nav-hover);
	outline: none;
}

/* =========================================================================
   Grid
   ========================================================================= */

.bec-calendar-grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	border: 1px solid var(--bec-border);
	border-top: none;
	border-radius: 0 0 var(--bec-radius) var(--bec-radius);
	overflow: hidden;
	background: var(--bec-border);   /* gap colour */
	gap: 1px;
}

.bec-cal-day-header {
	background: var(--bec-filter-bg);
	text-align: center;
	padding: 8px 4px;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .5px;
	color: var(--bec-muted);
}

.bec-cal-days-container {
	display: contents; /* Let child day cells participate directly in the parent grid */
}

/* =========================================================================
   Individual day cells
   ========================================================================= */

.bec-cal-day {
	background: var(--bec-bg);
	min-height: 100px;
	padding: 6px 8px;
	position: relative;
	overflow: hidden;
}

.bec-cal-day--other-month {
	background: #fafafa;
}

.bec-cal-day--other-month .bec-cal-day-number {
	color: #bbb;
}

.bec-cal-day--today {
	background: var(--bec-today-bg);
}

.bec-cal-day--today .bec-cal-day-number {
	background: var(--bec-today-border);
	color: #fff;
	border-radius: 50%;
	width: 24px;
	height: 24px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.bec-cal-day-number {
	font-size: 12px;
	font-weight: 600;
	color: var(--bec-muted);
	display: block;
	margin-bottom: 4px;
	line-height: 1;
}

/* =========================================================================
   Event pills inside day cells
   ========================================================================= */

.bec-cal-event {
	display: block;
	font-size: 11px;
	line-height: 1.3;
	padding: 2px 6px;
	margin-bottom: 2px;
	border-radius: 3px;
	color: var(--bec-event-text);
	background: #0073aa;  /* overridden inline by JS per-event color */
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	cursor: pointer;
	text-decoration: none;
	transition: filter .12s;
	position: relative;
}

.bec-cal-event:hover,
.bec-cal-event:focus {
	filter: brightness(1.12);
	outline: none;
	text-decoration: none;
	color: var(--bec-event-text);
}

/* Multi-day event continuation indicator */
.bec-cal-event--continues {
	border-radius: 3px 0 0 3px;
	margin-right: -8px;
	padding-right: 2px;
}

.bec-cal-event--continued {
	border-radius: 0 3px 3px 0;
	margin-left: -8px;
	padding-left: 2px;
}

.bec-cal-event--continues.bec-cal-event--continued {
	border-radius: 0;
}

/* "N more" overflow link */
.bec-cal-more {
	font-size: 11px;
	color: var(--bec-muted);
	cursor: pointer;
	display: block;
	margin-top: 1px;
}

.bec-cal-more:hover {
	color: var(--bec-text);
}

/* =========================================================================
   Tooltip
   ========================================================================= */

.bec-event-tooltip {
	position: fixed;
	z-index: 9999;
	background: var(--bec-tooltip-bg);
	color: var(--bec-tooltip-text);
	border-radius: var(--bec-radius);
	padding: 10px 14px;
	max-width: 260px;
	font-size: 13px;
	line-height: 1.5;
	pointer-events: none;
	opacity: 0;
	transition: opacity .15s;
	box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
}

.bec-event-tooltip.is-visible {
	opacity: 1;
}

.bec-event-tooltip__title {
	font-weight: 700;
	font-size: 14px;
	margin-bottom: 4px;
	display: block;
}

.bec-event-tooltip__dates {
	font-size: 12px;
	opacity: .8;
	margin-bottom: 4px;
	display: block;
}

.bec-event-tooltip__desc {
	font-size: 12px;
	opacity: .85;
}

.bec-event-tooltip__location {
	font-size: 11px;
	opacity: .7;
	margin-top: 4px;
	display: block;
}

/* =========================================================================
   Loading state
   ========================================================================= */

.bec-calendar-wrap.is-loading .bec-calendar-grid {
	opacity: .5;
	pointer-events: none;
}

.bec-calendar-wrap.is-loading::after {
	content: '';
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, .5);
}

/* =========================================================================
   Google Calendar embed
   ========================================================================= */

.bec-google-embed-wrap {
	width: 100%;
	overflow: hidden;
	border-radius: var(--bec-radius);
}

.bec-google-embed-wrap iframe {
	display: block;
	width: 100%;
}

/* =========================================================================
   Error messages
   ========================================================================= */

.bec-error {
	color: #d63638;
	border-left: 4px solid #d63638;
	padding: 8px 12px;
	background: #fcf0f1;
}

/* =========================================================================
   Block editor preview card
   ========================================================================= */

.bec-block-preview {
	background: #f0f7ff;
	border: 2px dashed #2271b1;
	border-radius: 6px;
	padding: 24px;
	text-align: center;
	color: #2271b1;
}

.bec-block-preview .dashicons {
	font-size: 36px;
	width: 36px;
	height: 36px;
	display: block;
	margin: 0 auto 8px;
}

.bec-block-preview strong {
	display: block;
	font-size: 16px;
	margin-bottom: 6px;
}

.bec-block-preview p {
	margin: 4px 0;
	font-size: 13px;
}

.bec-block-preview .description {
	color: #757575;
	font-size: 12px;
}

/* =========================================================================
   Responsive
   ========================================================================= */

@media screen and (max-width: 600px) {
	.bec-calendar-grid {
		font-size: 12px;
	}

	.bec-cal-day {
		min-height: 60px;
		padding: 4px;
	}

	.bec-current-month {
		font-size: 15px;
	}

	.bec-calendar-filters {
		flex-direction: column;
	}

	.bec-filter-group select,
	.bec-filter-group input[type="text"] {
		min-width: 100%;
	}

	.bec-cal-day-header {
		font-size: 9px;
		padding: 4px 2px;
	}
}
