/* :root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #232635;
  --border: #2e3247;
  --accent: #22c55e;
  --accent2: #f97316;
  --accent3: #3b82f6;
  --text: #e8eaf0;
  --text-muted: #7b82a0;
  --card-bg: #1e2130;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  color verde: #a1d683
} */

:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface2: #f0f1f5;
  --border: #dde1ee;
  --accent: #16a34a;
  --accent2: #ea6c0a;
  --accent3: #2563eb;
  --text: #898989;
  --text-muted: #6b7280;
  --card-bg: #ffffff;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  font-family: sans-serif;
}

/* HEADER */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-icon {
  width: 40px;
  height: 40px;
  background: var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.header-text h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text);
  line-height: 1.2;
}

.header-text p {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 300;
}

.header-count {
  margin-left: auto;
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  text-align: right;
}

.header-count span {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}

/* FILTERS */
.filters-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.search-wrap svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

input[type="text"] {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 12px 9px 36px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

input[type="text"]:focus {
  border-color: var(--accent);
}

input[type="text"]::placeholder {
  color: var(--text-muted);
}

select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 32px 9px 12px;
  font-size: 14px;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237b82a0' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.2s;
}

select:focus {
  border-color: var(--accent);
}

.btn-clear {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-clear:hover {
  border-color: var(--accent2);
  color: var(--accent2);
}

.boton-enlace {
  margin-top: 10px;
  background-color: #74c3d5;
  cursor: pointer;
  width: 100%;
  padding: 10px 20px;
  border: none;
  border-radius: 16px;
}

.boton-enlace a {
  text-decoration: none;
  color: white;
  font-weight: 600;
  width: 100%;
  display: block;
}

/* ACTIVE FILTERS */
.active-filters {
  background: var(--surface);
  padding: 0 24px 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}

.active-filters:empty {
  display: none;
  padding: 0;
  border: none;
}

.filter-tag {
  background: var(--surface2);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: background 0.15s;
}

.filter-tag:hover {
  background: rgba(34, 197, 94, 0.1);
}

.filter-tag .remove {
  font-size: 14px;
  line-height: 1;
}

/* LAYOUT */
.main-layout {
  display: flex;
  height: calc(100vh - 70px);
}

/* MAP */
#map {
  flex: 1;
  min-width: 0;
}

/* SIDEBAR */
.sidebar {
  width: 360px;
  flex-shrink: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.result-count {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}

.cards-list {
  overflow-y: auto;
  flex: 1;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cards-list::-webkit-scrollbar {
  width: 4px;
}

.cards-list::-webkit-scrollbar-track {
  background: transparent;
}

.cards-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.18s;
}

.card:hover {
  border-color: var(--accent);
  border-left-color: var(--accent);
  transform: translateX(2px);
}

.card.active {
  border-color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(34, 197, 94, 0.06);
}

.card-category {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-radius: 4px;
  padding: 2px 7px;
  margin-bottom: 6px;
}

.cat-adaptacion {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

.cat-mitigacion {
  background: rgba(249, 115, 22, 0.2);
  color: #fb923c;
}

.cat-ambas {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}

.cat-default {
  background: rgba(123, 130, 160, 0.2);
  color: #7b82a0;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 5px;
}

.card-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-meta .dot {
  width: 3px;
  height: 3px;
  background: var(--border);
  border-radius: 50%;
}

/* POPUP */
.leaflet-popup-content-wrapper {
  background: var(--surface2) !important;
  border: 1px solid var(--border) !important;
  border-radius: 12px !important;
  box-shadow: var(--shadow) !important;
  color: var(--text) !important;
  max-width: 320px;
}

.leaflet-popup-tip {
  background: var(--surface2) !important;
}

.leaflet-popup-content {
  margin: 0 !important;
  padding: 0 !important;
}

.popup-inner {
  padding: 14px;
}

.popup-inner .p-cat {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}

.popup-inner h3 {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 8px;
}

.popup-inner p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 8px;
}

.popup-inner .p-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.popup-inner .p-meta span {
  display: flex;
  align-items: center;
  gap: 3px;
}

.popup-link {
  display: inline-block;
  margin-top: 10px;
  background: var(--accent);
  color: #0f1117;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  transition: opacity 0.15s;
}

.popup-link:hover {
  opacity: 0.85;
}

.no-results {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.no-results .emoji {
  font-size: 36px;
  margin-bottom: 10px;
}

.no-results p {
  font-size: 14px;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  70% {
    transform: scale(2.5);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 0;
  }
}
/* Responsive */
@media (max-width: 768px) {
  .main-layout {
    flex-direction: column;
    height: auto;
  }

  #map {
    height: 60vw;
    min-height: 450px;
  }

  .sidebar {
    width: 100%;
    height: 350px;
    border-left: none;
    border-top: 1px solid var(--border);
  }

  select {
    width: 100%;
  }
}
