/* Frontend calendar styles aligned with admin calendar */
:root {
	--bg: #f7f8fb;
	--card: #ffffff;
	--grid: #eef2f7;
	--text: #0f172a;
	--muted: #64748b;

	--brand: #2563eb;
	--brand-soft: #eff6ff;

	--sun: #e53935;
	--sat: #1e88e5;

	--holiday: #ef4444;
	--holiday-soft: #fee2e2;

	--out-bg: #fafafa;
	--out-text: #94a3b8;
	--head-bg: #eef2ff;
	--head-line: #dbe6ff;
}

.is-layout-constrained>.evm-calendar {
	max-width: 860px;
}

.evm-cal-table {
	width: 100%;
	table-layout: fixed;
	border-collapse: collapse;
	border-radius: 12px;
	overflow: hidden;
	background: var(--card);
	box-shadow: 0 6px 20px rgba(0,0,0,.06);
}
.evm-cal-table th, .evm-cal-table td {
	border-right: 1px solid var(--grid);
	border-bottom: 1px solid var(--grid);
	vertical-align: top;
	padding: 8px;
	height: 88px;
}
.evm-cal-table thead th {
	background: var(--head-bg);
	color: var(--text);
	font-weight: 700;
	font-size: 13px;
	letter-spacing: .03em;
	padding: 12px 8px;
	height: 40px;
	border-bottom: 2px solid var(--head-line);
}
.evm-cal-table thead th:first-child {
	color: var(--sun);
}
.evm-cal-table thead th:last-child {
	color: var(--sat);
}

.evm-cal-date {
	font-weight: 700;
	margin-bottom: 4px;
	color: var(--text);
}
.evm-cal-date.is-today {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 26px;
	height: 26px;
	padding: 0 6px;
	border-radius: 999px;
	background: var(--brand-soft);
}
.evm-cal-title {
	font-weight: 700;
}
.evm-cal-day {
	position: relative;
	overflow: visible;
}
.evm-cal-day.is-today {
	outline: 2px solid #4caf50;
}

.evm-cal-day .evm-cal-date {
	font-weight: 700;
}

/* 週末の日付カラー（当月のみ） */
.evm-cal-table tbody tr>td:first-child:not(.evm-cal-empty) .evm-cal-date {
	color: var(--sun);
}
.evm-cal-table tbody tr>td:last-child:not(.evm-cal-empty) .evm-cal-date {
	color: var(--sat);
}

.evm-cal-event {
	font-size: 12.5px;
	margin: 3px 0;
	padding: 4px 6px;
	background: var(--brand-soft);
	border-left: 3px solid var(--brand);
	border-radius: 6px;
	line-height: 1.35;
	position: relative;
	overflow-wrap: normal;
	word-wrap: normal;
	/* avoid forced wrapping that shrinks venue width */
}
.evm-cal-event.is-out {
	background: #eef2ff;
	border-left-color: #94a3ff;
	color: #334155;
}

.evm-holiday {
	font-size: 12.5px;
	margin: 3px 0;
	padding: 4px 6px;
	background: var(--holiday-soft);
	border-left: 3px solid var(--holiday);
	border-radius: 6px;
	font-weight: 600;
	color: #b91c1c;
	line-height: 1.3;
}
.evm-holiday .en {
	color: #8b9bb0;
	font-weight: 500;
}
.evm-holiday rt {
	font-size: 10px;
	color: #6b7280;
}

.evm-cal-empty {
	background: var(--out-bg);
}
.evm-cal-empty .evm-cal-date {
	color: var(--out-text);
}

.evm-cal-header {
	display: flex;
	gap: 8px;
	justify-content: center;
	align-items: center;
	margin: 12px 0;
}
.evm-cal-header button {
	padding: 6px 10px;
	border: 1px solid var(--grid);
	border-radius: 8px;
	background: #fff;
}
.evm-cal-header button:hover {
	background: #f8fafc;
}

