/* FILE: vuelos-base.css */

/* Shared structure; VisionGlass supplies the existing components' appearance. */
.app-shell,
.app-shell *,
.app-shell *::before,
.app-shell *::after,
.auth-pantalla,
.auth-pantalla *,
.auth-pantalla *::before,
.auth-pantalla *::after {
  box-sizing: border-box;
}

.app-shell {
  min-height: 100vh;
  min-width: 0;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  width: 252px;
  height: 100vh;
  height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.app-body {
  min-width: 0;
  margin-left: 252px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  padding: 0 32px;
}

.breadcrumbs {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 20px;
}

.brand > div {
  min-width: 0;
}

.brand-symbol {
  display: grid;
  flex: 0 0 36px;
  place-items: center;
  width: 36px;
  height: 36px;
  font-weight: 800;
}

.brand strong {
  display: block;
}

.brand small {
  display: block;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.vv-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 12px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.nav-icon {
  flex: 0 0 18px;
  width: 18px;
  text-align: center;
}

.sidebar-bottom {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 12px;
  padding: 14px;
  border-radius: 14px;
  overflow-wrap: anywhere;
}

.sidebar-scrim,
.mobile-toggle,
.mobile-close {
  display: none;
}

.main-content {
  display: block;
  min-width: 0;
  padding: 28px 32px;
}

.page-heading {
  margin-bottom: 22px;
  overflow-wrap: anywhere;
}

.page-heading p {
  margin: 0;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 17px;
  margin-bottom: 22px;
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.metric-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.metric-icon {
  display: grid;
  flex: 0 0 30px;
  place-items: center;
  width: 30px;
  height: 30px;
}

.metric > strong {
  font-size: 30px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.panel {
  min-width: 0;
  margin-bottom: 22px;
}

.panel-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.dashboard-grid,
.vv-grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 22px;
}

.dashboard-grid > *,
.vv-grid-2 > * {
  min-width: 0;
}

.mod-formulario {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  min-width: 0;
}

.mod-formulario label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  color: var(--tenue);
  font-size: 12px;
}

.mod-formulario input,
.mod-formulario select,
.mod-formulario textarea {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.mod-acciones {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.tabla-caja {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.mod-tabla {
  width: 100%;
  min-width: 640px;
}

.mod-tarjetas {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
  gap: 14px;
  min-width: 0;
}

.mod-tarjetas > * {
  min-width: 0;
  overflow-wrap: anywhere;
}

.auth-pantalla {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 20px;
}

.auth-tarjeta {
  width: min(420px, 100%);
  min-width: 0;
  padding: 32px;
}

.auth-marca {
  margin-bottom: 20px;
}

.auth-error {
  color: var(--critica);
  overflow-wrap: anywhere;
}

.auth-ayuda {
  color: var(--tenue);
  font-size: 12px;
}

/* New components. */
.vv-org-select {
  box-sizing: border-box;
  width: auto;
  min-width: 0;
  max-width: 220px;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--vidrio-borde);
  border-radius: 999px;
  background: var(--superficie);
  color: var(--texto);
  font: inherit;
  font-size: 12px;
  text-overflow: ellipsis;
  color-scheme: dark;
}

.vv-org-select option {
  background: var(--panel);
  color: var(--texto);
}

.vv-filtros {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-bottom: 14px;
}

.vv-filtros > * {
  min-width: 0;
  max-width: 100%;
}

.vv-mapa {
  position: relative;
  width: 100%;
  min-width: 0;
  height: 520px;
  overflow: hidden;
  border: 1px solid var(--vidrio-borde);
  border-radius: var(--radio);
  background: var(--fondo);
}

.vv-mapa .maplibregl-canvas {
  display: block;
}

.vv-mapa .maplibregl-ctrl-attrib,
.vv-mapa .maplibregl-ctrl-group {
  border: 1px solid var(--vidrio-borde);
  background: rgba(10, 20, 40, 0.8);
  color: var(--texto);
  box-shadow: var(--sombra);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.vv-mapa .maplibregl-ctrl-attrib a {
  color: var(--texto);
  text-decoration: underline;
}

.vv-mapa .maplibregl-ctrl-group button {
  display: block;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--texto);
  box-shadow: none;
  transform: none;
}

.vv-mapa .maplibregl-ctrl-group button + button {
  border-top: 1px solid var(--vidrio-borde);
}

.vv-mapa .maplibregl-ctrl-group button:hover {
  background: var(--vidrio);
}

.vv-mapa .maplibregl-ctrl-icon {
  filter: invert(1);
}

.vv-mapa .maplibregl-ctrl-attrib-button {
  border-radius: 50%;
  box-shadow: none;
  filter: invert(1);
}

.vv-mapa-barra {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: calc(100% - 24px);
  padding: 6px;
  border: 1px solid var(--vidrio-borde);
  border-radius: 12px;
  background: var(--vidrio);
  color: var(--texto);
  box-shadow: var(--sombra);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

/* Extra specificity overrides later, generic button pill rules. */
.vv-chip,
button.vv-chip,
button.vv-chip:hover,
button.vv-chip:active {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: 100%;
  min-height: 32px;
  margin: 0;
  padding: 6px 12px;
  border: 1px solid var(--vidrio-borde);
  border-radius: 999px;
  background: transparent;
  background-image: none;
  color: var(--texto);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  white-space: normal;
  overflow-wrap: anywhere;
  box-shadow: none;
  text-shadow: none;
  filter: none;
  transform: none;
  cursor: pointer;
}

.vv-chip:hover,
button.vv-chip:hover {
  background: var(--vidrio);
  border-color: var(--acento);
}

.vv-chip--activo,
button.vv-chip.vv-chip--activo,
button.vv-chip.vv-chip--activo:hover,
button.vv-chip.vv-chip--activo:active {
  border-color: var(--acento);
  background: rgba(10, 132, 255, 0.25);
  color: var(--texto);
  box-shadow: none;
}

.vv-chip:disabled,
button.vv-chip:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.vv-org-select:focus-visible,
.vv-chip:focus-visible,
button.vv-chip:focus-visible,
.mobile-toggle:focus-visible,
.mobile-close:focus-visible,
.vv-mapa .maplibregl-ctrl-group button:focus-visible,
.vv-mapa .maplibregl-ctrl-attrib-button:focus-visible,
.vv-mapa .maplibregl-ctrl-attrib a:focus-visible {
  outline: 2px solid var(--acento-texto);
  outline-offset: 3px;
}

.vv-hallazgos {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.vv-hallazgo {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--vidrio-borde);
  border-left: 4px solid var(--acento-texto);
  border-radius: 10px;
  background: var(--vidrio);
  color: var(--texto);
  overflow-wrap: anywhere;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.vv-hallazgo strong {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.vv-hallazgo span {
  font-size: 13px;
  line-height: 1.5;
}

.vv-hallazgo--bloqueo {
  border-left-color: var(--critica);
}

.vv-hallazgo--advertencia {
  border-left-color: var(--relevante);
}

.vv-hallazgo--info {
  border-left-color: var(--acento-texto);
}

.vv-linea-tiempo {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}

.vv-linea-tiempo::before {
  position: absolute;
  top: 6px;
  bottom: 12px;
  left: 5px;
  width: 1px;
  background: var(--vidrio-borde);
  content: "";
}

.vv-evento {
  position: relative;
  min-width: 0;
  margin-bottom: 16px;
  padding-left: 28px;
  overflow-wrap: anywhere;
}

.vv-evento:last-child {
  margin-bottom: 0;
}

.vv-evento-punto {
  position: absolute;
  top: 5px;
  left: 0;
  width: 12px;
  height: 12px;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--acento);
  box-shadow: 0 0 10px var(--glow);
}

.vv-linea-tiempo > .vv-evento:first-child {
  padding-top: 10px;
  padding-right: 12px;
  padding-bottom: 10px;
  border-radius: 10px;
  background: var(--vidrio);
}

.vv-linea-tiempo > .vv-evento:first-child .vv-evento-punto {
  top: 15px;
  box-shadow: 0 0 14px var(--glow);
}

.vv-evento strong {
  display: block;
  color: var(--tinta);
}

.vv-evento small {
  display: block;
  color: var(--tenue);
}

.vv-evento p {
  margin: 4px 0 0;
  color: var(--texto);
  font-size: 12px;
  line-height: 1.5;
}

.vv-estado-grande {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  overflow-wrap: anywhere;
}

.vv-estado-grande > :first-child {
  color: var(--tinta);
  font-size: 22px;
  font-weight: 700;
}

.vv-kv {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 8px 16px;
}

.vv-kv dt {
  min-width: 0;
  color: var(--tenue);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.vv-kv dd {
  min-width: 0;
  margin: 0;
  color: var(--texto);
  overflow-wrap: anywhere;
}

.vv-vacio {
  padding: 40px 20px;
  border: 1px dashed var(--vidrio-borde);
  border-radius: var(--radio);
  color: var(--tenue);
  text-align: center;
  overflow-wrap: anywhere;
}

.vv-cargando {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--tenue);
}

.vv-cargando::before {
  box-sizing: border-box;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  border: 2px solid var(--acento);
  border-right-color: transparent;
  border-radius: 50%;
  animation: vv-girar 0.8s linear infinite;
  content: "";
}

@keyframes vv-girar {
  to {
    transform: rotate(360deg);
  }
}

.vv-toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: max-content;
  max-width: min(380px, calc(100vw - 40px));
}

.vv-toast {
  box-sizing: border-box;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--vidrio-borde);
  border-left: 4px solid var(--acento);
  border-radius: 12px;
  background: var(--superficie);
  color: var(--texto);
  box-shadow: var(--sombra);
  overflow-wrap: anywhere;
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.vv-toast--ok {
  border-left-color: var(--ok);
}

.vv-toast--error {
  border-left-color: var(--critica);
}

.vv-modal-fondo {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  padding: 16px;
  overflow-y: auto;
  background: rgba(3, 10, 23, 0.7);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.vv-modal {
  box-sizing: border-box;
  width: min(560px, 100%);
  min-width: 0;
  max-height: 90vh;
  max-height: 90dvh;
  padding: 24px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--vidrio-borde);
  border-radius: 16px;
  background: var(--superficie);
  background: color-mix(in srgb, var(--superficie) 94%, transparent);
  color: var(--texto);
  box-shadow: var(--sombra);
  overflow-wrap: anywhere;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.vv-modal-cab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  margin-bottom: 14px;
}

.vv-modal-cab > * {
  min-width: 0;
}

/* Responsive layout. */
@media (max-width: 979.98px) {
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid,
  .vv-grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }

  .topbar {
    gap: 12px;
    padding-right: 20px;
    padding-left: 20px;
  }

  .profile-text {
    display: none;
  }

  .vv-org-select {
    max-width: 170px;
  }

  .main-content {
    padding: 24px 20px;
  }
}

@media (max-width: 759.98px) {
  .sidebar {
    max-width: calc(100vw - 40px);
    visibility: hidden;
    transform: translateX(-100%);
    transition:
      transform 220ms ease,
      visibility 220ms;
  }

  .sidebar.open {
    visibility: visible;
    transform: none;
  }

  .sidebar-scrim.visible {
    position: fixed;
    inset: 0;
    z-index: 190;
    display: block;
    background: rgba(3, 10, 23, 0.7);
  }

  .mobile-toggle,
  .mobile-close {
    display: inline-flex;
    flex: 0 0 44px;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    line-height: 1;
  }

  .mobile-close {
    align-self: flex-end;
    margin: 0 12px 8px;
    font-size: 24px;
  }

  .app-body {
    margin-left: 0;
  }

  .topbar {
    flex-wrap: wrap;
    gap: 8px 10px;
    min-height: 64px;
    padding: 10px 16px;
  }

  .top-actions {
    flex: 1 1 100%;
    flex-wrap: wrap;
    justify-content: flex-end;
    width: 100%;
  }

  .vv-org-select {
    flex: 1 1 120px;
    max-width: 220px;
  }

  .profile-trigger {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    min-width: 0;
  }

  .text-button {
    flex: 0 0 auto;
  }

  .main-content {
    padding: 22px 16px;
  }

  .vv-mapa {
    height: 360px;
  }
}

@media (max-width: 639.98px) {
  .mod-formulario {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 519.98px) {
  .vv-kv {
    grid-template-columns: minmax(0, 1fr);
  }

  .vv-kv dd:not(:last-child) {
    margin-bottom: 8px;
  }
}

@media (max-width: 419.98px) {
  .metrics {
    grid-template-columns: minmax(0, 1fr);
  }

  .auth-tarjeta {
    padding: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .vv-chip,
  button.vv-chip {
    transition: none;
  }

  .vv-cargando::before {
    animation: none;
  }
}
