/* Fuerteventura Protagonista — estilos del mapa de agentes.
   Extraído del monolito index.html para reducir su tamaño y permitir
   cacheado independiente. Cargado via <link> desde index.html. */

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'Montserrat', sans-serif; color: #323232; -webkit-font-smoothing: antialiased; }
#container { display: flex; height: 100vh; height: 100dvh; }
#sidebar {
  width: 380px;
  background: #FFFFFF;
  border-right: 1px solid #E8E8E8;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#map { flex: 1; position: relative; }

.sidebar-header { padding: 22px 24px 14px; }
.sidebar-header h1 {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 20px; font-weight: 700; color: #534a44;
  letter-spacing: -0.3px; line-height: 1.15;
}
.sidebar-header p { font-size: 12px; color: #5F6B68; margin-top: 4px; letter-spacing: 0.4px; text-transform: uppercase; font-weight: 600; }

.sidebar-search {
  padding: 4px 24px 16px;
  background: #FFF;
  border-bottom: 1px solid #F0F0F0;
}
.search-input {
  width: 100%; padding: 11px 14px 11px 38px;
  border: 1px solid #E0E0E0; border-radius: 8px;
  font-family: inherit; font-size: 13px;
  background: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23999' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='M11 11l3 3'/%3E%3C/svg%3E") no-repeat 12px center;
  background-size: 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus { outline: none; border-color: #534a44; box-shadow: 0 0 0 3px rgba(83,74,68,0.1); }

.controls {
  display: flex; gap: 6px;
  padding: 12px 24px;
  background: #FAFAFA; border-bottom: 1px solid #F0F0F0;
}
.controls button {
  flex: 1; padding: 8px; font-family: inherit; font-size: 12px; font-weight: 600;
  background: #FFF; border: 1px solid #E0E0E0; border-radius: 6px;
  cursor: pointer; color: #555; transition: all 0.15s;
}
.controls button:hover { border-color: #534a44; color: #534a44; }
.controls button.active {
  background: #534a44; color: #FFF; border-color: #534a44;
  box-shadow: 0 1px 3px rgba(83,74,68,0.3);
}

details.sector-filter {
  padding: 12px 24px;
  border-bottom: 1px solid #F0F0F0;
  background: #FAFAFA;
}
details.sector-filter summary {
  cursor: pointer; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px; color: #666;
  user-select: none; list-style: none;
  display: flex; align-items: center; gap: 6px;
}
details.sector-filter summary::-webkit-details-marker { display: none; }
details.sector-filter summary::before { content: '▸'; transition: transform 0.2s; display: inline-block; font-size: 10px; }
details.sector-filter[open] summary::before { transform: rotate(90deg); }

.sector-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.sector-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 100px;
  font-size: 11px; font-weight: 600; color: #444;
  background: #FFF; border: 1px solid #E0E0E0;
  cursor: pointer; transition: all 0.15s;
  user-select: none;
}
.sector-pill:hover { border-color: var(--c, #534a44); }
.sector-pill.selected {
  border-color: var(--c, #534a44);
  background: var(--c, #534a44);
  color: #FFF;
}
.sector-pill .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--c, #534a44);
  box-shadow: 0 0 0 1px rgba(0,0,0,.1);
}
.sector-pill.selected .dot { background: #FFF; box-shadow: none; }
.sector-pill .count { font-size: 10px; opacity: 0.75; margin-left: 2px; }
/* Atenúa pills cuyo conteo facetado por filtros activos es 0. */
.sector-pill.empty:not(.selected) { opacity: 0.4; }

.results-header {
  padding: 12px 24px 8px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.9px;
  color: #5F6B68; font-weight: 700;
  background: #FFF;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.results-header strong { color: #534a44; font-weight: 700; }
.btn-clear {
  background: transparent;
  border: 1px solid #D8CFC2;
  border-radius: 100px;
  padding: 4px 11px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #534a44;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.btn-clear:hover, .btn-clear:focus-visible {
  background: #534a44;
  color: #FFF;
  border-color: #534a44;
}
.btn-clear[hidden] { display: none; }

.entity-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 16px 20px;
}
.entity-card {
  display: flex; align-items: center;
  padding: 10px 12px;
  background: #FFF;
  border: 1px solid #ECECEC; border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
  gap: 10px;
  width: 100%;
  text-align: left;
  font-family: inherit;
  color: inherit;
}
.entity-card:hover {
  border-color: #534a44;
  box-shadow: 0 3px 12px rgba(83,74,68,0.1);
  transform: translateY(-1px);
}
.entity-card.selected {
  border-color: var(--c, #534a44);
  background: #FBF7F0;
  box-shadow: 0 0 0 1px var(--c, #534a44), 0 3px 12px rgba(83,74,68,0.12);
}
.entity-card .sector-bar {
  width: 4px; align-self: stretch; border-radius: 2px;
  background: var(--c, #999);
  flex-shrink: 0;
}
.entity-card .card-logo {
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: 8px; overflow: hidden;
  background: var(--c, #999);
  display: flex; align-items: center; justify-content: center;
  color: #FFF; font-weight: 700; font-size: 13px;
  letter-spacing: 0.5px;
}
.entity-card .card-logo img {
  width: 100%; height: 100%; object-fit: contain;
  background: #FFF;
}
.entity-card .card-body { flex: 1; min-width: 0; }
.entity-card .name {
  font-size: 13px; font-weight: 600; color: #222;
  margin-bottom: 4px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.entity-card .location {
  font-size: 11.5px; color: var(--c, #999);
  font-weight: 600; line-height: 1.3;
}
.entity-card .sector-label {
  font-size: 9.5px; color: #5F6B68;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  margin-top: 4px;
}

.empty {
  text-align: center; color: #5F6B68; padding: 36px 20px;
  font-size: 13px; font-style: italic;
}

.mapboxgl-popup-content {
  padding: 16px 18px; border-radius: 10px;
  font-family: 'Montserrat', sans-serif;
  max-width: 320px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
}
.mapboxgl-popup-content h3 {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 15px; color: #534a44;
  margin-bottom: 8px; line-height: 1.3;
}
.mapboxgl-popup-content .pop-pill {
  display: inline-block; font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.6px; padding: 3px 9px; border-radius: 100px;
  color: #FFF; font-weight: 700; margin-bottom: 10px;
}
.mapboxgl-popup-content .pop-meta {
  font-size: 12px; color: #555; margin-bottom: 6px; line-height: 1.4;
}
.mapboxgl-popup-content .pop-meta strong { color: #333; }
.mapboxgl-popup-content .pop-links {
  display: flex; gap: 12px; margin-top: 12px;
  flex-wrap: wrap; font-size: 12px;
}
.mapboxgl-popup-content .pop-links a {
  color: #8E6235; text-decoration: none; font-weight: 600;
}
.mapboxgl-popup-content .pop-links a:hover { text-decoration: underline; }

.demo-banner {
  position: absolute; bottom: 12px; left: 12px;
  background: rgba(13, 78, 71, 0.95); color: #FFF;
  padding: 8px 14px; border-radius: 6px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px;
  z-index: 1; box-shadow: 0 2px 10px rgba(0,0,0,.2);
  pointer-events: none;
}
:focus-visible {
  outline: 2px solid #534a44;
  outline-offset: 2px;
  border-radius: 4px;
}
.sector-pill:focus-visible, .entity-card:focus-visible, .controls button:focus-visible, .back-button:focus-visible {
  outline-offset: 2px;
}

/* Patrón estándar para texto solo accesible a lectores de pantalla. */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.drag-handle { display: none; }

.detail-logo-block {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 14px;
}
.detail-logo {
  width: 64px; height: 64px;
  border-radius: 12px; overflow: hidden;
  background: var(--c, #999);
  display: flex; align-items: center; justify-content: center;
  color: #FFF; font-weight: 700; font-size: 22px;
  flex-shrink: 0;
}
.detail-logo img { width: 100%; height: 100%; object-fit: contain; background: #FFF; }
.detail-logo-block .detail-name { margin: 0; flex: 1; }

@media (max-width: 768px) {
  #container { flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; position: relative; }
  #map { flex: 1; width: 100%; height: 100vh; height: 100dvh; }
  #sidebar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    width: 100%;
    height: 72vh;
    border-right: 0;
    border-top: 1px solid #E8E8E8;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -8px 28px rgba(0,0,0,0.2);
    transform: translateY(calc(100% - 138px));
    transition: transform 0.32s cubic-bezier(.4,.0,.2,1);
    z-index: 10;
  }
  #sidebar.expanded { transform: translateY(0) !important; }
  .drag-handle {
    display: block;
    position: relative;
    height: 22px;
    cursor: pointer;
    flex-shrink: 0;
    background: transparent;
    border: 0;
    width: 100%;
  }
  .drag-handle::before {
    content: '';
    position: absolute;
    top: 8px; left: 50%; transform: translateX(-50%);
    width: 44px; height: 4px;
    background: #CCC; border-radius: 2px;
  }
  .sidebar-header { padding-top: 4px; }
  .demo-banner { bottom: 8px; left: 8px; font-size: 10px; padding: 6px 10px; }
}

.view-list { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.view-list.hidden { display: none; }
.view-detail { display: none; flex-direction: column; flex: 1; overflow-y: auto; }
.view-detail.active { display: flex; }

.back-button {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 24px;
  background: #FAFAFA; border: 0; border-bottom: 1px solid #F0F0F0;
  cursor: pointer; width: 100%;
  font-family: inherit; font-size: 12px; font-weight: 600;
  color: #555; transition: all 0.15s;
  text-align: left;
}
.back-button:hover { background: #F2F2F2; color: #534a44; }
.back-button .arrow { font-size: 14px; line-height: 1; }

.detail-content { padding: 20px 24px 32px; }
.detail-name { font-family: 'Libre Baskerville', Georgia, serif; font-size: 19px; font-weight: 700; color: #534a44; line-height: 1.3; margin-bottom: 10px; }
.detail-pill {
  display: inline-block; font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.6px; padding: 4px 10px; border-radius: 100px;
  color: #FFF; font-weight: 700; margin-bottom: 18px;
}
.detail-section { margin-bottom: 16px; }
.detail-section-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px;
  color: #5F6B68; font-weight: 700; margin-bottom: 4px;
}
.detail-section-value {
  font-size: 13px; color: #333; line-height: 1.5;
}
.detail-section-value.loading { color: #BBB; font-style: italic; }
.detail-section-value.empty { color: #BBB; font-style: italic; }

.detail-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; padding-top: 18px; border-top: 1px solid #F0F0F0; }
.detail-action {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 14px; border-radius: 8px;
  text-decoration: none; font-family: inherit; font-size: 13px; font-weight: 600;
  border: 1px solid #E0E0E0; background: #FFF; color: #444;
  cursor: pointer; transition: all 0.15s;
}
.detail-action:hover { border-color: #534a44; color: #534a44; background: #F5EEDA; }
.detail-action.primary { background: #534a44; color: #FFF; border-color: #534a44; }
.detail-action.primary:hover { background: #3d3631; color: #FFF; }

.detail-links-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.detail-link-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 100px;
  background: #F2F2F2; color: #444; text-decoration: none;
  font-size: 11px; font-weight: 600;
  transition: all 0.15s;
}
.detail-link-chip:hover { background: #8E6235; color: #FFF; }