.evm-month-empty {
	color: var(--muted);
	padding: 12px;
	text-align: center;
	background: var(--out-bg);
	border-radius: 10px;
	margin-top: 10px;
}

/* tooltip */
.evm-cal-event[data-venue]:hover::after {
	content: attr(data-venue);
	position: absolute;
	left: 0;
	top: 100%;
	margin-top: 4px;
	background: #333;
	color: #fff;
	padding: 4px 6px;
	border-radius: 4px;
	font-size: .8em;
	white-space: nowrap;
	z-index: 3;
	pointer-events: none;
	box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.evm-cal-event[data-venue]:hover::before {
	content: "";
	position: absolute;
	left: 10px;
	top: calc(100% - 2px);
	border: 6px solid transparent;
	border-bottom-color: #333;
	z-index: 3;
}
.evm-cal-event .evm-event__title {
	display: block;
	font-weight: 600;
	color: var(--text);
	text-decoration: none;
}
.evm-cal-event .evm-event__title:hover {
	text-decoration: underline;
}
.evm-cal-event .evm-event__time {
	display: block;
	margin-top: 2px;
	font-size: 0.85em;
	color: var(--muted);
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
	font-feature-settings: "tnum";
}
.evm-cal-event .evm-event__venue {
	/* flex allows width:100% to apply consistently */
	display: flex;
	align-items: center;
	gap: 4px;
	margin-top: 2px;
	font-size: 0.85em;
	line-height: 1.2;
	color: var(--muted);
	text-decoration: none;
	width: 100%;
	max-width: 100%;
	min-width: 0;
}
.evm-cal-event .evm-event__venue-name {
	color: inherit;
	text-decoration: none;
}
.evm-cal-event .evm-event__venue-name.js-open-map {
	cursor: pointer;
}
.evm-cal-event .evm-event__venue-icon {
	/* Keep text emoji width predictable so venue text gets more space */
	flex: 0 0 12px;
	width: 12px;
	height: 12px;
	font-size: 12px;
	line-height: 12px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	opacity: 0.85;
}
.evm-cal-event .evm-event__venue-icon img,
.evm-cal-event .evm-event__venue-icon img.emoji {
	/* keep emoji images from stealing horizontal space */
	width: 12px;
	height: 12px;
	display: block;
	opacity: 0.75;
}
.evm-cal-event .evm-event__venue-text {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: clip;
	white-space: nowrap;
}
.evm-cal-event .evm-event__venue-name.js-open-map:hover {
	text-decoration: underline;
	color: #475569;
}
.evm-cal-event .evm-event__venue--text {
	cursor: default;
}
.evm-cal-event .evm-event__venue--text:hover {
	text-decoration: none;
	color: var(--muted);
}

/* Responsive: prevent excessive vertical growth on narrow screens */
@media (max-width: 640px) {
	.evm-cal-wrapper {
		overflow-x: auto;
	}
	/* keep the table readable, allow horizontal scroll if needed */
	.evm-cal-table {
		min-width: 700px;
	}

	/* compact cells and text */
	.evm-cal-table th, .evm-cal-table td {
		height: 64px;
		padding: 6px;
	}
	.evm-cal-date {
		font-size: 13px;
		margin-bottom: 2px;
	}

	/* make event/holiday pills compact and scrollable inside the cell */
	.evm-cal-event, .evm-holiday {
		font-size: 11px;
		margin: 2px 0;
		padding: 3px 5px;
		max-height: 34px; /* keeps cell from expanding too tall */
		overflow: auto;
	}
	.evm-cal-event .evm-event__venue {
		font-size: 9px;
	}

	/* reduce box-shadow and spacing for mobile */
	.evm-cal-table {
		box-shadow: none;
		border-radius: 8px;
	}
	.evm-cal-header {
		margin: 8px 0;
	}
	.evm-modal {
		width: 92%;
	}
}

/* ------------------ Agenda / List view (modern) ------------------ */
.list-view {
	padding: 8px 12px;
}
.evm-list {
	display:flex;
	flex-direction:column;
	gap:10px;
}
.evm-list-empty {
	color: var(--muted);
	padding:18px;
	text-align:center;
	background:var(--out-bg);
	border-radius:10px;
}
.evm-list-row {
	display:flex;
	gap:12px;
	align-items:center;
	padding:12px;
	border-radius:12px;
	background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
	border: 1px solid rgba(0,0,0,0.06);
	box-shadow: 0 6px 18px rgba(2,6,23,0.25);
	cursor: pointer;
	transition: transform .12s ease, box-shadow .12s ease;
}
.evm-list-row:hover {
	transform: translateY(-3px);
	box-shadow: 0 10px 24px rgba(2,6,23,0.30);
}
.evm-list-date {
	min-width:86px;
	font-weight:700;
	color:var(--muted);
	font-size:14px;
}
.evm-list-row.is-sun .evm-list-date {
	color: var(--sun);
}
.evm-list-row.is-sat .evm-list-date {
	color: var(--sat);
}
.evm-list-info {
	flex:1;
	display:flex;
	flex-direction:column;
	gap:6px;
}
.evm-list-count {
	color:var(--muted);
	font-size:13px;
	font-weight:600;
}
.evm-list-title {
	font-weight:700;
	color:var(--text);
	font-size:15px;
	overflow:hidden;
	white-space:nowrap;
	text-overflow:ellipsis;
	display:block;
	text-decoration: none;
}
.evm-list-title:hover {
	text-decoration: underline;
}
.evm-list-details {
	margin-top:8px;
	display:block;
	padding-top:8px;
	border-top:1px dashed rgba(255,255,255,0.03);
}
.evm-list-item {
	padding:8px 6px;
	border-radius:8px;
	background: rgba(255,255,255,0.02);
	margin-bottom:6px;
	font-size:14px;
	color:var(--text);
}
.evm-list-item .evm-list-time {
	display:inline-flex;
	align-items:center;
	gap:2px;
	font-weight:600;
	color:var(--text);
	text-decoration:none;
	white-space:nowrap;
	font-variant-numeric: tabular-nums;
	font-feature-settings: "tnum";
}
.evm-list-item .evm-list-time-start {
	display:inline-block;
	min-width:5ch;
	text-align:right;
}
.evm-list-item .evm-list-time-sep {
	display:inline-block;
	min-width:1ch;
	text-align:center;
}
.evm-list-item .evm-list-time-end {
	display:inline-block;
	min-width:5ch;
	text-align:left;
}
.evm-list-item .evm-event__venue {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	margin-top: 2px;
	font-size: 11px;
	color: var(--muted);
	text-decoration: none;
	width: 100%;
	max-width: 100%;
	min-width: 0;
}
.evm-list-item .evm-event__venue-text {
	flex: 1 1 auto;
	overflow:hidden;
	text-overflow:ellipsis;
	white-space:nowrap;
	min-width:0;
}
.evm-list-item .evm-event__venue-name {
	color: inherit;
	text-decoration: none;
}
.evm-list-item .evm-event__venue-name.js-open-map {
	cursor: pointer;
}
.evm-list-item .evm-event__venue-name.js-open-map:hover {
	text-decoration: underline;
	color: #475569;
}
.evm-list-item .evm-event__venue--text {
	cursor: default;
}
.evm-list-item .evm-event__venue--text:hover {
	text-decoration: none;
	color: var(--muted);
}
.evm-list-row.open {
	background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.02));
}

