/* ============================================
   ESTILOS DEL MAPA INTERACTIVO DE COLOMBIA
   ============================================ */

/* === VARIABLES DE COLORES === */
:root {
  /* Colores de fondo */
  --bg: #f0f4f8;                    /* Fondo general de la página (gris claro) */
  --panel: #ffffff;                 /* Fondo de los contenedores (blanco) */
  --panel-border: #e2e8f0;          /* Borde de los contenedores (gris muy claro) */
  
  /* Colores de texto */
  --text: #1e293b;                  /* Texto principal (gris oscuro) */
  --text-muted: #64748b;            /* Texto secundario/deshabilitado (gris medio) */
  --accent-primary: #0369a1;        /* Color de acento principal (azul institucional) */
  
  /* Colores del mapa */
  --map-bg: #faf8f3;                /* Fondo del contenedor del mapa (crema suave) */
  
  /* Colores de departamentos */
  --dept-fill: #e8d5c4;             /* Relleno normal de departamentos (beige rosado pastel) */
  --dept-stroke: #b8a192;           /* Borde normal de departamentos (marrón claro) */
  --dept-hover: #d4b5a0;            /* Relleno al pasar el mouse sobre departamento (taupe claro) */
  --dept-active: #a8c5d1;           /* Relleno cuando un departamento está seleccionado (azul pastel) */
  
  /* Colores de municipios */
  --muni-fill: #f5e6d8;             /* Relleno normal de municipios (crema más claro) */
  --muni-stroke: #c9b8a8;           /* Borde normal de municipios (beige) */
  --muni-hover: #b8d4e0;            /* Relleno al pasar el mouse sobre municipio (azul grisáceo pastel) */
  
  /* Sombras */
  --shadow: 0 4px 20px rgba(0,0,0,.1);      /* Sombra grande para contenedores */
  --shadow-sm: 0 2px 8px rgba(0,0,0,.08);   /* Sombra pequeña para elementos */
}

/* === CONTENEDOR DEL MAPA COLOMBIA === */
.col-map {
  width: 100%;
  max-width: 100%;
}

.col-map__card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: visible;
  padding: 20px;
  max-width: 450px;
  margin: 0 auto;
}

.col-map__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.col-map__meta {
  color: var(--text-muted);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.col-map__title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.col-map__back-btn {
  appearance: none;
  border: 1px solid var(--accent-primary);
  background: #ffffff;
  color: var(--accent-primary);
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  box-shadow: var(--shadow-sm);
}

.col-map__back-btn:hover {
  background: var(--accent-primary);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(3,105,161,.3);
}

.col-map__back-btn:active {
  transform: translateY(0);
}

.col-map__back-btn[hidden] {
  display: none;
}

.col-map__canvas {
  background: var(--map-bg);
  border-radius: 12px;
  width: 100%;
  max-width: 350px;
  height: 400px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  box-shadow: inset 0 2px 8px rgba(0,0,0,.2);
  position: relative;
  margin: 0 auto;
}

.col-map__canvas svg {
  width: 100%;
  height: 100%;
  max-height: 100%;
}

.col-map__canvas svg {
  width: 100%;
  height: auto;
  display: block;
}

/* === SELECTORES DE DEPARTAMENTO Y MUNICIPIO === */
.col-map__selectors {
  margin-top: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 640px) {
  .col-map__selectors {
    grid-template-columns: 1fr;
  }
}

.col-map__selector-group {
  position: relative;
}

/* Dropdown personalizado */
.col-map__dropdown {
  position: relative;
  width: 100%;
}

.col-map__dropdown.open {
  z-index: 10000;
}

.col-map__dropdown-toggle {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  background: white;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s;
  min-height: 44px;
}

.col-map__dropdown-toggle:hover {
  border-color: var(--accent-primary);
  background: #f8fafc;
  box-shadow: 0 2px 8px rgba(3, 105, 161, 0.1);
}

.col-map__dropdown.open .col-map__dropdown-toggle {
  border-color: var(--accent-primary);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  box-shadow: 0 2px 8px rgba(3, 105, 161, 0.15);
}

.col-map__dropdown-toggle:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(3, 105, 161, 0.1);
}

.col-map__dropdown-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.col-map__dropdown-text.placeholder {
  color: #94a3b8;
  font-weight: 400;
}

.col-map__dropdown-arrow {
  flex-shrink: 0;
  margin-left: 8px;
  transition: transform 0.25s ease;
  color: #64748b;
  font-size: 12px;
}

.col-map__dropdown.open .col-map__dropdown-arrow {
  transform: rotate(180deg);
  color: var(--accent-primary);
}

