/* =============================================================================
   BB Calendar – Frontend Styles
   ============================================================================= */

/* --------------------------------------------------------------------------
   Wrapper
   -------------------------------------------------------------------------- */
.bbcal-wrapper {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
	font-size: 14px;
	line-height: 1.4;
	color: #1a1a1a;
	box-sizing: border-box;
}

.bbcal-wrapper *,
.bbcal-wrapper *::before,
.bbcal-wrapper *::after {
	box-sizing: inherit;
}

/* --------------------------------------------------------------------------
   Navigation (shared month/week/day)
   -------------------------------------------------------------------------- */
.bbcal-month-nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
}

.bbcal-month-nav h2.bbcal-month-title {
	margin: 0;
	font-size: 1.2em;
	font-weight: 600;
}

.bbcal-nav-prev,
.bbcal-nav-next {
	text-decoration: none;
	color: #0073aa;
	font-size: 1em;
	padding: 4px 8px;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	transition: background 0.15s;
}

.bbcal-nav-prev:hover,
.bbcal-nav-next:hover {
	background: #f0f0f1;
}

/* --------------------------------------------------------------------------
   Month Grid
   -------------------------------------------------------------------------- */
.bbcal-month-grid {
	display: grid;
	grid-template-columns: repeat(7, minmax(0, 1fr));
	grid-template-rows: auto;
	grid-auto-rows: 1fr;
	border-top: 1px solid #ddd;
	border-left: 1px solid #ddd;
}

.bbcal-month-dow {
	font-weight: 600;
	font-size: 0.8em;
	text-align: center;
	padding: 6px 4px;
	background: #f6f7f7;
	border-right: 1px solid #ddd;
	border-bottom: 1px solid #ddd;
	text-transform: uppercase;
	color: #646970;
}

.bbcal-month-cell.bbcal-today {
	background: #f0f7fb;
}

.bbcal-month-cell.bbcal-empty {
	background: #fafafa;
}

.bbcal-month-day-num {
	display: block;
	font-size: 0.85em;
	font-weight: 600;
	color: #50575e;
	margin-bottom: 2px;
}

.bbcal-month-cell.bbcal-today .bbcal-month-day-num {
	color: #0073aa;
}

/* --------------------------------------------------------------------------
   Event blocks (shared)
   -------------------------------------------------------------------------- */
.bbcal-event {
	display: block;
	border-radius: 3px;
	padding: 2px 5px;
	margin-bottom: 2px;
	font-size: 0.8em;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	overflow-wrap: break-word;
	word-wrap: break-word;
	cursor: default;
	position: relative;
	max-width: 100%;
	min-width: 0;
}

/* Month-view events: allow text to wrap within the pill */
.bbcal-month-view .bbcal-event {
	white-space: normal;
	text-overflow: clip;
	line-height: 1.3;
	overflow: visible;
}

/* Show time in month view */
.bbcal-month-view .bbcal-event-time {
	display: inline;
	font-size: 0.75em;
	opacity: 0.85;
}

.bbcal-event-time {
	font-size: 0.75em;
	opacity: 0.8;
	margin-right: 2px;
	letter-spacing: -0.3px;
}

.bbcal-event-title {
	font-weight: 500;
}

/* Clickable events with links */
.bbcal-event--clickable {
	cursor: pointer;
}

.bbcal-event--clickable:hover {
	opacity: 0.9;
}

/* Brief events (< 5 min): dot indicator instead of full background */
.bbcal-event--brief {
	background: transparent !important;
	padding-left: 14px;
}

.bbcal-event-dot {
	display: inline-block;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	margin-right: 3px;
	vertical-align: middle;
	flex-shrink: 0;
}

/* Month cells: grow to fit all events */
.bbcal-month-cell {
	min-height: 120px;
	padding: 4px;
	border-right: 1px solid #ddd;
	border-bottom: 1px solid #ddd;
	vertical-align: top;
	position: relative;
	min-width: 0;
	overflow: visible;
}

/* Hidden overflow events */
.bbcal-event--hidden {
	display: none;
}

.bbcal-month-cell.bbcal-expanded .bbcal-event--hidden {
	display: block;
}

/* +N more button */
.bbcal-more-btn {
	display: block;
	width: 100%;
	background: none;
	border: none;
	padding: 2px 4px;
	font-size: 0.72em;
	color: #0073aa;
	cursor: pointer;
	text-align: left;
	margin-top: 1px;
}

