/* ================================================================
   SIMULADOR DE MOVILIDAD URBANA
   ================================================================ */

#mob-sim {
  --bg:      #eaeaea;
  --panel:   #f2f2f2;
  --border:  #999;
  --ink:     #222;
  --muted:   #666;

  font-family: sans-serif;
  color:       var(--ink);
  max-width:   1300px;
  margin:      0 auto 40px;
}
#mob-sim * { box-sizing: border-box; }

#mob-sim .mob-sim__loading {
  padding:       60px 20px;
  text-align:    center;
  color:         #666;
  background:    #eaeaea;
  border-radius: 10px;
  font-size:     14px;
  font-family:   sans-serif;
}

#mob-sim .mob-sim__container {
  background:    var(--bg);
  padding:       30px;
  border-radius: 10px;
  box-shadow:    0 10px 30px rgba(0,0,0,0.1);
}

/* ---------- Botones de escenario ---------- */
#mob-sim .mob-sim__buttons {
  display:         flex;
  justify-content: center;
  gap:             12px;
  margin-bottom:   14px;
}
#mob-sim .btn-retro {
  padding:         8px 18px;
  font-family:     "Courier New", monospace;
  font-size:       13px;
  letter-spacing:  0.5px;
  text-transform:  uppercase;
  background:      #f2f2f2;
  color:           #222;
  border:          1px solid var(--border);
  border-radius:   2px;
  cursor:          pointer;
  box-shadow:      inset 0 1px 0 #fff, inset 0 -1px 0 #cfcfcf;
  transition:      all 0.15s ease;
}
#mob-sim .btn-retro:hover  { background: #e6e6e6; border-color: #666; }
#mob-sim .btn-retro.activo {
  background:   #d0d0d0;
  color:        #000;
  border-color: #333;
  box-shadow:   inset 0 2px 3px rgba(0,0,0,0.25);
}
#mob-sim .btn-retro:active { transform: translateY(1px); }

/* ---------- Mapa SVG ---------- */
#mob-sim .mob-sim__svg-wrap {
  background:    #fff;
  border:        2px solid #333;
  border-radius: 5px;
  overflow:      hidden;
}
#mob-sim #mapa-amg-svg {
  width:    100%;
  height:   auto;
  display:  block;
}

/* Colores base del mapa */
#mob-sim .calle-asfalto   { fill: #5D6163; }
#mob-sim .linea-divisoria { fill: none; stroke: #fff; stroke-width: 50; stroke-dasharray: 200, 150; }
#mob-sim .manzana-area    { fill: #A8C686; stroke: #97B175; stroke-width: 30; }

/* ================================================================
   COLORES DE VEHÍCULOS
   ================================================================ */

/* ================================================================
   COLORES DE VEHÍCULOS
   Los colores se aplican por JS con atributos `fill` inline
   directamente en el SVG (ver sim.js → aplicarColoresInline).
   Aquí solo dejamos reglas de comportamiento (cursor, opacidad de humo).
   ================================================================ */

#mob-sim .auto-oculto { display: none; }

#mob-sim use[data-tipo="auto"],
#mob-sim use[data-tipo="bus"] { cursor: pointer; }

#mob-sim use[data-emision="baja"]     .humo { opacity: 0.1; }
#mob-sim use[data-emision="media"]    .humo { opacity: 0.4; }
#mob-sim use[data-emision="alta"]     .humo { opacity: 0.8; }
#mob-sim use[data-emision="muy_alta"] .humo { opacity: 0.9; }

#mob-sim #escenario-pico { visibility: hidden; opacity: 0; }

#mob-sim .auto-oculto { display: none; }

/* Interacción y emisiones */
#mob-sim use[data-tipo="auto"],
#mob-sim use[data-tipo="bus"] { cursor: pointer; }

#mob-sim use[data-emision="baja"]     .humo { opacity: 0.1; }
#mob-sim use[data-emision="media"]    .humo { opacity: 0.4; }
#mob-sim use[data-emision="alta"]     .humo { opacity: 0.8; }
#mob-sim use[data-emision="muy_alta"] .humo { opacity: 0.9; }

#mob-sim #escenario-pico { visibility: hidden; opacity: 0; }

/* ================================================================
   PANEL HORIZONTAL
   ================================================================ */
#mob-sim .mob-sim__panel {
  display:         flex;
  flex-wrap:       nowrap;
  gap:             0;
  margin-top:      10px;
  background:      var(--panel);
  border:          1px solid var(--border);
  overflow-x:      auto;
  overflow-y:      hidden;
  scrollbar-width: thin;
}
#mob-sim .mob-sim__panel::-webkit-scrollbar { height: 8px; }
#mob-sim .mob-sim__panel::-webkit-scrollbar-thumb {
  background:    #bbb;
  border-radius: 4px;
}

