:root {
  /* Aproximación a estética institucional UNSTA: azul + dorado, base clara */
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel2: #ffffff;
  --text: #0e1b2a;
  --muted: #4d637a;
  --line: rgba(7, 25, 45, 0.10);
  --shadow: 0 18px 45px rgba(7, 25, 45, 0.10);

  --brand: #1d4a8d;
  --brandDark: #103464;
  --gold: #c9a24a;

  --academic: var(--brand);
  --services: var(--gold);
  --outdoor: #2f7f9b;

  --radius: 16px;
  --radiusSm: 12px;
  --fontBody: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  --fontTitle: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--fontBody);
  color: var(--text);
  background: radial-gradient(1000px 700px at 15% 10%, rgba(29, 74, 141, 0.16), transparent 55%),
    radial-gradient(900px 700px at 85% 22%, rgba(201, 162, 74, 0.18), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.55)), var(--bg);
}

.app {
  height: 100%;
  display: flex;
  gap: 14px;
  padding: 14px;
}

.sidebar {
  width: 380px;
  min-width: 320px;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.sidebar__header {
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(135deg, var(--brandDark), var(--brand));
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand__logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  padding: 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.16);
  /* Forzar versión "blanca" del logo sobre header azul */
  filter: brightness(0) invert(1) drop-shadow(0 6px 18px rgba(0, 0, 0, 0.28));
}

.brand__text {
  min-width: 0;
}

.brand__title {
  font-family: var(--fontTitle);
  font-weight: 800;
  letter-spacing: 0.2px;
  font-size: 18px;
}

.brand__subtitle {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
}

.sidebar__controls {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
  background: linear-gradient(180deg, rgba(29, 74, 141, 0.06), transparent 55%);
}

.floorSection {
  border: 1px solid rgba(7, 25, 45, 0.10);
  background: rgba(255, 255, 255, 0.72);
  border-radius: 14px;
  padding: 10px 10px 8px;
  display: grid;
  gap: 10px;
}

.floorSection__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.floorSection__title {
  font-family: var(--fontTitle);
  font-weight: 800;
  letter-spacing: 0.2px;
  font-size: 14px;
  color: rgba(14, 27, 42, 0.92);
}

.floorSection__hint {
  font-size: 11px;
  color: rgba(14, 27, 42, 0.60);
  text-align: right;
}

.floorPicker {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.floorBtn {
  border: 1px solid rgba(7, 25, 45, 0.14);
  background: rgba(255, 255, 255, 0.92);
  color: rgba(14, 27, 42, 0.85);
  padding: 8px 0;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
}

.floorBtn:hover {
  border-color: rgba(29, 74, 141, 0.35);
}

.floorBtn[aria-selected="true"] {
  background: linear-gradient(135deg, rgba(29, 74, 141, 0.12), rgba(201, 162, 74, 0.10));
  border-color: rgba(29, 74, 141, 0.28);
  color: rgba(16, 52, 100, 0.95);
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: rgba(14, 27, 42, 0.72);
}

.toggle input {
  width: 16px;
  height: 16px;
}

.field {
  display: grid;
  gap: 6px;
}

.field__label {
  font-size: 12px;
  color: var(--muted);
}

.field__input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(7, 25, 45, 0.16);
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
  outline: none;
}

.field__input:focus {
  border-color: rgba(29, 74, 141, 0.55);
  box-shadow: 0 0 0 3px rgba(29, 74, 141, 0.12);
}

.field__hint {
  font-size: 11px;
  color: rgba(14, 27, 42, 0.60);
}

.sidebar__listHeader {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 12px 18px 10px;
}

.sidebar__listTitle {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(14, 27, 42, 0.78);
}

.sidebar__listMeta {
  font-size: 12px;
  color: var(--muted);
}

.places {
  padding: 0 10px 10px;
  overflow: auto;
  flex: 1;
}

