/* =========================================================
   1. ESTRUCTURA GRID (A prueba de balas)
   ========================================================= */
html, body {
  margin: 0; padding: 0;
  height: 100vh;            /* Altura total obligatoria */
  width: 100%;
  overflow: hidden;         /* SIN SCROLL */
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: #ffffff;
}

.wrf-page {
  /* GRID: La solución definitiva */
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto; /* Cabeza, Cuerpo, Pie */
  
  height: 100vh;            /* Ocupa toda la pantalla */
  width: 100%;
  max-width: 65%;
  margin: 0 auto;
  padding: 5px 15px;
  box-sizing: border-box;
}

/* =========================================================
   2. FILA 1: CABECERA (Se ajusta al contenido)
   ========================================================= */
.top-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 1000;
}

.wrf-title {
  color: #1a2b4b; font-size: 1.5rem; margin: 5px 0 10px 0;
  text-align: center; font-weight: 800;
}

.wrf-controls {
  width: 100%; display: flex; justify-content: center; gap: 15px;
  margin-bottom: 5px; flex-wrap: wrap;
}

.wrf-control { flex: 1; min-width: 280px; max-width: 500px; }
.wrf-label { font-size: 0.75rem; font-weight: 700; color: #5b6b8c; text-transform: uppercase; margin-bottom: 4px; }

/* Dropdown Styles (Tu estilo bonito) */
.wrf-dropdown .Select-control { border-radius: 10px; border: 1px solid #dce0e8; height: 40px; display: flex; justify-content: space-between; align-items: center; }
.wrf-dropdown .Select-value-label, .wrf-dropdown .Select-placeholder { line-height: 38px; padding-left: 10px; }
.wrf-dropdown .Select-arrow-zone { width: 35px; display: flex; justify-content: center; align-items: center; cursor: pointer; }
.wrf-dropdown .Select-menu-outer { z-index: 99999; animation: slideDownFade 0.2s ease-out forwards; }

/* =========================================================
   3. FILA 2: IMAGEN (Elástica y centrada)
   ========================================================= */
.middle-section {
  width: 100%;
  height: 100%;             /* Ocupa todo el espacio de la celda del grid */
  position: relative;       /* Para centrar la imagen */
  overflow: hidden;         /* Nada sale de aquí */
  
  display: flex;            /* Centrado perfecto */
  justify-content: center;
  align-items: center;
}

.wrf-card {
  width: 100%;
  height: 100%;             /* Llena el espacio del grid */
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e8ecf5;
  padding: 10px;
  box-sizing: border-box;
  overflow: hidden;         /* No permite que nada salga de la tarjeta */
}

/* 2. El encabezado ocupa su espacio y no se mueve */
.wrf-card-header {
  flex: 0 0 auto;           /* No se encoge ni crece */
  text-align: center;
  margin-bottom: 5px;
}

.wrf-card-title {
  font-weight: 800;
  color: #213a63;
  font-size: 1.1rem;
  /* Quita el text-shadow si lo tenías, ya no hace falta porque está sobre blanco */
  text-shadow: none; 
}
.wrf-card-subtitle { font-size: 0.85rem; color: #6b778d; text-shadow: 0 0 10px rgba(255,255,255,0.8); }

#frame-img {
  flex: 1 1 0%;             /* Ocupa el espacio restante y PUEDE encogerse */
  min-height: 0;            /* CLAVE: Permite que la imagen se reduzca si el espacio es poco */
  width: 100%;
  height: 100%;
  object-fit: contain;      /* Mantiene el mapa entero (con longitudes) visible */
  display: block;
}

/* =========================================================
   4. FILA 3: PIE DE PÁGINA (Siempre visible)
   ========================================================= */
.bottom-section {
  width: 100%;
  padding-top: 5px;
  padding-bottom: 5px;
  z-index: 100;
  background: white;
}

.wrf-btn-row { display: flex; justify-content: center; gap: 8px; margin-bottom: 5px; }
.wrf-btn { background: #f2f6fb; border: 1px solid #dbe6f5; border-radius: 50px; padding: 8px 16px; color: #24446e; font-weight: 700; cursor: pointer; }
.wrf-btn:hover { background: #e7f0ff; }
.wrf-btn-primary { background: #2f6fed; color: #fff; border: none; }
#wrapper-slider { width: 100%; padding: 0 10px; }

@keyframes slideDownFade { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 768px) { .wrf-controls { flex-direction: column; } }