#mob-sim .mob-cell {
  flex:            0 0 auto;
  min-width:       150px;
  padding:         14px 16px;
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  justify-content: center;
  gap:             6px;
  border-right:    1px solid #ddd;
  font-family:     "Courier New", monospace;
}
#mob-sim .mob-cell:last-child { border-right: none; }

#mob-sim .mob-cell--input label {
  font-size:       11px;
  color:           var(--muted);
  text-transform:  uppercase;
  letter-spacing:  0.5px;
  text-align:      center;
  line-height:     1.2;
}

#mob-sim .mob-cell--input input[type="number"] {
  width:              130px;
  text-align:         center;

  appearance:         auto;
  -webkit-appearance: auto;
  -moz-appearance:    number-input;

  padding:            6px 8px;
  font-family:        "Courier New", monospace;
  font-size:          14px;
  font-weight:        bold;
  background:         #fbfbfb;
  color:              #111;
  border:             1px solid #777;
  border-radius:      0;
  outline:            none;
}

#mob-sim .mob-cell--input input[type="number"]::-webkit-inner-spin-button,
#mob-sim .mob-cell--input input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: inner-spin-button;
  appearance:         inner-spin-button;
  opacity:            1;
  height:             28px;
  cursor:             pointer;
  margin-left:        4px;
}

#mob-sim .mob-cell--input input[type="number"]:focus {
  border-color: #222;
  background:   #fff;
}

#mob-sim .mob-cell--output .titulo {
  font-size:       11px;
  color:           var(--muted);
  text-transform:  uppercase;
  letter-spacing:  0.5px;
  text-align:      center;
  line-height:     1.2;
}
#mob-sim .mob-cell--output .valor {
  font-size:   22px;
  font-weight: bold;
  line-height: 1.1;
  color:       #111;
}
#mob-sim .mob-cell--output .unidad {
  font-size: 11px;
  color:     var(--muted);
}

#mob-sim .mob-cell--soon {
  opacity:        0.45;
  pointer-events: none;
}
#mob-sim .mob-cell--soon::after {
  content:        "PRÓXIMAMENTE";
  font-size:      9px;
  color:          #888;
  letter-spacing: 1px;
}

@media (max-width: 767px) {
  #mob-sim .mob-sim__container { padding: 16px; }
  #mob-sim .mob-cell { min-width: 120px; padding: 10px 12px; }
  #mob-sim .mob-cell--output .valor { font-size: 18px; }
}

/* ================================================================
   BRT — Bus articulado (SVG real, paleta Mi Macro)
   ================================================================ */
#mob-sim .brt-blanco      { fill: #F3F4F4; }   /* Techo y laterales superiores */
#mob-sim .brt-rojo        { fill: #DD4741; }   /* Franja roja inferior */
#mob-sim .brt-gris-medio  { fill: #888989; }   /* Cuerpo principal */
#mob-sim .brt-llanta      { fill: #393939; }   /* Llantas */
#mob-sim .brt-detalle-1   { fill: #616262; }   /* Asientos / ventanas superiores */
#mob-sim .brt-detalle-2   { fill: #838485; }
#mob-sim .brt-detalle-3   { fill: #C1C0C1; }
#mob-sim .brt-lado        { fill: #BDBFC1; }   /* Pared del fuelle */

/* Corredor BRT — dos capas: base ancha naranja + línea blanca discontinua */
#mob-sim .corredor-brt-base {
  fill: none;
  stroke: #F58220;
  stroke-width: 220;
  stroke-linecap: round;
  opacity: 0.55;
}
#mob-sim .corredor-brt-centro {
  fill: none;
  stroke: #FFFFFF;
  stroke-width: 30;
  stroke-dasharray: 250, 180;
  stroke-linecap: round;
  opacity: 0.85;
}

/* ================================================================
   NUEVO MAPA v2 — clases renombradas
   ================================================================ */

#mob-sim .manzana-base    { fill: #A8A8A8; }
#mob-sim .bosque          { fill: #44B874; }
#mob-sim .calle           { fill: #373435; }
#mob-sim .linea-divisoria { fill: none; stroke: #373435; stroke-width: 20; }
#mob-sim .linea-dashes    { fill: #FEFEFE; }


/* ================================================================
   TREN LIGERO — colores y estilos
   ================================================================ */