.place {
  display: grid;
  gap: 6px;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
}

.place:hover {
  background: rgba(29, 74, 141, 0.05);
  border-color: rgba(29, 74, 141, 0.10);
}

.place[aria-selected="true"] {
  background: rgba(29, 74, 141, 0.10);
  border-color: rgba(29, 74, 141, 0.22);
}

.place__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.place__titleWrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.place__index {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 12px;
  color: rgba(0, 0, 0, 0.88);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(7, 25, 45, 0.14);
  flex: 0 0 auto;
}

.place__name {
  font-weight: 650;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(7, 25, 45, 0.16);
  color: rgba(14, 27, 42, 0.85);
  background: rgba(255, 255, 255, 0.85);
}

.place__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(14, 27, 42, 0.70);
  font-size: 12px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px rgba(29, 74, 141, 0.10);
}

.dot--academic {
  background: var(--academic);
  box-shadow: 0 0 0 4px rgba(29, 74, 141, 0.10);
}
.dot--services {
  background: var(--services);
  box-shadow: 0 0 0 4px rgba(201, 162, 74, 0.12);
}
.dot--outdoor {
  background: var(--outdoor);
  box-shadow: 0 0 0 4px rgba(47, 127, 155, 0.12);
}

.sidebar__footer {
  padding: 12px 18px 16px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(29, 74, 141, 0.04), rgba(201, 162, 74, 0.04));
}

.legend {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.legend__row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: rgba(14, 27, 42, 0.70);
}

.legend__dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--accent);
}
.legend__dot--academic {
  background: var(--academic);
}
.legend__dot--services {
  background: var(--services);
}
.legend__dot--outdoor {
  background: var(--outdoor);
}

.hint {
  font-size: 12px;
  color: rgba(14, 27, 42, 0.60);
  line-height: 1.35;
}

.mapPanel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-width: 0;
}

.topbar__logo {
  display: none;
}

.mapPanel__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  flex-shrink: 0;
}

.mapPanel__title {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(14, 27, 42, 0.70);
}

.compass {
  width: 30px;
  height: 30px;
  position: relative;
  border-radius: 999px;
  border: 1px solid rgba(7, 25, 45, 0.14);
  background: rgba(255, 255, 255, 0.85);
}

.compass__ring {
  position: absolute;
  inset: 5px;
  border-radius: 999px;
  border: 1px dashed rgba(7, 25, 45, 0.18);
}

.compass__n,
.compass__e,
.compass__s,
.compass__o {
  position: absolute;
  font-size: 7px;
  color: rgba(14, 27, 42, 0.65);
  font-weight: 700;
}
.compass__n {
  top: 1px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(29, 74, 141, 0.95);
}
.compass__s {
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
}
.compass__e {
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
}
.compass__o {
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
}

.map {
  position: relative;
  flex: 1;
  min-height: 360px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(29, 74, 141, 0.06), rgba(255, 255, 255, 0.35)),
    linear-gradient(90deg, rgba(29, 74, 141, 0.06), transparent 35%, rgba(201, 162, 74, 0.06));
}

.map::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(16, 52, 100, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 52, 100, 0.06) 1px, transparent 1px),
    linear-gradient(rgba(16, 52, 100, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 52, 100, 0.035) 1px, transparent 1px);
  background-size: 80px 80px, 80px 80px, 20px 20px, 20px 20px;
  opacity: 0.85;
  pointer-events: none;
}

.map__content {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
  will-change: transform;
  touch-action: none;
}

.map__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: saturate(1.03) contrast(1.02);
  pointer-events: none;
}

.map__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  pointer-events: none;
}

.map__overlay {
  position: absolute;
  inset: 0;
}

.map__vector {
  width: 100%;
  height: 100%;
  display: block;
}

.shape {
  cursor: pointer;
}

.shape.is-dim {
  opacity: 0.22;
}