/* compact variants for denser displays */
@media (max-width:420px){
	.evm-list-row {
		padding:10px;
		gap:8px;
		border-radius:10px;
	}
	.evm-list-date {
		min-width:64px;
		font-size:13px;
	}
	.evm-list-title {
		font-size:14px;
	}
}

/* ensure month/list default visibility before JS (match the breakpoint in calendar-frontend.js) */
.month-view {
	display:block;
}
.list-view {
	display:none;
}
@media (max-width:640px){
	.month-view {
		display:none;
	}
	.list-view {
		display:block;
	}
	/* Hide the server-rendered month table before JS builds the list view. */
	.evm-cal-wrapper > .evm-cal-table {
		display: none;
	}
}

/* ------------------ Next event card ------------------ */
.evm-next {
	padding: 16px 18px;
	border: 1px solid #eee;
	border-radius: 12px;
	background: #fff;
	box-shadow: 0 4px 14px rgba(0,0,0,.06);
	max-width: 760px !important;
	position: relative;
	overflow: visible;
}
.evm-next__label {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 10px;
	font-size: 12px;
	letter-spacing: .04em;
	color: var(--muted);
}
.evm-next__label-text {
	display: inline-flex;
	align-items: center;
	padding: 2px 8px;
	border-radius: 999px;
	background: #f1f5f9;
	color: #475569;
	font-size: 20px;
	font-weight: 700;
}
.evm-next__badge {
	display: inline-flex;
	align-items: center;
	padding: 2px 8px;
	border-radius: 999px;
	background: var(--holiday-soft);
	color: #b91c1c;
	font-size: 20px;
	font-weight: 700;
}
.evm-next__row {
	display: flex;
	gap: 18px;
	align-items: flex-start;
}
.evm-next__main {
	min-width: 160px;
}
.evm-next__date {
	font-size: 1.45em;
	font-weight: 700;
	color: var(--text);
}
.evm-next__time {
	margin-top: 4px;
	font-size: .95em;
	color: var(--muted);
}
.evm-next__sub {
	display: flex;
	flex-direction: column;
	gap: 6px;
}
.evm-next__title {
	font-weight: 700;
	color: var(--text);
}
.evm-next__venue {
	color: var(--muted);
	font-size: .95em;
}
.evm-next__actions {
	margin-top: 14px;
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
}
.evm-next__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 8px 12px;
	min-height: 36px;
	border-radius: 10px;
	border: 1px solid var(--brand);
	background: var(--brand);
	color: #fff;
	text-decoration: none;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}
