/* Opaque loading screen shown until auth-guard.js confirms an active D1-backed
   session; removed on success. Covers the page visually without hiding it
   from layout, so libraries like gmp-map that break when initialized inside
   a display:none/visibility:hidden container still start up correctly. */
.auth-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
}

.auth-loading-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(43, 43, 43, 0.15);
  border-top-color: #2b2b2b;
  border-radius: 50%;
  animation: auth-spin 0.8s linear infinite;
}

@keyframes auth-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Fixed logout pill, top-right, out of the way of the theme switch
   (bottom-right) and brand pill (bottom-left). */
.auth-topbar {
  position: fixed;
  top: 20px;
  right: 30px;
  z-index: 1050;
}

.btn-logout {
  background-color: #2b2b2b;
  border-color: #2b2b2b;
  color: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45);
}

.btn-logout:hover,
.btn-logout:focus {
  background-color: #1a1a1a;
  border-color: #1a1a1a;
  color: #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

@media (max-width: 576px) {
  .auth-topbar {
    top: 10px;
    right: 10px;
  }
}

/* Shared fixed anchor for the bottom-left pills (How to use + logo), so
   they sit side by side and stay in sync regardless of either one's
   content width. */
.bottom-left-pills {
  position: fixed;
  bottom: 20px;   /* Distancia desde el fondo */
  left: 30px;     /* Distancia desde la izquierda */
  z-index: 1050;  /* Por encima de la mayoría de elementos de BS5 */
  display: flex;
  align-items: center;
  gap: 10px;
}

@media (max-width: 576px) {
  .bottom-left-pills {
    bottom: 10px;
    left: 10px;
    gap: 8px;
  }
}

/* Hover tooltip shared by the bottom-left pills (How to use + logo). The
   label comes from data-tooltip, and the bubble opens upward since both
   pills sit at the bottom edge of the page. */
.pill-tooltip {
  position: relative;
}

.pill-tooltip::before,
.pill-tooltip::after {
  position: absolute;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1060;
}

.pill-tooltip::after {
  content: attr(data-tooltip);
  bottom: calc(100% + 12px);
  background: #212529;
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.pill-tooltip::before {
  content: "";
  bottom: calc(100% + 6px);
  border: 5px solid transparent;
  border-top-color: #212529;
}

.pill-tooltip:hover::before,
.pill-tooltip:hover::after,
.pill-tooltip:focus-visible::before,
.pill-tooltip:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.brand-pill {
  order: 2; /* Logo sits to the right of the "How to use" pill */
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #0a1f44; /* azul oscuro */
  border-radius: 50px;
  padding: 6px 18px;
  transition: all 0.3s ease;
}

.brand-pill:hover {
  transform: scale(1.05);
}

.brand-pill-logo {
  height: 32px;
  width: auto;
}

@media (max-width: 576px) {
  .brand-pill {
    padding: 5px 14px;
  }

  .brand-pill-logo {
    height: 26px;
  }
}

/* Same pill treatment as the bottom-left buttons (How to use + logo):
   fully rounded, matching padding/shadow, gentle hover scale. Background
   stays bg-body so the pill itself flips with the theme it controls. */
.theme-switch-container {
  position: fixed;
  bottom: 20px;   /* Distancia desde el fondo */
  right: 30px;    /* Distancia desde la derecha */
  z-index: 1050;  /* Por encima de la mayoría de elementos de BS5 */
  display: flex;
  align-items: center;
  padding: 8px 18px;
  border-radius: 50px;
  transition: all 0.3s ease;
}

.theme-switch-container:hover {
  transform: scale(1.05);
}

@media (max-width: 576px) {
  .theme-switch-container {
    bottom: 10px;
    right: 10px;
    padding: 6px 14px;
  }
}

.badge-3d-info {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 5;
    /* Fondo que se adapta al modo oscuro/claro con transparencia */
    background-color: rgba(var(--bs-body-bg-rgb), 0.6);
    color: var(--bs-body-color);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    
    padding: 6px 14px;
    border-radius: 50px;
    border: 1px solid rgba(var(--bs-emphasis-color-rgb), 0.15);
    font-size: 0.8rem;
    font-weight: 500;
    
    /* Importante: permite interactuar con el 3D a través de la etiqueta */
    pointer-events: none; 
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Pequeña animación de parpadeo suave para el icono */
.badge-3d-info i {
    animation: pulse-icon 2s infinite;
}

@keyframes pulse-icon {
    0% { opacity: 1; }
    50% { opacity: 0.4; }
    100% { opacity: 1; }
}
#renderStructures {
    cursor: grab; /* Mano abierta por defecto */
    width: 100%;
    height: 100%;
    min-height: 400px;
    position: relative;
    overflow: hidden;
}

#renderStructures:active {
    cursor: grabbing; /* Mano cerrada mientras se hace click/arrastra */
}

#renderStructures canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}
 body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
        #map { height: 450px; width: 100%; border-radius: 15px; border: 1px solid #ddd; }
        .card { border: none; border-radius: 20px; box-shadow: 0 15px 35px rgba(0,0,0,0.1); }
        .result-card { transition: all 0.3s ease; border-left: 5px solid #0d6efd; }
        .label-custom { font-weight: 700; color: #495057; font-size: 0.85rem; text-transform: uppercase; }
        .direction-result { padding: 8px 0; border-bottom: 1px solid #eee; }
        .direction-result:last-child { border-bottom: none; }
        .max-result { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
        .table-responsive { max-height: 400px; overflow-y: auto; }

 gmp-map {
    display: block;
    margin: 20px;
    width: 95%;
    height: 500px;
    margin-bottom: 1em;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
}
/* Wind Results Section */
/* Wind Results Section - Limpiado para no romper Bootstrap */

.table-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.results-table th {
    background: var(--primary-color);
    color: rgb(32, 3, 3);
    text-align: center;
    font-weight: 600;
    font-size: 14px;
}

.results-table td {
    padding: 5px 1px;
    text-align: center;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}

.results-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.results-table tr:hover {
    background-color: #f0f8ff;
}





/* Responsive Table */
@media (max-width: 768px) {
    .results-table th,
    .results-table td {
        padding: 8px 4px;
        font-size: 12px;
    }
    
    .results-table th {
        font-size: 11px;
    }
}       