/* ==========================================================================
 * Планирование: карта России, модалки планировщика, таблица очков
 * ========================================================================== */

/* --- Общие модалки планирования --- */
.plan-modal-overlay {
	position: fixed;
	inset: 0;
	z-index: 10050;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(15, 23, 42, 0.45);
}

.plan-modal {
	box-sizing: border-box;
	width: 100%;
	max-height: calc(100vh - 32px);
	overflow: auto;
	background: var(--color-surface);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-card), 0 16px 48px rgba(0, 0, 0, 0.18);
}

.plan-modal-md {
	max-width: 480px;
}

.plan-modal-lg {
	max-width: 920px;
}

.plan-modal-xl {
	max-width: 1100px;
}

.plan-modal-body--map {
	padding: var(--space-md) var(--space-lg) var(--space-lg);
}

.plan-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-md);
	padding: var(--space-lg) var(--space-xl);
	border-bottom: 1px solid var(--color-border-light);
}

.plan-modal-header h3 {
	margin: 0;
	font-size: var(--font-size-lg);
	font-weight: 600;
	color: var(--color-text);
}

.plan-modal-close {
	flex-shrink: 0;
	width: 32px;
	height: 32px;
	padding: 0;
	border: none;
	border-radius: var(--radius-md);
	background: transparent;
	color: var(--color-text-muted);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
}

.plan-modal-close:hover {
	background: var(--color-bg-secondary);
	color: var(--color-text);
}

.plan-modal-body {
	padding: var(--space-lg) var(--space-xl) var(--space-xl);
}

/* --- Таблица очков --- */
.plan-points-table-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.plan-points-table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--font-size-sm);
}

.plan-points-table th,
.plan-points-table td {
	padding: 10px 12px;
	border-bottom: 1px solid var(--color-border-light);
	text-align: left;
}

.plan-points-table th {
	font-weight: 600;
	color: var(--color-text-muted);
	background: var(--color-bg);
}

.plan-points-table td:last-child {
	font-weight: 600;
	color: var(--color-primary-dark);
	white-space: nowrap;
}

/* --- Карта России --- */
.rmap {
	display: flex;
	flex-direction: column;
	gap: var(--space-md);
	min-height: 480px;
}

.rmap-map {
	position: relative;
	flex: 1 1 auto;
	border: 1px solid var(--color-border-light);
	border-radius: var(--radius-md);
	background: #eef2f7;
	overflow: hidden;
	min-height: 420px;
}

.rmap-map-inner {
	position: relative;
	width: 100%;
	aspect-ratio: 800 / 500;
	min-height: 380px;
	max-height: min(68vh, 560px);
}

.rmap-map-svg {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	pointer-events: none;
	user-select: none;
}

.rmap-map-fallback {
	position: absolute;
	inset: 0;
	background:
		radial-gradient(circle at 20% 55%, rgba(114, 109, 200, 0.08) 0%, transparent 45%),
		radial-gradient(circle at 55% 40%, rgba(46, 201, 183, 0.08) 0%, transparent 40%),
		linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
}

.rmap-pins {
	position: absolute;
	inset: 0;
}

.rmap-pin {
	position: absolute;
	transform: translate(-50%, -50%);
	cursor: pointer;
	z-index: 2;
	width: 0;
	height: 0;
}

.rmap-pin-marker {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	width: 16px;
	height: 16px;
	border: 2.5px solid #fff;
	border-radius: 50%;
	box-shadow: 0 2px 8px rgba(15, 23, 42, .35);
	transition: transform .12s;
}

.rmap-pin:hover .rmap-pin-marker {
	transform: translate(-50%, -50%) scale(1.15);
}

.rmap-pin--home .rmap-pin-marker {
	background: var(--color-success, #22c55e);
	width: 18px;
	height: 18px;
}

.rmap-pin--tour .rmap-pin-marker {
	background: #2563eb;
}

.rmap-pin--recommended .rmap-pin-marker {
	background: #ea580c;
}

.rmap-pin--group .rmap-pin-marker {
	width: 20px;
	height: 20px;
	background: #7c3aed;
}

.rmap-pin-count {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(2px, -14px);
	min-width: 16px;
	height: 16px;
	padding: 0 4px;
	border-radius: 999px;
	background: #0f172a;
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	line-height: 16px;
	text-align: center;
	pointer-events: none;
}

.rmap-coords-debug {
	position: absolute;
	left: 8px;
	bottom: 8px;
	z-index: 5;
	padding: 4px 8px;
	border-radius: var(--radius-sm);
	background: rgba(15, 23, 42, .75);
	color: #fff;
	font-size: 11px;
	font-family: ui-monospace, monospace;
	pointer-events: none;
}

.rmap-floating-tooltip {
	display: none;
	position: absolute;
	z-index: 20;
	max-width: 240px;
	padding: 8px 10px;
	border-radius: var(--radius-sm);
	background: rgba(15, 23, 42, .92);
	color: #fff;
	pointer-events: none;
	box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
}

.rmap-tooltip-title {
	font-size: 12px;
	font-weight: 600;
	line-height: 1.3;
	margin-bottom: 2px;
}

.rmap-tooltip-meta {
	font-size: 11px;
	line-height: 1.35;
	color: rgba(255, 255, 255, .85);
	white-space: normal;
}

.rmap-empty {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--space-xl);
	color: var(--color-text-muted);
	font-size: var(--font-size-sm);
	text-align: center;
}

.rmap-timeline {
	display: flex;
	flex-direction: column;
	gap: var(--space-sm);
}

.rmap-timeline-label {
	font-size: var(--font-size-xs);
	color: var(--color-text-muted);
}

.rmap-timeline-track {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.rmap-week-btn {
	min-width: 52px;
	padding: 6px 10px;
	border: 1px solid var(--color-border-light);
	border-radius: var(--radius-md);
	background: var(--color-surface);
	color: var(--color-text);
	font-size: var(--font-size-xs);
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.rmap-week-btn:hover {
	border-color: var(--color-primary);
	color: var(--color-primary-dark);
}

.rmap-week-btn.is-active {
	border-color: var(--color-primary);
	background: var(--color-primary-light);
	color: var(--color-primary-dark);
	font-weight: 600;
}

.rmap-slider {
	width: 100%;
	accent-color: var(--color-primary);
}

@media (max-width: 640px) {
	.plan-modal-body {
		padding: var(--space-md);
	}

	.rmap-map,
	.rmap-map-inner {
		min-height: 220px;
	}
}