.shape.is-selected .shape__rect {
  stroke: rgba(29, 74, 141, 0.9);
  stroke-width: 0.7;
}

.shape__rect {
  stroke: rgba(7, 25, 45, 0.28);
  stroke-width: 0.35;
}

.shape__labelCircle {
  fill: rgba(255, 255, 255, 0.92);
  stroke: rgba(7, 25, 45, 0.18);
  stroke-width: 0.35;
}

.shape__labelText {
  font-family: ui-sans-serif, system-ui;
  font-weight: 900;
  fill: rgba(0, 0, 0, 0.88);
  font-size: 3.3px;
  dominant-baseline: middle;
  text-anchor: middle;
}

.shape__smallTag {
  font-family: ui-sans-serif, system-ui;
  font-weight: 800;
  fill: rgba(16, 52, 100, 0.92);
  font-size: 2.2px;
  dominant-baseline: middle;
  text-anchor: middle;
}

/* Hotspot divs (circulos HTML sobre la imagen) */
.hotspotDiv {
  position: absolute;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 2;
}

.hotspotDiv__label {
  display: none;
}

/* En admin mode mostrar números y estilo visible */
.admin-mode .hotspotDiv {
  width: 28px;
  height: 28px;
  background: rgba(29, 74, 141, 0.85);
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-mode .hotspotDiv__label {
  display: block;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

/* Círculo difuminado al seleccionar un lugar */
.hotspotDiv.is-selected {
  z-index: 3;
}

.hotspotDiv__pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 70px;
  height: 70px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(29, 74, 141, 0.18) 0%, rgba(29, 74, 141, 0.06) 50%, transparent 70%);
  border: 1px solid rgba(29, 74, 141, 0.08);
  pointer-events: none;
  animation: pulseIn 0.4s ease-out;
}

