/**
 * ConstRoom Japan Map Styles - タイルグリッド形式
 * 地域別工務店数を表示するインタラクティブな日本地図
 */

/* ========== Container Styles ========== */
.cr-japan-map-container,
.cr-japan-map__container {
	position: relative;
	width: 100%;
	max-width: 900px;
	margin: 0 auto;
	aspect-ratio: 4 / 3.2;
}

/* ========== Map Wrapper ========== */
.cr-map-wrapper {
	position: relative;
	width: 100%;
	height: 100%;
	background: #ffffff;
	border-radius: 0.75rem;
	box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
	border: 1px solid #e2e8f0;
	padding: 2rem;
	box-sizing: border-box;
}

@media (max-width: 768px) {
	.cr-map-wrapper {
		padding: 1rem;
	}
}

/* ========== SVG Styles ========== */
.cr-japan-map-svg,
.cr-japan-map__svg {
	width: 100%;
	height: 100%;
	display: block;
	overflow: visible;
}

/* ========== Prefecture Tile Styles ========== */
.cr-pref-rect {
	cursor: pointer;
	rx: 6;
	ry: 6;
	stroke: #ffffff;
	stroke-width: 2.5;
}

.cr-pref-rect:focus-visible {
	outline: 3px solid #2563eb;
	outline-offset: 2px;
}

/* ========== Region Color Palette ========== */
.cr-region-hokkaido {
	fill: #8b5cf6;
}

.cr-region-tohoku {
	fill: #3b82f6;
}

.cr-region-kanto {
	fill: #10b981;
}

.cr-region-chubu {
	fill: #f59e0b;
}

.cr-region-kinki {
	fill: #f97316;
}

.cr-region-chugoku {
	fill: #ef4444;
}

.cr-region-shikoku {
	fill: #ec4899;
}

.cr-region-kyushu,
.cr-region-okinawa {
	fill: #14b8a6;
}

/* ========== Prefecture Label Styles ========== */
.cr-pref-label,
.cr-japan-map__label {
	font-family:
		-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell",
		"Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
	font-size: 11px;
	font-weight: 700;
	fill: #ffffff;
	text-anchor: middle;
	dominant-baseline: middle;
	pointer-events: none;
	user-select: none;
	text-shadow:
		0 1px 3px rgba(0, 0, 0, 0.6),
		0 0 1px rgba(0, 0, 0, 0.4);
}

/* ========== Badge Styles (Regional Constructor Count) ========== */
.cr-badge-group {
	position: absolute;
	pointer-events: none;
}

.cr-badge,
.cr-japan-map__badge {
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	font-size: 18px;
	font-weight: 700;
	color: #ffffff;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	pointer-events: auto;
	cursor: pointer;
	text-decoration: none;
	font-family:
		-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell",
		"Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
}

.cr-badge:focus,
.cr-japan-map__badge:focus {
	outline: 2px solid #2563eb;
	outline-offset: 2px;
}

/* Region-specific badge colors */
.cr-badge-hokkaido,
.cr-japan-map__badge[data-area="hokkaido"] {
	background: #a78bfa;
}

.cr-badge-tohoku,
.cr-japan-map__badge[data-area="tohoku"] {
	background: #60a5fa;
}

.cr-badge-kanto,
.cr-japan-map__badge[data-area="kanto"] {
	background: #34d399;
}

.cr-badge-chubu,
.cr-japan-map__badge[data-area="chubu"] {
	background: #fbbf24;
}

.cr-badge-kinki,
.cr-japan-map__badge[data-area="kinki"] {
	background: #fb923c;
}

.cr-badge-chugoku,
.cr-japan-map__badge[data-area="chugoku"] {
	background: #f87171;
}

.cr-badge-shikoku,
.cr-japan-map__badge[data-area="shikoku"] {
	background: #f472b6;
}

.cr-badge-kyushu,
.cr-japan-map__badge[data-area="kyushu"],
.cr-japan-map__badge[data-area="okinawa"] {
	background: #2dd4bf;
}

