/* Modern responsive calendar with light/dark theme support */
:root {
	--imena-bg: #f6f9ff;
	--imena-card: #ffffff;
	--imena-border: #dfe7ef;
	--imena-text: #111827;
	--imena-accent: #0a84ff;
	--imena-muted: #6b7280;
}

@media (prefers-color-scheme: dark) {
	:root {
		--imena-bg: #031428;
		--imena-card: #062038;
		--imena-border: #143040;
		--imena-text: #e6eef8;
		--imena-accent: #3aa0ff;
		--imena-muted: #9aa4b2;
	}
}

.imena-calendar {
	background: var(--imena-card);
	color: var(--imena-text);
	border: 1px solid var(--imena-border);
	padding: 16px;
	border-radius: 12px;
	box-shadow: 0 6px 18px rgba(2,6,23,0.08);
	max-width: 820px;
	margin: 0 auto 1.5rem;
}

.imena-calendar-header {
	display:flex;
	justify-content:space-between;
	align-items:center;
	gap:12px;
	margin-bottom:12px;
}

.imena-calendar-header .imena-month-year {
	font-weight:700;
	font-size:1.05rem;
}

.imena-calendar-header button {
	background: transparent;
	border: 1px solid var(--imena-border);
	color: var(--imena-text);
	padding:6px 10px;
	border-radius:8px;
	cursor:pointer;
}

.imena-calendar-table { width:100%; border-collapse: collapse; table-layout: fixed; }
.imena-calendar-table thead th { text-align:center; color:var(--imena-muted); font-weight:600; padding:6px 8px; width:14.2857%; }
.imena-calendar-table td { background: transparent; padding: 0; vertical-align: top; }

.imena-calendar-body tr { display: table-row; }
.imena-calendar-body td {
	display: table-cell;
	width:14.2857%;
	min-height:96px;
	border: 1px solid var(--imena-border);
	border-radius:10px;
	padding:10px;
	vertical-align: top;
}

.imena-calendar-table td.empty { background: transparent; border-style:dashed; opacity:0.5 }
.imena-calendar-table .day-number { font-weight:600; margin-bottom:8px }
.day-events { margin-top:auto }
.event-item { font-size:13px; margin-bottom:6px; display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.event-item a { color:var(--imena-accent); text-decoration:none }
.event-item a:hover { text-decoration:underline }
.imena-loading { text-align:center; padding:6px; color:var(--imena-muted) }

@media (max-width:740px) {
	.imena-calendar-body tr { flex-direction:row; flex-wrap:wrap }
	.imena-calendar-body td { min-width: 30%; }
}

/* explicit theme override per calendar instance */
.imena-calendar[data-theme="dark"] {
	--imena-bg: #031428;
	--imena-card: #062038;
	--imena-border: #143040;
	--imena-text: #e6eef8;
	--imena-accent: #3aa0ff;
	--imena-muted: #9aa4b2;
}
.imena-calendar[data-theme="light"] {
	--imena-bg: #f6f9ff;
	--imena-card: #ffffff;
	--imena-border: #dfe7ef;
	--imena-text: #111827;
	--imena-accent: #0a84ff;
	--imena-muted: #6b7280;
}

.imena-theme-toggle { margin-right:8px }
.imena-today { margin-right:8px; padding:6px 8px; border-radius:8px; border:1px solid var(--imena-border); background:transparent; cursor:pointer; }
.imena-today:hover { background: rgba(10,132,255,0.04); }

/* Tooltip for full event titles (shows on hover and keyboard focus) */
.event-item { position: relative }
.event-item a[title] {
	position: relative;
}
.event-item a[title]::after {
	content: attr(title);
	position: absolute;
	left: 50%;
	transform: translateX(-50%) translateY(-8px);
	bottom: 100%;
	white-space: nowrap;
	background: rgba(2,6,23,0.9);
	color: #fff;
	padding: 6px 8px;
	border-radius: 6px;
	font-size: 12px;
	opacity: 0;
	pointer-events: none;
	transition: opacity 160ms ease, transform 160ms ease;
	box-shadow: 0 6px 18px rgba(2,6,23,0.32);
	z-index: 30;
}
.event-item a[title]:hover::after,
.event-item a[title]:focus::after {
	opacity: 1;
	transform: translateX(-50%) translateY(-12px);
}

/* Dark theme tooltip contrast tweak */
.imena-calendar[data-theme="light"] .event-item a[title]::after {
	background: rgba(2,6,23,0.9);
	color: #fff;
}
.imena-calendar[data-theme="dark"] .event-item a[title]::after {
	background: rgba(255,255,255,0.08);
	color: var(--imena-text);
	border: 1px solid rgba(255,255,255,0.12);
}

/* Focus styles for keyboard users on gridcells */
td[role="gridcell"]:focus {
	outline: 3px solid rgba(10,132,255,0.35);
	outline-offset: 2px;
}