/* Colores del tren */
#mob-sim .tren-carroceria   { fill: #BDBFC1; }
#mob-sim .tren-franja       { fill: #DD4741; }
#mob-sim .tren-franja-clara { fill: #F3F4F4; }
#mob-sim .tren-ventana      { fill: #6BC9CA; }
#mob-sim .tren-rueda        { fill: #222222; }
#mob-sim .tren-borde        { fill: #888989; }
#mob-sim .tren-luz          { fill: #FFD700; }

/* Vía del tren — 2 capas superpuestas */
#mob-sim .tren-via-base {
  fill:         none;
  stroke:       #1a1a1a;         /* más oscuro para contraste */
  stroke-width: 180;             /* más ancho */
  stroke-linecap: round;
}
#mob-sim .tren-via-riel {
  fill:         none;
  stroke:       #F0C040;         /* dorado/amarillo, muy visible */
  stroke-width: 40;              /* más grueso */
  stroke-dasharray: 60, 60;      /* guiones más largos */
  stroke-linecap: round;
  opacity:      1;
}
/* ================================================================
   ÁRBOLES — colores
   ================================================================ */
#mob-sim .arbol-tronco  { fill: #8B5A2B; }
#mob-sim .arbol-follaje { fill: #2E7D32; }
#mob-sim .arbol-sombra  { fill: #000; }

/* Etiqueta de unidades en celdas de input */
#mob-sim .mob-cell--input .unidad {
  font-size:   11px;
  color:       var(--muted);
  text-align:  center;
  margin-top:  2px;
}

/* ================================================================
   BICICLETAS — colores y ciclovías
   ================================================================ */

/* Ciclista */
#mob-sim .bici-rueda-clara { fill: #DADADA; }
#mob-sim .bici-rayos       { fill: #000000; }
#mob-sim .bici-cuadro      { fill: #ED3237; }
#mob-sim .bici-piel-clara  { fill: #F9D5C3; }
#mob-sim .bici-detalle-gris{ fill: #B2B1B1; }
#mob-sim .bici-piel        { fill: #AB6A64; }
#mob-sim .bici-pantalon    { fill: #1E3D71; }
#mob-sim .bici-camisa      { fill: #2C508E; }
#mob-sim .bici-casco       { fill: #FFAB26; }
#mob-sim .bici-llanta      { fill: #373435; }

/* Ciclovía — 2 capas: fondo verde ancho + línea blanca discontinua */
#mob-sim .ciclovia-base {
  fill:           none;
  stroke:         #1B5E20;
  stroke-width:   130;
  stroke-linecap: round;
  opacity:        0.9;
}
#mob-sim .ciclovia-borde {
  fill:           none;
  stroke:         #FFFFFF;
  stroke-width:   25;
  stroke-dasharray: 40, 60;
  stroke-linecap: round;
  opacity:        1;
}

/* ================================================================
   BARRA DE SUSTENTABILIDAD
   ================================================================ */

#mob-sim .mob-sim__sustentabilidad {
  background: #f2f2f2;
  border: 1px solid #999;
  border-radius: 2px;
  padding: 14px 20px 12px;
  margin-bottom: 14px;
  font-family: "Courier New", monospace;
  box-shadow:
    inset 0 1px 0 #ffffff,
    inset 0 -1px 0 #cfcfcf;
}

#mob-sim .sus-titulo {
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #555;
  text-align: center;
  margin-bottom: 12px;
}

/* ---------- Barra con extremos ---------- */
#mob-sim .sus-bar-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

#mob-sim .sus-extremo {
  font-size: 10px;
  letter-spacing: 1px;
  color: #666;
  text-transform: uppercase;
  flex-shrink: 0;
  user-select: none;
}

#mob-sim .sus-bar-container {
  position: relative;
  flex: 1;
  height: 16px;
  padding: 0 2px;  /* pequeño margen para el marcador */
}

#mob-sim .sus-bar-gradient {
  position: absolute;
  inset: 0;
  border: 1px solid #777;
  border-radius: 2px;
  background: linear-gradient(
    to right,
    #D32F2F 0%,
    #FF9800 22%,
    #FFC107 45%,
    #4CAF50 72%,
    #1B5E20 100%
  );
  box-shadow: inset 0 2px 3px rgba(0,0,0,0.15);
}

#mob-sim .sus-bar-marker {
  position: absolute;
  top: -6px;
  bottom: -6px;
  width: 3px;
  background: #111;
  transform: translateX(-50%);
  transition: left 0.45s cubic-bezier(.4, 0, .2, 1);
  z-index: 2;
  box-shadow: 0 0 5px rgba(0,0,0,0.5);
}

#mob-sim .sus-bar-marker::before {
  content: '';
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid #111;
}

/* ---------- Nivel + valor ---------- */
#mob-sim .sus-nivel-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-top: 12px;
}