.bbcal-more-btn:hover {
	text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Week View
   -------------------------------------------------------------------------- */
.bbcal-week-grid {
	display: grid;
	grid-template-columns: 60px repeat(7, minmax(0, 1fr));
	border-top: 1px solid #ddd;
	border-left: 1px solid #ddd;
	overflow-x: auto;
}

.bbcal-week-day-header {
	text-align: center;
	padding: 6px 4px;
	font-weight: 600;
	font-size: 0.85em;
	background: #f6f7f7;
	border-right: 1px solid #ddd;
	border-bottom: 1px solid #ddd;
}

.bbcal-week-day-header.bbcal-today {
	background: #f0f7fb;
	color: #0073aa;
}

.bbcal-week-dow {
	display: block;
	font-size: 0.75em;
	text-transform: uppercase;
	color: #646970;
}

.bbcal-week-dom {
	display: block;
	font-size: 1.1em;
}

.bbcal-week-allday-cell,
.bbcal-week-time-cell {
	position: relative;
	border-right: 1px solid #ddd;
	border-bottom: 1px solid #e0e0e0;
	min-height: 56px;
	min-width: 0;
}

.bbcal-week-time-cell {
	overflow: visible;
}

.bbcal-week-allday-cell {
	padding: 2px 4px;
	background: #fafafa;
	min-height: 28px;
}

.bbcal-timed-event {
	position: absolute;
	left: 2px;
	right: 2px;
	border-radius: 3px;
	padding: 2px 4px;
	font-size: 0.78em;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	overflow-wrap: break-word;
	word-wrap: break-word;
	z-index: 1;
	min-width: 0;
	opacity: 0.85;
}

.bbcal-time-gutter {
	border-right: 1px solid #ddd;
	border-bottom: 1px solid #e0e0e0;
	font-size: 0.75em;
	color: #646970;
	text-align: right;
	padding: 2px 6px 0 0;
	background: #fafafa;
}

.bbcal-week-header-cell,
.bbcal-allday-label {
	background: #f6f7f7;
	border-bottom: 1px solid #ddd;
	font-size: 0.75em;
	color: #646970;
	text-align: right;
	padding: 4px 6px;
}

/* --------------------------------------------------------------------------
   Day View
   -------------------------------------------------------------------------- */
.bbcal-day-grid {
	border-top: 1px solid #ddd;
}

.bbcal-day-row {
	display: grid;
	grid-template-columns: 60px minmax(0, 1fr);
	border-bottom: 1px solid #e0e0e0;
	min-height: 56px;
}

.bbcal-day-time-cell {
	position: relative;
	border-left: 1px solid #ddd;
	min-height: 56px;
	overflow: hidden;
	min-width: 0;
}

.bbcal-day-allday {
	display: flex;
	align-items: flex-start;
	gap: 4px;
	flex-wrap: wrap;
	padding: 4px 0 4px 66px;
	border-bottom: 1px solid #ddd;
	background: #fafafa;
}

.bbcal-allday-label {
	font-size: 0.75em;
	color: #646970;
	padding-top: 2px;
	white-space: nowrap;
}

/* --------------------------------------------------------------------------
   List View
   -------------------------------------------------------------------------- */
.bbcal-list-view {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.bbcal-list-header {
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 4px;
}

.bbcal-list-heading {
	margin: 0;
	font-size: 1.2em;
	font-weight: 600;
}

.bbcal-list-day {
	border-bottom: 1px solid #e0e0e0;
	padding-bottom: 12px;
}

.bbcal-list-date-heading {
	font-size: 1em;
	font-weight: 700;
	margin: 0 0 8px;
	color: #1a1a1a;
}

.bbcal-list-events {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.bbcal-list-event {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 0 10px;
	padding: 6px 10px;
	border-radius: 4px;
	align-items: baseline;
	overflow: hidden;
	max-width: 100%;
}

.bbcal-list-time {
	font-size: 0.85em;
	color: #50575e;
	white-space: nowrap;
	min-width: 100px;
}

.bbcal-list-detail {
	min-width: 0;
}

.bbcal-list-title {
	font-weight: 500;
}

.bbcal-list-desc {
	margin-top: 2px;
	font-weight: 400;
	color: #50575e;
	font-size: 0.92em;
	line-height: 1.5;
	display: none;
	overflow-wrap: break-word;
	word-break: break-word;
	overflow: hidden;
	max-width: 100%;
}

.bbcal-list-desc.is-open {
	display: block;
}

.bbcal-list-desc a {
	color: #0073aa;
	text-decoration: none;
	word-break: break-all;
}

.bbcal-list-desc a:hover {
	text-decoration: underline;
}

.bbcal-details-btn {
	background: none;
	border: none;
	padding: 0 4px;
	font-size: 0.82em;
	color: #0073aa;
	cursor: pointer;
	vertical-align: baseline;
	margin-left: 6px;
}

.bbcal-details-btn:hover {
	text-decoration: underline;
}

.bbcal-list-no-events,
.bbcal-list-empty {
	color: #646970;
	font-style: italic;
	margin: 0;
}

/* --------------------------------------------------------------------------
   Toolbar (view tabs + calendar selector combined)
   -------------------------------------------------------------------------- */
.bbcal-toolbar {
	display: flex;
	align-items: center;
	gap: 16px;
	flex-wrap: wrap;
	margin-bottom: 8px;
	padding: 8px 12px;
	border: 1px solid #ddd;
	border-radius: 4px;
	background: #fafafa;
}

.bbcal-view-switcher {
	display: flex;
	gap: 4px;
	flex-wrap: wrap;
}

.bbcal-view-tab {
	text-decoration: none;
	color: #50575e;
	font-size: 0.875em;
	font-weight: 500;
	padding: 5px 14px;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	background: #fff;
	transition: background 0.15s, color 0.15s;
}

.bbcal-view-tab:hover {
	background: #f0f7fb;
	color: #0073aa;
	border-color: #0073aa;
}

.bbcal-view-tab--active {
	background: #0073aa;
	color: #fff !important;
	border-color: #0073aa;
	cursor: default;
	pointer-events: none;
}

/* --------------------------------------------------------------------------
   Calendar Selector (inside toolbar)
   -------------------------------------------------------------------------- */
.bbcal-toolbar-sep {
	width: 1px;
	align-self: stretch;
	background: #ddd;
	flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Timezone Selector
   -------------------------------------------------------------------------- */
.bbcal-tz-selector {
	display: flex;
	align-items: center;
}

.bbcal-tz-label {
	display: flex;
	align-items: center;
	gap: 4px;
	cursor: pointer;
}

.bbcal-tz-icon {
	font-size: 1em;
}

.bbcal-tz-select {
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	padding: 4px 8px;
	font-size: 0.85em;
	background: #fff;
	cursor: pointer;
}

.bbcal-tz-select:hover,
.bbcal-tz-select:focus {
	border-color: #0073aa;
	outline: none;
}

.bbcal-selector-calendars {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 16px;
}

.bbcal-selector-row {
	display: flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
	font-size: 0.9em;
}

.bbcal-selector-swatch {
	display: inline-block;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	flex-shrink: 0;
}

.bbcal-selector-name {
	color: #1a1a1a;
}

/* Ensure checkbox is always visible */
.bbcal-selector-row input[type="checkbox"] {
	appearance: auto !important;
	-webkit-appearance: checkbox !important;
	-moz-appearance: checkbox !important;
	width: 16px !important;
	height: 16px !important;
	margin: 0 !important;
	cursor: pointer !important;
	opacity: 1 !important;
	visibility: visible !important;
	position: static !important;
	pointer-events: auto !important;
	background: #fff !important;
	border: 1px solid #8c8f94 !important;
	border-radius: 3px !important;
}

/* --------------------------------------------------------------------------
   Week-view gap collapsing
   -------------------------------------------------------------------------- */
.bbcal-week-grid .bbcal-gap-hidden {
	display: none;
}

.bbcal-gap-expander {
	grid-column: 1 / -1;
	background: none;
	border: none;
	border-bottom: 1px dashed #c3c4c7;
	padding: 6px 8px;
	font-size: 0.8em;
	color: #646970;
	cursor: pointer;
	text-align: center;
	transition: background 0.15s, color 0.15s;
}

.bbcal-gap-expander:hover {
	background: #f0f7fb;
	color: #0073aa;
}

/* --------------------------------------------------------------------------
   Tooltip
   -------------------------------------------------------------------------- */
.bbcal-tooltip {
	position: fixed;
	z-index: 9999;
	pointer-events: auto;
	max-width: 420px;
	max-height: 50vh;
	overflow-y: auto;
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 6px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
	padding: 10px 12px;
	font-size: 0.85em;
	line-height: 1.5;
	color: #1a1a1a;
	display: none;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
}

.bbcal-tooltip.is-visible {
	display: block;
}

.bbcal-tooltip-title {
	font-weight: 700;
	margin-bottom: 4px;
	font-size: 1.05em;
}

.bbcal-tooltip-time {
	color: #50575e;
	margin-bottom: 2px;
}

.bbcal-tooltip-desc,
.bbcal-tooltip-loc {
	margin-top: 4px;
	font-size: 0.92em;
	color: #3c434a;
}

.bbcal-tooltip-desc a,
.bbcal-tooltip-loc a {
	color: #0073aa;
	text-decoration: none;
	word-break: break-all;
}

.bbcal-tooltip-desc a:hover,
.bbcal-tooltip-loc a:hover {
	text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 600px) {
	.bbcal-month-grid {
		font-size: 11px;
	}

	.bbcal-month-cell {
		min-height: 110px;
	}

	.bbcal-week-grid {
		grid-template-columns: repeat(7, minmax(0, 1fr));
		font-size: 11px;
	}

	.bbcal-week-grid .bbcal-time-gutter {
		display: none;
	}

	.bbcal-day-row {
		grid-template-columns: minmax(0, 1fr);
	}

	.bbcal-day-row .bbcal-time-gutter {
		display: none;
	}

	.bbcal-list-event {
		display: flex;
		flex-direction: column;
		gap: 2px;
	}

	.bbcal-list-time {
		min-width: auto;
	}

	.bbcal-selector-calendars {
		flex-direction: column;
	}
}