@keyframes pulseIn {
  from { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
  to   { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.hotspotDiv.is-dim {
  opacity: 0.3;
}

.pin {
  position: absolute;
  transform: translate(-50%, -100%);
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.pin__core {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  background: var(--academic);
  box-shadow: 0 12px 26px rgba(7, 25, 45, 0.22), 0 0 0 6px rgba(29, 74, 141, 0.12);
}

.pin--services .pin__core {
  background: var(--services);
  box-shadow: 0 12px 26px rgba(7, 25, 45, 0.22), 0 0 0 6px rgba(201, 162, 74, 0.12);
}
.pin--outdoor .pin__core {
  background: var(--outdoor);
  box-shadow: 0 12px 26px rgba(7, 25, 45, 0.22), 0 0 0 6px rgba(47, 127, 155, 0.12);
}

.pin__tag {
  margin-top: 6px;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 999px;
  border: 1px solid rgba(7, 25, 45, 0.14);
  background: rgba(255, 255, 255, 0.90);
  color: rgba(14, 27, 42, 0.88);
  font-size: 11px;
  white-space: nowrap;
}

.pin__dir {
  display: inline-block;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: rgba(29, 74, 141, 0.95);
}

.pin.is-dim {
  opacity: 0.28;
  filter: grayscale(0.1);
}

.pin.is-selected .pin__tag {
  border-color: rgba(29, 74, 141, 0.35);
  box-shadow: 0 0 0 3px rgba(29, 74, 141, 0.14);
}

.infoCard {
  position: absolute;
  left: 10px;
  bottom: 10px;
  max-width: min(340px, calc(100% - 20px));
  padding: 8px 10px 6px;
  border-radius: 10px;
  border: 1px solid rgba(7, 25, 45, 0.14);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 30px rgba(7, 25, 45, 0.12);
}

.infoCard__title {
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.2px;
}

.infoCard__meta {
  margin-top: 2px;
  font-size: 11px;
  color: rgba(14, 27, 42, 0.68);
}

.infoCard__details {
  margin-top: 6px;
  animation: infoSlideIn 0.2s ease;
}

@keyframes infoSlideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.infoCard__desc {
  font-size: 12px;
  color: rgba(14, 27, 42, 0.82);
  line-height: 1.4;
  margin: 0 0 6px;
}

.infoCard__contactList {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.infoCard__contact {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: rgba(14, 27, 42, 0.78);
  line-height: 1.3;
}

.infoCard__icon {
  flex-shrink: 0;
  width: 16px;
  text-align: center;
  font-size: 13px;
}

.infoCard__icon--sm {
  font-size: 11px;
}

.infoCard__contact a {
  color: var(--brand);
  text-decoration: none;
}

.infoCard__contact a:hover {
  text-decoration: underline;
}

.infoCard--expanded {
  max-width: min(380px, calc(100% - 20px));
  max-height: 60vh;
  overflow-y: auto;
}

.infoCard__actions {
  margin-top: 6px;
  display: flex;
  gap: 8px;
}

.btn--toggle {
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--brand);
  border-color: rgba(29, 74, 141, 0.2);
}

.btn--toggle:not([hidden]) {
  display: flex;
}

.btn__arrow {
  font-size: 9px;
  line-height: 1;
}

.btn {
  border: 1px solid rgba(7, 25, 45, 0.14);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
}

.btn:hover {
  border-color: rgba(29, 74, 141, 0.35);
}

.map__legend {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 5;
  display: flex;
  gap: 14px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(7, 25, 45, 0.10);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(6px);
  font-size: 11px;
  color: var(--muted);
  pointer-events: none;
}

.map__legend strong {
  font-weight: 800;
  color: var(--text);
  margin-right: 2px;
}

.map__resetZoom {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  border: 1px solid rgba(7, 25, 45, 0.14);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(7, 25, 45, 0.10);
}

.map__resetZoom:active {
  background: rgba(29, 74, 141, 0.08);
}

.sheet__handle {
  display: none;
}

@media (max-width: 980px) {
  body {
    overflow: hidden;
  }

  .app {
    flex-direction: column;
    padding: 0;
    gap: 0;
    height: 100vh;
    height: 100dvh;
  }

  .mapPanel {
    flex: 1;
    min-height: 0;
    border-radius: 0;
    border: none;
    box-shadow: none;
    padding-bottom: 160px;
  }

  .mapPanel__topbar {
    padding: 6px 12px;
    padding-top: max(6px, env(safe-area-inset-top));
    gap: 10px;
  }

  .topbar__logo {
    display: block;
    height: 28px;
    width: auto;
    object-fit: contain;
  }

  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: none;
    min-width: 0;
    height: 82vh;
    height: 82dvh;
    z-index: 100;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 24px rgba(7, 25, 45, 0.12);
    will-change: transform;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .sheet__handle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 0 2px;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
  }

  .sheet__bar {
    width: 36px;
    height: 4px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.18);
  }

  .sidebar__header {
    display: none;
  }

  .sidebar__footer {
    display: none;
  }

  .sidebar__controls {
    padding: 6px 14px 10px;
    gap: 8px;
    background: none;
  }

  .floorSection {
    padding: 6px 8px;
    gap: 6px;
    border-radius: 10px;
  }

  .floorSection__top {
    display: none;
  }

  .floorBtn {
    padding: 6px 0;
    font-size: 13px;
    border-radius: 8px;
  }

  .field__label {
    display: none;
  }

  .field__input {
    padding: 9px 12px;
    font-size: 16px;
    border-radius: 10px;
  }

  .toggle {
    font-size: 11px;
  }

  .sidebar__listHeader {
    padding: 8px 14px 6px;
  }

  .places {
    padding: 0 8px 8px;
  }

  .infoCard {
    bottom: 10px;
    left: 8px;
    max-width: min(280px, calc(100% - 16px));
  }

  .infoCard--expanded {
    max-width: min(320px, calc(100% - 16px));
  }

  .map {
    min-height: 0;
  }
}