#mob-sim .sus-nivel {
  font-size: 22px;
  font-weight: bold;
  letter-spacing: 3px;
  color: #333;
  line-height: 1;
  transition: color 0.3s ease;
}

#mob-sim .sus-valor {
  font-size: 11px;
  letter-spacing: 0.5px;
  color: #666;
}

/* ================================================================
   HEADER DEL SIMULADOR
   ================================================================ */

#mob-sim .mob-sim__header {
  background: #524E4E;
  border: 2px solid #333;
  border-radius: 2px;
  padding: 18px 24px 16px;
  margin-top: 16px;
  margin-bottom: 8px;
  text-align: center;
  font-family: "Courier New", monospace;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    inset 0 -1px 0 rgba(0,0,0,0.4),
    0 6px 14px rgba(0,0,0,0.18);
}

#mob-sim .header-titulo {
  font-size: 22px;
  font-weight: bold;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: #ffffff;
  margin-bottom: 6px;
  line-height: 1.2;
}

#mob-sim .header-subtitulo {
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #999;
}

@media (max-width: 767px) {
  #mob-sim .header-titulo {
    font-size: 16px;
    letter-spacing: 3px;
  }
  #mob-sim .header-subtitulo {
    font-size: 10px;
    letter-spacing: 1.5px;
  }
}

/* ================================================================
   GUÍA INTERACTIVA
   ================================================================ */

#mob-sim .mob-guia {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  font-family: "Courier New", monospace;
}

#mob-sim .guia-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
}

#mob-sim .guia-card {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 520px;
  background: #f2f2f2;
  border: 2px solid #333;
  border-radius: 3px;
  padding: 22px 26px 18px;
  box-shadow:
    inset 0 1px 0 #ffffff,
    0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 2;
  animation: guia-card-in 0.3s ease;
}

@keyframes guia-card-in {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

#mob-sim .guia-paso {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 10px;
  text-align: center;
}

#mob-sim .guia-titulo {
  font-size: 18px;
  font-weight: bold;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #222;
  margin-bottom: 12px;
  text-align: center;
}

#mob-sim .guia-desc {
  font-size: 13px;
  line-height: 1.5;
  color: #444;
  text-align: center;
  margin-bottom: 20px;
  min-height: 60px;
}

#mob-sim .guia-botones {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

#mob-sim .guia-btn {
  padding: 8px 16px;
  font-family: "Courier New", monospace;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  background: #f2f2f2;
  color: #222;
  border: 1px solid #999;
  border-radius: 2px;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 #ffffff,
    inset 0 -1px 0 #cfcfcf;
  transition: all 0.15s ease;
}

#mob-sim .guia-btn:hover {
  background: #e6e6e6;
  border-color: #666;
}

#mob-sim .guia-btn-next {
  background: #373435;
  color: #f2f2f2;
  border-color: #111;
}

#mob-sim .guia-btn-next:hover {
  background: #1a1a1a;
}

#mob-sim .guia-btn-skip {
  color: #888;
  border-color: transparent;
  box-shadow: none;
  background: transparent;
}

#mob-sim .guia-btn-skip:hover {
  color: #333;
  text-decoration: underline;
  background: transparent;
}

#mob-sim .guia-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ---------- Elemento resaltado ---------- */
#mob-sim .guia-target {
  position: relative;
  z-index: 100000;
  outline: 3px solid #DD4741;
  outline-offset: 4px;
  box-shadow: 0 0 0 6px rgba(221, 71, 65, 0.25);
  animation: guia-pulse 1.4s infinite ease-in-out;
  border-radius: 3px;
}

@keyframes guia-pulse {
  0%, 100% { outline-color: #DD4741; box-shadow: 0 0 0 6px rgba(221, 71, 65, 0.25); }
  50%      { outline-color: #EF5350; box-shadow: 0 0 0 14px rgba(221, 71, 65, 0.05); }
}

/* ---------- Botón flotante para reabrir ---------- */
#mob-sim .mob-guia-reabrir {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #373435;
  color: #f2f2f2;
  border: 2px solid #111;
  font-family: "Courier New", monospace;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  z-index: 2147483646;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  transition: all 0.2s ease;
}

#mob-sim .mob-guia-reabrir:hover {
  background: #1a1a1a;
  transform: scale(1.05);
}

@media (max-width: 600px) {
  #mob-sim .guia-card {
    bottom: 20px;
    padding: 18px 18px 14px;
  }
  #mob-sim .guia-titulo { font-size: 15px; }
  #mob-sim .guia-desc   { font-size: 12px; }
  #mob-sim .guia-btn    { padding: 6px 10px; font-size: 11px; }
}