/**
 * Ausbildungsbörse – Map Styles
 *
 * Works alongside Leaflet's own leaflet.css.
 * All map containers follow the same structure:
 *
 *   .ab-map-wrap            outer wrapper (theme-controlled width)
 *     .ab-map-container     data-* attribute host + flex column
 *       .ab-map-filter-bar  filter buttons (injected by JS)
 *       .ab-map-canvas      Leaflet mounts here
 *
 * Popup structure (injected by JS):
 *   .ab-popup
 *     .ab-popup__header
 *       .ab-popup__company
 *       .ab-popup__city
 *     .ab-popup__divider
 *     ul.ab-popup__list
 *       a.ab-popup__item.ab-popup__item--{ausbildung|praktikum}
 *         .ab-popup__badge.ab-popup__badge--{type}
 *           .ab-popup__badge-dot
 *         .ab-popup__link-row
 *           .ab-popup__title
 *           svg (arrow)
 *         .ab-popup__start
 *           svg (calendar)
 */

/* ============================================================
   Outer wrapper
   ============================================================ */

.ab-map-wrap {
	width: 100%;
	margin-bottom: 2rem;
}

/* ============================================================
   Container
   ============================================================ */

.ab-map-container {
	display: flex;
	flex-direction: column;
	gap: 0;
	width: 100%;
}

/* ============================================================
   Canvas (the actual Leaflet map)
   ============================================================ */

.ab-map-canvas {
	width:      100%;
	height:     560px;
	border-radius: 4px;
	overflow:   hidden;
	background: #e8e0d8;
}

.ab-map-container--single .ab-map-canvas {
	height: 320px;
}

/* ============================================================
   Filter bar
   ============================================================ */

.ab-map-filter-bar {
	display:     flex;
	flex-wrap:   wrap;
	gap:         6px;
	padding:     10px 0;
	align-items: center;
	margin: 1rem 0 1rem;
}

.ab-map-filter {
	display:       inline-flex;
	align-items:   center;
	gap:           6px;
	padding:       5px 14px;
	border:        2px solid #c3c4c7;
	border-radius: 20px;
	background:    #fff;
	color:         #1d2327;
	font-size:     13px;
	font-weight:   500;
	cursor:        pointer;
	transition:    border-color 0.15s, background 0.15s, color 0.15s;
	line-height:   1.4;
}