/* ========== Tooltip Styles ========== */
#cr-tooltip {
	position: absolute;
	display: none;
	padding: 0.5rem 0.75rem;
	background: rgba(30, 41, 59, 0.95);
	color: #ffffff;
	border-radius: 0.375rem;
	font-size: 12px;
	font-weight: 500;
	white-space: nowrap;
	z-index: 1000;
	pointer-events: none;
	font-family:
		-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell",
		"Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
	box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#cr-tooltip.active {
	display: block;
}

/* ========== Region Border Styles ========== */
.cr-region-border-path {
	fill: none;
	stroke-width: 5;
	stroke-linecap: round;
	stroke-linejoin: round;
	pointer-events: none;
	opacity: 0.8;
	filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.15));
}

/* ========== Badge SVG Styles ========== */
.cr-badge-group {
	pointer-events: auto;
	cursor: pointer;
}

.cr-badge-bg {
	fill: rgba(255, 255, 255, 0.98);
	filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
	stroke-width: 4;
}

.cr-badge-text {
	font-family:
		-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell",
		"Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
	font-size: 18px;
	font-weight: 800;
	text-anchor: middle;
	fill: #1e293b;
	dominant-baseline: central;
	pointer-events: none;
}

/* ========== Tooltip Content Styles ========== */
.cr-tooltip-region {
	font-size: 10px;
	font-weight: 600;
	margin-bottom: 2px;
}

.cr-tooltip-name {
	font-size: 13px;
	font-weight: 700;
}

.cr-tooltip-count {
	font-size: 14px;
	font-weight: 700;
	margin-top: 4px;
	color: #ffffff;
}

/* ========== Accessibility Styles ========== */
.cr-japan-map__sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border-width: 0;
}

/* ========== Legend Styles ========== */
.cr-japan-map__legend {
	margin-top: 1rem;
	padding: 1rem;
	background: #f8fafc;
	border-radius: 0.375rem;
	border: 1px solid #e2e8f0;
	text-align: center;
}

.cr-japan-map__legend-text {
	margin: 0;
	font-size: 14px;
	color: #64748b;
	font-family:
		-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell",
		"Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
}

/* ========== Title Styles ========== */
.cr-japan-map__title {
	text-align: center;
	font-size: 1.5rem;
	font-weight: bold;
	color: #1e293b;
	margin-bottom: 1.5rem;
	margin-top: 0;
}

/* ========== Responsive Design ========== */
@media (max-width: 768px) {
	.cr-japan-map-container,
	.cr-japan-map__container {
		aspect-ratio: 1 / 1.2;
	}

	.cr-japan-map__title {
		font-size: 1.25rem;
		margin-bottom: 1rem;
	}

	.cr-pref-label,
	.cr-japan-map__label {
		font-size: 9px;
	}

	.cr-badge,
	.cr-japan-map__badge {
		width: 40px;
		height: 40px;
		font-size: 14px;
	}

	.cr-badge-text {
		font-size: 16px;
	}

	#cr-tooltip {
		font-size: 11px;
	}
}

@media (max-width: 480px) {
	.cr-japan-map-container,
	.cr-japan-map__container {
		aspect-ratio: 1 / 1.4;
	}

	.cr-japan-map__title {
		font-size: 1.125rem;
	}

	.cr-pref-label,
	.cr-japan-map__label {
		font-size: 8px;
	}

	.cr-badge,
	.cr-japan-map__badge {
		width: 36px;
		height: 36px;
		font-size: 12px;
	}

	.cr-badge-text {
		font-size: 14px;
	}

	.cr-map-wrapper {
		padding: 0.75rem;
	}

	.cr-japan-map__legend-text {
		font-size: 0.75rem;
	}
}

/* ========== High Contrast Mode ========== */
@media (prefers-contrast: high) {
	.cr-pref-rect {
		stroke-width: 2;
	}

	.cr-badge,
	.cr-japan-map__badge {
		border: 2px solid #ffffff;
	}
}

/* ========== Print Styles ========== */
@media print {
	.cr-japan-map-container,
	.cr-japan-map__container {
		break-inside: avoid;
	}
}
