/* ── GemeloDigitalAbastecimiento — Estilos globales ─────────────────────────── */

/* Fondo blanco en todos los mapas Leaflet (visible al elegir "Ninguno") */
.leaflet-container {
  background: #ffffff;
}

/* Variables */
:root {
  --wp-primary: #0d6efd;
  --wp-sidebar-width: 240px;
}

/* Layout general */
body {
  background-color: #f8f9fa;
}

main {
  padding-bottom: 100px !important;  /* room for fixed footer + dropdown menus */
}

/* Navbar */
.navbar-brand {
  letter-spacing: 0.03em;
  white-space: nowrap;
  min-width: 0;
}

/* Evitar que el icono y el texto de los enlaces del menú se separen
   en dos líneas cuando el navbar se estrecha */
.navbar .nav-link {
  white-space: nowrap;
}

/* Navbar responsive — evitar desbordamiento al reducir el ancho */
.navbar-brand .wp-brand-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

@media (max-width: 1199.98px) {
  .navbar-brand img {
    height: 52px !important;
  }
  .navbar-brand .wp-brand-text {
    font-size: 1.05rem !important;
  }
}

@media (max-width: 991.98px) {
  .navbar-brand img {
    height: 44px !important;
  }
  .navbar-brand .wp-brand-text {
    font-size: 1rem !important;
  }
}

@media (max-width: 767.98px) {
  .navbar-brand img {
    height: 38px !important;
  }
  .navbar-brand .wp-brand-text {
    font-size: 0.9rem !important;
  }
}

@media (max-width: 575.98px) {
  .navbar-brand img {
    height: 32px !important;
  }
  .navbar-brand .wp-brand-text {
    font-size: 0.8rem !important;
  }
}

/* Cards */
.card {
  transition: box-shadow 0.15s ease-in-out;
}

.card:hover {
  box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.1) !important;
}

/* Tablas */
.table th {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6c757d;
}

/* Badges de rol */
.badge {
  font-weight: 500;
}

/* Formularios */
.form-label {
  font-weight: 500;
}

/* Mapa placeholder (Fase 4) */
#map-container {
  height: 500px;
  border-radius: 0.5rem;
  overflow: hidden;
}

/* Mapa de simulación (resultados / gemelo digital) */
#wp-sim-map {
  height: 600px;
  min-height: 350px;
  max-height: 85vh;
  resize: both;
  overflow: auto;
  border: 1px solid #dee2e6;
  border-radius: .5rem;
}

/* Footer */
footer {
  font-size: 0.75rem;
  color: #adb5bd;
}

/* ── Footer fijo UE / PERTE / Ministerio ───────────────────────────── */
.wp-footer-spacer {
  height: 84px;
}

.wp-footer-eu {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  /* Por encima de los thead sticky de Bootstrap (.sticky-top = 1020) para que
     el footer siempre tape el contenido al hacer scroll/print, pero por debajo
     de navbar (1030), modales (1050) y toasts (1090). */
  z-index: 1025;
  height: 84px;
  background: rgb(0, 161, 96);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 20px;
  gap: 20px;
  text-decoration: none;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.15);
}

.wp-footer-eu:hover {
  filter: brightness(0.95);
}

.wp-footer-eu img {
  height: 52px;
  max-width: 100%;
  object-fit: contain;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .wp-footer-spacer {
    height: 42px;
  }
  .wp-footer-eu {
    height: 42px;
    padding: 0 10px;
    gap: 10px;
  }
  .wp-footer-eu img {
    height: 28px;
  }
}

/* Paginación */
.pagination .page-link {
  border-radius: 0.25rem;
  margin: 0 2px;
}

/* Pre de detalle JSON */
pre {
  background: #f1f3f5;
  padding: 0.5rem;
  border-radius: 0.25rem;
}

/* ── Editor: cursor crosshair en modos de dibujo ───────────────────── */
.wp-draw-mode .leaflet-interactive {
  cursor: crosshair !important;
}
  max-height: 200px;
  overflow: auto;
  font-size: 0.75rem;
}

/* Responsive — ocultar columnas en móvil */
@media (max-width: 576px) {
  .table .d-sm-none {
    display: none !important;

  /* ── Flechas de dirección ──────────────────────────────────────────────── */
  .wp-arrow-icon {
    background: transparent !important;
    border: none !important;
    overflow: visible !important;
  }

  /* ── Etiquetas de elementos en el mapa ─────────────────────────────────── */
  .wp-elem-label {
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(0, 0, 0, 0.18);
    border-radius: 3px;
    padding: 1px 4px !important;
    font-size: 0.68rem !important;
    font-weight: 600;
    color: #333;
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
    white-space: nowrap;
    pointer-events: none;
  }
  /* Ocultar etiquetas cuando el mapa tenga la clase wp-labels-hidden */
  #map.wp-labels-hidden .wp-elem-label {
    display: none !important;
  }
  }
}

/* ── Formularios de parámetros: campos calculados/solo lectura ─────────── */
.wp-pf-computed-label {
  color: #8a9ab5 !important;
  font-size: .78rem !important;
  font-style: italic;
}

.wp-pf-computed-input {
  background-color: #f0f4f8 !important;
  border-color: #c8d6e5 !important;
  color: #4a5568 !important;
  cursor: default;
  font-variant-numeric: tabular-nums;
}

/* ── DnD import: evita que selects/inputs capturen el drop ────────────── */
.wp-dragging .wp-dnd-target select,
.wp-dragging .wp-dnd-target input {
  pointer-events: none !important;
}

/* ── Geoman toolbar: estilo coherente con la app ────────────────────── */
.leaflet-pm-toolbar {
  border-radius: 6px !important;
  box-shadow: 0 1px 5px rgba(0,0,0,.15) !important;
  overflow: hidden;
  background: #fff !important;
  border: 1px solid #dee2e6 !important;
}
.leaflet-pm-toolbar a {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 34px !important;
  height: 34px !important;
  background: #fff !important;
  border: none !important;
  border-bottom: 1px solid #e9ecef !important;
  color: #495057 !important;
  font-size: 15px !important;
  text-decoration: none !important;
}
.leaflet-pm-toolbar a:last-child {
  border-bottom: none !important;
}
.leaflet-pm-toolbar a:hover {
  background: rgb(0, 161, 96) !important;
  color: #fff !important;
}
.leaflet-pm-toolbar a.active,
.leaflet-pm-toolbar a.leaflet-pm-active {
  background: rgb(0, 161, 96) !important;
  color: #fff !important;
}

.wp-pf-computed-input:focus {
  box-shadow: none !important;
  border-color: #c8d6e5 !important;
  background-color: #f0f4f8 !important;
}