.ab-map-filter::before {
	content:       '';
	display:       inline-block;
	width:         10px;
	height:        10px;
	border-radius: 50%;
	background:    var( --ab-filter-color, #787c82 );
	flex-shrink:   0;
}

.ab-map-filter[data-filter="all"]::before {
	background: linear-gradient( 135deg, #c9fa05 50%, #805D93 50% );
}

.ab-map-filter:hover {
	border-color: var( --ab-filter-color, #646970 );
}

.ab-map-filter--active[data-filter="all"] {
	background:   #1d2327;
	border-color: #1d2327;
	color:        #fff;
}

/* ============================================================
   Locate-me button
   ============================================================ */

.ab-map-locate {
	display:         flex;
	align-items:     center;
	justify-content: center;
	width:           34px !important;
	height:          34px !important;
	padding:         0;
	background:      #fff;
	border:          none;
	cursor:          pointer;
	color:           #1d2327;
	transition:      background 0.15s, color 0.15s;
}

.ab-map-locate:hover       { background: #f0f6fc; color: #2271b1; }
.ab-map-locate--active     { color: #2271b1; background: #f0f6fc; }

.ab-map-locate--loading svg {
	animation: ab-map-spin 1s linear infinite;
}

@keyframes ab-map-spin {
	to { transform: rotate( 360deg ); }
}

/* ============================================================
   Cluster icons
   ============================================================ */

.ab-cluster-wrapper {
	background: transparent !important;
	border:     none !important;
}

.ab-cluster {
	display:         flex;
	align-items:     center;
	justify-content: center;
	width:           40px;
	height:          40px;
	border-radius:   50%;
	color:           #fff;
	font-size:       14px;
	font-weight:     700;
	box-shadow:      0 2px 6px rgba( 0, 0, 0, 0.25 );
	border:          3px solid rgba( 255, 255, 255, 0.7 );
}

/* ============================================================
   Popup – shell
   ============================================================ */

.ab-popup {
	background:     #fff;
	border-radius:  12px;
	font-family:    'Nunito Sans', system-ui, sans-serif;
	font-size:      13px;
	line-height:    1.4;
	min-width:      220px;
	max-width:      260px;
	display:        flex;
	flex-direction: column;
	padding:        6px 0;
}

/* ============================================================
   Popup – header (Betrieb + Ort)
   ============================================================ */

.ab-popup__header {
	margin-bottom: 10px;
}

.ab-popup__company {
	font-family:  'Bricolage Grotesque', system-ui, sans-serif;
	font-size:    13px;
	font-weight:  700;
	line-height:  1.2;
	color:        #141a22;
}

.ab-popup__city {
	font-size: 12px;
	color:     #9aa0a8;
}

/* ============================================================
   Popup – divider
   ============================================================ */

.ab-popup__divider {
	height:        1px;
	background:    #eef0f2;
	margin-bottom: 9px;
}

/* ============================================================
   Popup – list
   ============================================================ */

.ab-popup__list {
	list-style: none;
	padding:    0;
	margin:     0;
	display:    flex;
	flex-direction: column;
	gap:        7px;
}

/* ============================================================
   Popup – item (the clickable row)
   ============================================================ */

.ab-popup__item {
	display:        flex;
	flex-direction: column;
	gap:            5px;
	padding:        8px 10px;
	border-radius:  6px;
	border:         1px solid #dcdfe3;
	background:     #f7f8f9;
	text-decoration: none;
	cursor:         pointer;
	transition:     background 0.15s, border-color 0.15s;
}

.ab-popup__item--ausbildung:hover {
	background:   #f2f3ec;
	border-color: #e7ecd5;
}

.ab-popup__item--praktikum:hover {
	background:   #eeebf1;
	border-color: #ddd5e3;
}

/* ============================================================
   Popup – badge
   ============================================================ */

.ab-popup__badge {
	display:        inline-flex;
	align-items:    center;
	gap:            5px;
	padding:        2px 8px 2px 6px;
	border-radius:  999px;
	font-size:      10px;
	font-weight:    800;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	align-self:     flex-start;
}

.ab-popup__badge--ausbildung {
	background: #f2f3ec;
	color:      #5b6f0b;
}

.ab-popup__badge--praktikum {
	background: #eeebf1;
	color:      #50395c;
}

.ab-popup__item--ausbildung:hover .ab-popup__badge--ausbildung {
	background: #e7ecd5;
}

.ab-popup__item--praktikum:hover .ab-popup__badge--praktikum {
	background: #ddd5e3;
}

.ab-popup__badge-dot {
	width:         6px;
	height:        6px;
	border-radius: 50%;
	flex-shrink:   0;
}

.ab-popup__badge--ausbildung .ab-popup__badge-dot { background: #9ec309; }
.ab-popup__badge--praktikum  .ab-popup__badge-dot { background: #805D93; }

/* ============================================================
   Popup – title row (text + arrow)
   ============================================================ */

.ab-popup__link-row {
	display:         flex;
	align-items:     center;
	justify-content: space-between;
	gap:             4px;
}

.ab-popup__title {
	font-size:   12px;
	font-weight: 700;
	color:       #252d38;
	line-height: 1.3;
}

.ab-popup__link-row svg {
	width:        11px;
	height:       11px;
	stroke:       #9aa0a8;
	fill:         none;
	stroke-width: 2.5;
	flex-shrink:  0;
	transition:   stroke 0.15s;
}

.ab-popup__item--ausbildung:hover .ab-popup__link-row svg { stroke: #5b6f0b; }
.ab-popup__item--praktikum:hover  .ab-popup__link-row svg { stroke: #50395c; }

/* ============================================================
   Popup – start date
   ============================================================ */

.ab-popup__start {
	display:     inline-flex;
	align-items: center;
	gap:         4px;
	font-size:   11px;
	font-weight: 600;
	color:       #6b7280;
	align-self:  flex-start;
}

.ab-popup__start svg {
	width:        11px;
	height:       11px;
	stroke:       currentColor;
	fill:         none;
	stroke-width: 2;
}

/* ============================================================
   No-coordinates notice
   ============================================================ */

.ab-map-no-coords {
	text-align: center;
	padding:    20px;
	color:      #646970;
	font-style: italic;
}

/* ============================================================
   Responsive
   ============================================================ */

@media screen and ( max-width: 782px ) {
	.ab-map-canvas {
		height: 320px;
	}

	.ab-map-container--single .ab-map-canvas {
		height: 240px;
	}

	.ab-map-filter {
		font-size: 12px;
		padding:   4px 10px;
	}
}

/* ============================================================
   Reduced motion
   ============================================================ */

@media ( prefers-reduced-motion: reduce ) {
	.ab-map-locate--loading svg {
		animation: none;
	}
	.ab-popup__item {
		transition: none;
	}
}