.evm-next__btn:hover {
	filter: brightness(0.96);
}
.evm-next__btn--ghost {
	background: #fff;
	color: var(--brand);
}
.evm-next__btn--ghost:hover {
	background: #f8fafc;
}

@media (max-width: 640px) {
	.evm-next {
		padding: 16px;
	}
	.evm-next__row {
		flex-direction: column;
	}
	.evm-next__main {
		min-width: 0;
	}
	.evm-next__date {
		font-size: 1.2em;
	}
}

#map-modal {
	display: none;
	z-index: 9999;
}
#map-modal-backdrop {
	position: absolute;
	inset: 0;
	background: transparent;
	z-index: 9998;
}
#map-modal .map-dialog {
	position: absolute;
	width: 420px;
	z-index: 9999;
	top: 0;
	left: 0;
	transform: none;
	display: block;
	background: #ffffff;
	pointer-events: auto;
	box-sizing: border-box;
	padding: 0;
	border-radius: 6px;
	overflow: hidden;
	border: 1px solid rgba(15, 23, 42, 0.12);
	box-shadow: 0 12px 30px rgba(2, 6, 23, 0.18);
}
#map-modal #map-close {
	position: absolute;
	right: 8px;
	top: 8px;
	z-index: 10001;
	background: rgba(255,255,255,0.9);
	border: none;
	border-radius: 50%;
	width: 36px;
	height: 36px;
	line-height: 36px;
	text-align: center;
	cursor: pointer;
	font-size: 18px;
}
#map-modal #map-static,
#map-modal #map-dynamic {
	display: none;
	width: 100%;
	height: 100%;
}
#map-modal #map-static {
	object-fit: cover;
}