.col-map__dropdown-menu {
  position: absolute;
  top: calc(100% - 2px);
  left: 0;
  right: 0;
  background: white;
  border: 2px solid var(--accent-primary);
  border-top: none;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
  z-index: 9999;
  display: none;
  flex-direction: column;
  max-height: 340px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.col-map__dropdown.open .col-map__dropdown-menu {
  display: flex;
  opacity: 1;
  pointer-events: all;
  animation: dropdown-slide 0.2s ease-out;
}

@keyframes dropdown-slide {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.col-map__dropdown-search {
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-bottom: 2px solid #e2e8f0;
  font-size: 14px;
  color: var(--text);
  background: #f8fafc;
  flex-shrink: 0;
}

.col-map__dropdown-search::placeholder {
  color: #94a3b8;
}

.col-map__dropdown-search:focus {
  outline: none;
  background: white;
  border-bottom-color: var(--accent-primary);
}

.col-map__dropdown-list {
  overflow-y: auto;
  flex: 1;
  padding: 8px;
}

.col-map__dropdown-list::-webkit-scrollbar {
  width: 8px;
}

.col-map__dropdown-list::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.col-map__dropdown-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.col-map__dropdown-list::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.col-map__dropdown-item {
  padding: 12px 16px;
  cursor: pointer;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  transition: all 0.15s ease;
  user-select: none;
  margin-bottom: 2px;
}

.col-map__dropdown-item:hover {
  background: #e0f2fe;
  color: var(--accent-primary);
  transform: translateX(2px);
}

.col-map__dropdown-item.selected {
  background: linear-gradient(135deg, #0369a1 0%, #0284c7 100%);
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(3, 105, 161, 0.2);
}

.col-map__dropdown-item.selected:hover {
  transform: translateX(0);
  background: linear-gradient(135deg, #075985 0%, #0369a1 100%);
}

.col-map__dropdown-item.hidden {
  display: none;
}

.col-map__helper {
  margin-top: 16px;
  padding: 12px 16px;
  background: #f1f5f9;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  font-size: 14px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 12px;
}

.col-map__helper-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: var(--accent-primary);
  color: white;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

/* === ESTILOS DE POLÍGONOS (PATHS) === */
.col-map__canvas .depts path,
.col-map__canvas .munis path {
  transform-box: fill-box;
  transform-origin: center;
  cursor: pointer;
  outline: none;
}

/* === DEPARTAMENTOS - ESTADO NORMAL === */
.col-map__canvas .depts .shape {
  fill: var(--dept-fill);
  stroke: var(--dept-stroke);
  stroke-width: 1.2;
  transition: all .2s cubic-bezier(.4,0,.2,1);
}

/* === DEPARTAMENTOS CON PROYECTOS ART === */
.col-map__canvas .depts .shape.has-projects {
  fill: inherit;
  stroke: #2563eb;
  stroke-width: 1.3;
}

.col-map__canvas .depts .shape.has-projects:hover {
  fill: #3b7bc7;
  stroke: #1d4ed8;
  stroke-width: 1.6;
}

/* === DEPARTAMENTOS - HOVER (al pasar el mouse) === */
.col-map__canvas .depts .shape:hover,
.col-map__canvas .depts .shape:focus {
  fill: var(--dept-hover);
  stroke: #9d8b7c;
  stroke-width: 1.5;
  transform: scale(1.015);
  filter: drop-shadow(0 2px 8px rgba(212,181,160,.4));
}

/* === DEPARTAMENTOS - ACTIVO (seleccionado) === */
.col-map__canvas .depts .shape.is-active {
  fill: var(--dept-active);
  stroke: #7a9aab;
  stroke-width: 1.8;
  filter: drop-shadow(0 3px 12px rgba(168,197,209,.5));
}

/* === MUNICIPIOS - ESTADO NORMAL === */
.col-map__canvas .munis .shape {
  fill: var(--muni-fill);
  stroke: var(--muni-stroke);
  stroke-width: 0.6;
  transition: all .18s cubic-bezier(.4,0,.2,1);
}

/* === MUNICIPIOS - HOVER (al pasar el mouse) === */
.col-map__canvas .munis .shape:hover,
.col-map__canvas .munis .shape:focus {
  fill: #a8c5d1;
  stroke: #7a9aab;
  stroke-width: 1.5;
  transform: scale(1.01);
  filter: drop-shadow(0 2px 8px rgba(168,197,209,.5));
}

/* === MUNICIPIO SELECCIONADO === */
.col-map__canvas .munis .shape.selected-muni {
  fill: #a8c5d1;
  stroke: #0369a1;
  stroke-width: 0.5;
  filter: drop-shadow(0 2px 6px rgba(3,105,161,.4));
  z-index: 10;
}

/* === TOOLTIP (etiqueta flotante) === */
.col-map__tooltip {
  position: fixed;
  z-index: 999;
  pointer-events: none;
  background: rgba(30,41,59,.95);
  color: #f8fafc;
  border: 1px solid rgba(148,163,184,.3);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  opacity: 0;
  transform: translate(-50%, calc(-100% - 40px));
  transition: opacity .15s, transform .15s;
  backdrop-filter: blur(4px);
}

/* Tooltip visible */
.col-map__tooltip.show {
  opacity: 1;
  transform: translate(-50%, calc(-100% - 38px));
}
