/* ============================================
   SIMULADOR DE DISPERSIÓN DE GASES - CSS
   Archivo CSS completo reescrito y optimizado
   ============================================ */

/* --- VARIABLES CSS --- */
:root {
    --color-primary: #007bff;
    --color-primary-dark: #0056b3;
    --color-secondary: #6c757d;
    --color-success: #28a745;
    --color-warning: #ffc107;
    --color-danger: #dc3545;
    --color-info: #17a2b8;
    --color-light: #f8f9fa;
    --color-dark: #333;
    --color-border: #ddd;
    --color-background: #eef2f9;
    --color-white: #ffffff;
    --border-radius: 8px;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --transition: all 0.2s ease;
}

/* --- ESTILOS PARA WEATHER BADGE --- */
.weather-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
    transition: var(--transition);
}

.weather-badge.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.weather-badge.warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.weather-badge.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.weather-badge.pending {
    background-color: #e2e3e5;
    color: #383d41;
    border: 1px solid #d6d8db;
}

/* --- RESET Y GENERAL --- */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--color-background);
    color: var(--color-dark);
    line-height: 1.6;
    margin: 0;
    padding: 20px;
}

h1 {
    text-align: center;
    color: #1a3a6e;
    font-size: 2.5em;
    margin-bottom: 30px;
    font-weight: 700;
}

h2,
h3,
h4,
h5,
h6 {
    margin-top: 0;
    color: var(--color-primary-dark);
}

/* ===== NUEVO LAYOUT DE DOS COLUMNAS ===== */
.container {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Contenedores de filas */
.row-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    width: 100%;
    align-items: start;
}

/* Columnas */
.left-column,
.right-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Contenedor centrado del botón de simulación */
.simulation-button-container {
    text-align: center;
    margin: 30px 0;
    grid-column: 1 / -1;
    /* Ocupa toda la fila */
}

/* ===== RESPONSIVE PARA NUEVO LAYOUT ===== */
@media (max-width: 1200px) {
    .row-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .container {
        max-width: 100%;
        padding: 0 10px;
    }
}

/* --- LAYOUT PRINCIPAL LEGACY (mantener compatibilidad) --- */
.form-section,
.results-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* --- TARJETAS --- */
.input-card,
.results-card {
    background: var(--color-white);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--box-shadow);
    margin-bottom: 20px;
    /* ✅ Auto-ajuste: el contenido determina el tamaño */
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Aumentar altura mínima para contenedores con gráficos de pluma */
.results-card:has(#plume-plot-top),
.results-card:has(#plume-plot-side) {
    min-height: 700px;
    overflow: hidden;
    /* Evitar desbordamiento vertical */
}

.input-card h3 {
    font-size: 1.5em;
    color: var(--color-primary);
    margin-top: 0;
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: 10px;
    margin-bottom: 20px;
    /* ✅ Auto-ajuste del título */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.results-card h2 {
    font-size: 1.8em;
    color: #1a3a6e;
}

/* --- FORMULARIO --- */
form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px 20px;
    /* ✅ Auto-ajuste: las columnas se adaptan al contenido */
    width: 100%;
}

label {
    font-weight: 600;
    display: block;
    margin-bottom: 5px;
    color: var(--color-dark);
}

input[type="number"],
input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    width: 100%;
    font-size: 1em;
    transition: var(--transition);
}

input[type="number"]:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* --- BOTONES --- */
button {
    background: linear-gradient(90deg, var(--color-primary), var(--color-primary-dark));
    color: var(--color-white);
    padding: 8px 20px;
    /* Cambio de 12px a 8px */
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: var(--transition);
    display: inline-block;
    text-decoration: none;
    text-align: center;
    line-height: 1.2;
}

button:hover {
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.4);
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Botón principal de envío */
button[type="submit"] {
    background: linear-gradient(90deg, var(--color-primary), var(--color-primary-dark));
    color: var(--color-white);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: bold;
    margin: 30px auto 20px;
    display: block;
    transition: var(--transition);
    position: relative;
    z-index: 1;

    /* ✅ AUTO-AJUSTE: Una sola línea de texto */
    padding: 15px 30px;
    /* Padding más compacto */
    font-size: 1.1em;
    /* Tamaño de fuente ajustado */
    width: auto;
    /* Ancho automático */
    max-width: 100%;
    /* Máximo ancho disponible */
    min-width: 200px;
    /* Ancho mínimo */
    white-space: nowrap;
    /* Evita que se parta en líneas */
    text-align: center;
    /* Texto centrado */
    box-sizing: border-box;
    /* Incluye padding en el ancho */
}

button[type="submit"]:hover {
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.5);
    transform: translateY(-3px);
}

/* Botones secundarios */
.secondary-button {
    background-color: var(--color-light);
    color: #495057;
    border: 1px solid #dee2e6;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
    display: inline-block;
}

.secondary-button:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-1px);
}

/* Botones primarios */
.primary-button {
    background-color: var(--color-primary);
    color: var(--color-white);
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
    display: inline-block;
}

.primary-button:hover {
    background-color: var(--color-primary-dark);
    transform: translateY(-1px);
}

/* Botones específicos */
.search-button {
    background: var(--color-success);
    color: var(--color-white);
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    font-size: 14px;
}

.search-button:hover {
    background: #218838;
}

.gps-button {
    background: var(--color-info);
    color: var(--color-white);
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
}

.gps-button:hover {
    background: #138496;
}

.gps-button:disabled {
    background: var(--color-secondary);
    cursor: not-allowed;
}

.map-control-btn {
    background: var(--color-secondary);
    color: var(--color-white);
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.map-control-btn:hover {
    background: #5a6268;
}

.sync-button {
    background: var(--color-warning);
    color: #212529;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.sync-button:hover {
    background: #e0a800;
}

/* --- INTERRUPTOR DE UNIDADES --- */
.toggle-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 15px 0;
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: var(--color-white);
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--color-primary);
}

input:checked+.slider:before {
    transform: translateX(26px);
}

#unit-display {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--color-primary-dark);
}

/* --- RESULTADOS --- */
#results-summary {
    font-size: 1.1em;
    background-color: var(--color-light);
    padding: 20px;
    border-radius: var(--border-radius);
    border: 1px solid #e9ecef;
    margin-bottom: 20px;
}

/* --- UBICACIÓN --- */
.location-method-selector {
    margin-bottom: 20px;
}

.location-method-selector h4 {
    margin-bottom: 10px;
    color: var(--color-dark);
    font-size: 16px;
}

.method-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.method-option {
    display: flex;
    align-items: center;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    background: #f9f9f9;
}

.method-option:hover {
    border-color: var(--color-primary);
    background: #f0f8ff;
}

.method-option input[type="radio"] {
    margin-right: 8px;
}

.method-option:has(input[type="radio"]:checked) {
    border-color: var(--color-primary);
    background: #e3f2fd;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
}

.method-icon {
    font-size: 20px;
    margin-right: 8px;
}

.method-text {
    font-weight: 500;
    color: var(--color-dark);
}

/* --- CONTENEDORES DE INPUT --- */
.location-inputs {
    margin-bottom: 20px;
}

.location-input-group {
    display: none;
    padding: 15px;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    background: var(--color-white);
    transition: var(--transition);
}

.location-input-group.active {
    display: block;
}

/* --- BÚSQUEDA DE DIRECCIÓN --- */
.address-search {
    width: 100%;
}

.search-container {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.search-container input {
    flex: 1;
}

.address-results {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    display: none;
    background: var(--color-white);
}

.address-result-item {
    padding: 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: var(--transition);
}

.address-result-item:hover {
    background: #f5f5f5;
}

.address-result-item:last-child {
    border-bottom: none;
}

/* --- GPS --- */
.gps-container {
    text-align: center;
}

.gps-info {
    color: #666;
    margin-bottom: 15px;
}

.gps-status {
    margin-top: 10px;
    padding: 10px;
    border-radius: 4px;
    min-height: 20px;
}

/* --- MAPA --- */
.map-container {
    width: 100%;
}

.map-info {
    color: #666;
    margin-bottom: 10px;
}

.location-map {
    width: 100%;
    height: 300px;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    margin-bottom: 10px;
}

.map-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.map-coordinates {
    font-family: monospace;
    font-size: 14px;
    color: #666;
    background: var(--color-light);
    padding: 4px 8px;
    border-radius: 4px;
}

/* --- PREVIEW DEL INCIDENTE --- */
.incident-preview {
    background: var(--color-light);
    padding: 15px;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--color-primary);
    margin-bottom: 15px;
}

.incident-preview h4 {
    margin-bottom: 10px;
    color: var(--color-dark);
}

.preview-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.preview-item {
    display: flex;
    justify-content: space-between;
}

.preview-label {
    font-weight: 500;
    color: #666;
}

.preview-value {
    font-family: monospace;
    color: var(--color-dark);
}

/* --- ACCIONES DE UBICACIÓN --- */
.location-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.location-buttons {
    margin-top: 15px;
    text-align: center;
}

/* --- PREVIEW DE PLUMA --- */
.plume-section-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    /* Aumentado el gap */
    margin-top: 30px;
    /* ✅ ANCHO COMPLETO */
    max-width: 100%;
    /* Ocupa todo el ancho */
    width: 100%;
    /* Ancho completo */
    margin-left: 0;
    /* Sin margen izquierdo */
    margin-right: 0;
    /* Sin margen derecho */
    padding: 0 20px;
    /* Padding lateral para respirar */
    box-sizing: border-box;
}

.plume-section-container .results-card {
    width: 100%;
    max-width: 100%;
    margin-bottom: 0;
    /* Sin margen inferior extra */
}

/* ✅ DUPLICAR ALTURA de las vistas de pluma */
#plume-plot-top,
#plume-plot-side {
    min-height: 1200px;
    /* Extended 50% from 800px */
    height: 1200px;
    /* Altura extendida 50% */
    width: 100%;
    /* Asegurar que Plotly use todo el espacio */
    box-sizing: border-box;
}

/* Asegurar que elementos SVG/Canvas de Plotly ocupen 100% del ancho */
#plume-plot-top svg,
#plume-plot-top canvas,
#plume-plot-side svg,
#plume-plot-side canvas,
#plume-plot-top .js-plotly-plot,
#plume-plot-side .js-plotly-plot {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
}

/* Ajustar tamaño de controles modebar de Plotly en plumas térmicas */
#plume-plot-top .modebar,
#plume-plot-side .modebar {
    transform: scale(1.05);
    /* Reduced to half from 2.1 */
    transform-origin: top right;
    margin-top: 10px;
    margin-right: 10px;
}

#plume-plot-top .modebar-btn,
#plume-plot-side .modebar-btn {
    width: 36px !important;
    /* Reduced to half from 72px */
    height: 36px !important;
    /* Reduced to half from 72px */
    padding: 3px !important;
    /* Reduced to half from 6px */
}

#plume-plot-top .modebar-btn svg,
#plume-plot-side .modebar-btn svg {
    width: 24px !important;
    /* Reduced to half from 48px */
    height: 24px !important;
    /* Reduced to half from 48px */
}

#plume-plot-top .modebar-group,
#plume-plot-side .modebar-group {
    padding: 0 3px !important;
    /* Reduced to half from 6px */
}

/* --- 4. AJUSTES RESPONSIVE MEJORADOS --- */
@media (max-width: 1200px) {
    .container {
        flex-direction: column;
        max-width: 100%;
        padding: 0 10px;
    }

    .plume-section-container {
        max-width: 100%;
        padding: 0 10px;
    }

    #plume-plot-top,
    #plume-plot-side {
        min-height: 600px;
        /* Reducido en pantallas medianas */
        height: 600px;
    }
}

/* ===== SATELLITE 3D MAP HEIGHTS (INTERFACE VIEW) ===== */
/* Top View Map Container */
#satellite-map-container {
    min-height: 900px !important;
    height: 900px !important;
}

/* Side View Map Container */
#mapbox-side-view-container {
    min-height: 900px !important;
    height: 900px !important;
}

/* Ensure mapbox canvas fills container */
.mapboxgl-canvas {
    width: 100% !important;
    height: 100% !important;
}

/* =========================================================================
   ESTILOS DE IMPRESIÓN (PDF)
   ========================================================================= */
@media print {
    body {
        margin: 0;
        padding: 0;
        background: white;
        font-size: 11pt;
    }

    /* Ocultar elementos irrelevantes */
    button,
    nav,
    .no-print,
    .toggle-container,
    .simulation-button-container,
    .location-actions,
    .map-controls,
    .modal,
    .print-hide-container,
    #print-status,
    header button,
    header .user-info,
    .section-intro,
    /* Ocultar introducciones para ahorrar espacio */
    small,
    /* Ocultar textos de ayuda pequeños */
    .help-text,
    .print-hide {
        display: none !important;
    }

    /* Estructura general */
    .container {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        display: block !important;
    }

    /* Force linear layout */
    .row-container {
        display: block !important;
    }

    .left-column,
    .right-column {
        display: block !important;
        width: 100% !important;
    }

    /* Cards COMPACTAS para imprimir (Fix Spacing Page 2 & 4) */
    .input-card,
    .results-card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        padding: 8px 15px !important;
        /* Reducido de 15px */
        margin-bottom: 10px !important;
        /* Reducido de 20px */
        page-break-inside: avoid;
    }

    /* Títulos muy compactos */
    h1 {
        font-size: 20pt;
        margin-bottom: 10px;
    }

    h2 {
        font-size: 16pt;
        margin-top: 15px;
        /* Reducido de 30px */
        margin-bottom: 10px;
        border-bottom: 2px solid #333;
    }

    h3 {
        font-size: 13pt;
        color: #1a3a6e !important;
        border-bottom: 1px solid #ccc;
        margin-bottom: 5px !important;
        /* Reducido */
        padding-bottom: 3px !important;
    }

    /* Ajustes específicos de margen para secciones problemáticas */
    #regulatory-region-container,
    #unit-switcher,
    /* ID hipotético, verificar HTML */
    .input-card:has(h3 span[data-i18n="ui.chemical"]) {
        margin-bottom: 8px !important;
    }

    /* ============================================================
       FIX IMÁGENES Y GRÁFICOS
       ============================================================ */

    /* Horizontal Tank */
    #tank-diagram-placeholder svg,
    #tank-diagram-placeholder .tank-image-only {
        display: none !important;
    }

    img[data-tank-backup] {
        display: block !important;
        max-width: 100% !important;
        height: auto !important;
        margin: 5px auto !important;
        page-break-inside: avoid;
    }

    /* Standard Screen Layout for Plots */
    #plume-plot-top,
    #plume-plot-side,
    #concentration-plot,
    #dynamic-plot {
        width: 100%;
        height: auto;
        min-height: 500px;
        overflow: visible;
    }

    /* Ocultar Satellite 3D Viewer Genérico si aparece (Global) */
    .results-card:has(h2[data-i18n="ui.satellite3DMapViewer"]) {
        display: none !important;
    }

    /* Mapbox adjustments */
    .mapboxgl-canvas {
        width: 100% !important;
        height: 100% !important;
        position: relative !important;
    }

    /* Hide Plotly Modebar and Controls in Print */
    .modebar,
    .modebar-container,
    .js-plotly-plot .plotly .modebar {
        display: none !important;
    }

    /* Top View & Side View Graphs (Limitar altura para evitar saltos y duplicados) */
    #plume-plot-top,
    #plume-plot-side,
    #concentration-plot,
    #dynamic-plot {
        max-height: 500px !important;
        height: auto !important;
        width: 100% !important;
        overflow: hidden !important;
        page-break-inside: avoid !important;
        display: block !important;
        margin: 0 !important;
        /* Remove snippet margin */
    }

    /* Fix page breaks & Tighten Containers */
    /* El contenedor debe terminar inmediatamente después de la imagen */
    .results-card:has(#plume-plot-top) {
        page-break-before: always;
        page-break-inside: avoid;
        break-inside: avoid-page;
        margin-top: 10px !important;
        height: fit-content !important;
        max-height: none !important;
        min-height: 0 !important;
        overflow: visible !important;
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
    }

    /* ===== FIX: Thermal Side View - Keep EVERYTHING together on one page ===== */
    .results-card:has(#plume-plot-side) {
        page-break-before: auto !important;
        /* Don't force page break */
        page-break-inside: avoid !important;
        break-inside: avoid-page !important;
        page-break-after: auto !important;
        position: relative !important;
        overflow: visible !important;
        /* CRITICAL FIX: Show content instead of hiding */
        height: auto !important;
        min-height: 600px !important;
        /* CRITICAL FIX: Increased to show full image */
        max-height: none !important;
        /* CRITICAL FIX: Remove height limit to show full content */
        padding: 12px !important;
        margin-top: 10px !important;
        margin-bottom: 10px !important;
    }

    /* Title should not break from container */
    .results-card:has(#plume-plot-side) h2 {
        page-break-after: avoid !important;
        break-after: avoid-page !important;
    }

    #plume-plot-side {
        position: relative !important;
        height: auto !important;
        /* Let content determine height */
        min-height: 500px !important;
        /* CRITICAL FIX: Increased to show full image */
        max-height: none !important;
        /* CRITICAL FIX: Remove limit to show full image */
        overflow: visible !important;
        /* CRITICAL FIX: Show content instead of hiding */
        display: block !important;
        page-break-before: avoid !important;
        break-before: avoid-page !important;
    }


    /* NUCLEAR OPTION: Force container to be positioning context */
    #plume-plot-side {
        position: relative !important;
        min-height: 500px !important;
        width: 100% !important;
    }

    /* FORCE image to dominate container space with absolute positioning */
    #plume-plot-side .print-image,
    #plume-plot-side img {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 100% !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        margin: 0 !important;
        object-fit: contain !important;
        z-index: 999 !important;
    }

    /* Hide original SVG and canvas to prevent duplication */
    #plume-plot-side svg,
    #plume-plot-side canvas {
        display: none !important;
    }

    /* Ocultar cualquier texto fantasma o scrollbars */
    ::-webkit-scrollbar {
        display: none !important;
    }

    /* Ensure images fill width */
    .print-image {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        object-fit: contain !important;
        margin: 0 auto !important;
        display: block !important;
        border: none !important;
    }

    .results-card:has(#map3d-iframe),
    .results-card:has(#map3d-placeholder) {
        page-break-before: always;
        page-break-inside: avoid;
    }

    /* Portada Técnica */
    #print-technical-cover {
        display: block !important;
        text-align: center;
        margin-bottom: 30px;
        padding-bottom: 15px;
        border-bottom: 3px double #000;
    }
}
}

@media (max-width: 768px) {
    .plume-section-container {
        padding: 0 5px;
    }

    #plume-plot-top,
    #plume-plot-side {
        min-height: 400px;
        /* Altura normal en móviles */
        height: 400px;
    }

    button[type="submit"] {
        width: 100%;
        /* Ancho completo en móviles */
        max-width: none;
        font-size: 1.2em;
        padding: 18px 20px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .plume-section-container {
        padding: 0;
        margin-top: 20px;
    }

    #plume-plot-top,
    #plume-plot-side {
        min-height: 300px;
        /* Altura mínima en móviles pequeños */
        height: 300px;
    }

    button[type="submit"] {
        font-size: 1.1em;
        padding: 16px 20px;
    }
}

.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--color-dark);
}

.wind-direction-control,
.plume-size-control,
.opacity-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wind-direction-control input[type="range"],
.plume-size-control input[type="range"],
.opacity-control input[type="range"] {
    flex: 1;
}

.wind-direction-control span,
.plume-size-control span,
.opacity-control span {
    min-width: 60px;
    text-align: center;
    font-family: monospace;
    background: var(--color-white);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--color-border);
}

/* --- INFORMACIÓN DE ZONAS --- */
.zone-info {
    margin-top: 20px;
}

.zone-info h5 {
    margin-bottom: 10px;
    color: var(--color-dark);
}

.zone-distances {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.zone-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: var(--color-white);
    border-radius: 4px;
    border-left: 4px solid;
}

.zone-item.aegl-3 {
    border-left-color: var(--color-danger);
}

.zone-item.idlh {
    border-left-color: #fd7e14;
}

.zone-item.aegl-2 {
    border-left-color: var(--color-warning);
}

.zone-item.aegl-1 {
    border-left-color: var(--color-success);
}

.zone-name {
    font-weight: 500;
}

.zone-distance {
    font-family: monospace;
    color: #666;
}

/* --- ACCIONES DE PLUMA --- */
.plume-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* --- SECCIÓN DE PLUMAS --- */
.plume-section-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 30px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.plume-section-container .results-card {
    width: 100%;
}

/* --- GRÁFICOS --- */
#plume-plot-top,
#plume-plot-side {
    min-height: 400px;
    width: 100%;
}

#concentration-plot,
#dynamic-plot {
    min-height: 300px;
    width: 100%;
    margin: 10px 0;
}

/* --- ESTADOS --- */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: " ⏳";
}

.error-state {
    border-color: var(--color-danger) !important;
    background-color: #f8d7da !important;
}

.success-state {
    border-color: var(--color-success) !important;
    background-color: #d4edda !important;
}

.warning-state {
    border-color: var(--color-warning) !important;
    background-color: #fff3cd !important;
}

/* --- ANIMACIONES --- */
.location-input-group {
    transition: var(--transition);
}

.method-option {
    transition: var(--transition);
}

/* --- RESPONSIVE DESIGN --- */
@media (max-width: 1200px) {
    .container {
        flex-direction: column;
        max-width: 100%;
    }

    .plume-section-container {
        max-width: 100%;
        padding: 0 10px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        gap: 20px;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    button {
        width: 100%;
        margin: 10px 0;
    }

    button[type="submit"] {
        width: 100%;
        max-width: none;
        font-size: 1.3em;
        padding: 20px;
        margin: 30px 0 20px;
    }

    .secondary-button,
    .primary-button {
        width: auto;
        margin: 5px;
    }

    h1 {
        font-size: 2em;
        margin-bottom: 20px;
    }

    .input-card,
    .results-card {
        padding: 20px;
    }

    .method-options {
        grid-template-columns: 1fr;
    }

    .plume-preview-container {
        grid-template-columns: 1fr;
    }

    .search-container {
        flex-direction: column;
    }

    .map-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .location-actions,
    .plume-actions {
        flex-direction: column;
    }

    .preview-info {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    body {
        padding: 5px;
    }

    .input-card,
    .results-card {
        padding: 15px;
    }

    h1 {
        font-size: 1.8em;
    }

    .form-grid {
        gap: 10px;
    }

    button[type="submit"] {
        font-size: 1.2em;
        padding: 18px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PRINT STYLES - Control de márgenes y formato para impresión/PDF
   ═══════════════════════════════════════════════════════════════════════════ */

/* Control de márgenes de página */
@page {
    margin: 15mm 15mm 20mm 15mm;
    /* top right bottom left */
    size: A4;
}

@media print {

    /* Reset general */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    /* ===== RESET DE EMERGENCIA ===== */
    body.printing {
        background: white !important;
        color: black !important;
        font-size: 11pt !important;
        line-height: 1.3 !important;
    }

    /* ===== FORZAR VISIBILIDAD DE CONTENEDORES ===== */
    #dynamic-plot,
    #plume-plot-top,
    #plume-plot-side,
    #concentration-plot,
    .plot-container,
    .chart-container {
        display: block !important;
        visibility: visible !important;
        height: 400px !important;
        min-height: 400px !important;
        width: 100% !important;
        page-break-inside: avoid !important;
    }

    /* ===== PLACEHOLDERS ===== */
    .print-placeholder,
    .print-map-placeholder {
        display: block !important;
        visibility: visible !important;
        page-break-inside: avoid !important;
    }

    /* ===== OCULTAR ORIGINALES DURANTE IMPRESIÓN ===== */
    body.printing .js-plotly-plot[style*="display: none"],
    body.printing canvas[style*="display: none"] {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
    }

    /* ===== CONTROL DE PÁGINAS ===== */
    .print-section {
        page-break-inside: avoid !important;
        margin-bottom: 20px !important;
    }

    .print-page-break {
        page-break-before: always !important;
    }

    /* ===== TÍTULOS CON GRÁFICOS ===== */
    h2 {
        page-break-after: avoid !important;
        margin-bottom: 5px !important;
    }

    h2+div,
    h2+img,
    h2+.print-image {
        margin-top: 0 !important;
    }

    /* ===== MEJORA CRÍTICA: RESET MÁS AGRESIVO DE MÁRGENES ===== */
    /* Reset más agresivo de márgenes */
    body,
    html,
    .container,
    .row,
    .col {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        float: none !important;
    }

    /* Eliminar sombras y efectos (excepto en elementos críticos) */
    *:not(svg):not(canvas):not(.js-plotly-plot):not(.js-plotly-plot *) {
        box-shadow: none !important;
        text-shadow: none !important;
    }

    /* Eliminar background-image solo en elementos no críticos */
    body,
    .container,
    .row,
    .col,
    .input-card {
        background-image: none !important;
    }

    /* ============================================================
       MOVED PRINT LOGIC (Para no romper layout de pantalla)
       ============================================================ */

    /* Hide Plotly Modebar and Controls in Print */
    .modebar,
    .modebar-container,
    .js-plotly-plot .plotly .modebar {
        display: none !important;
    }

    /* Top View & Side View Graphs (Limitar altura para evitar saltos y duplicados) */
    #plume-plot-top,
    #plume-plot-side,
    #concentration-plot,
    #dynamic-plot {
        max-height: 500px !important;
        height: auto !important;
        width: 100% !important;
        overflow: hidden !important;
        page-break-inside: avoid !important;
        display: block !important;
        margin: 0 !important;
    }

    /* Fix page breaks & Tighten Containers */
    /* El contenedor debe terminar inmediatamente después de la imagen */
    .results-card:has(#plume-plot-top),
    .results-card:has(#plume-plot-side) {
        page-break-before: avoid;
        page-break-inside: avoid;
        margin-top: 10px !important;
        height: fit-content !important;
        max-height: none !important;
        min-height: 600px !important;
        overflow: visible !important;
        padding: 12px !important;
        margin-bottom: 10px !important;
    }

    .results-card .card-body {
        padding: 0 !important;
        /* Agresivo */
    }

    /* Ocultar cualquier texto fantasma o scrollbars */
    ::-webkit-scrollbar {
        display: none !important;
    }

    /* Ensure images fill width */
    .print-image {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        object-fit: contain !important;
        margin: 0 auto !important;
        display: block !important;
        border: none !important;
    }

    .results-card:has(#map3d-iframe),
    .results-card:has(#map3d-placeholder) {
        page-break-before: always;
        page-break-inside: avoid;
    }

    /* Portada Técnica */
    #print-technical-cover {
        display: block !important;
        text-align: center;
        margin-bottom: 30px;
        padding-bottom: 15px;
        border-bottom: 3px double #000;
    }

    .input-card,
    .results-card {
        background-image: none !important;
    }

    /* ===== FIX CRÍTICO: ELIMINAR PÁGINA 1 EN BLANCO ===== */
    /* Ocultar TODO lo que no sea contenido principal */
    nav,
    header,
    footer,
    .navbar,
    .header,
    .footer,
    .sidebar,
    .menu,
    .nav-menu,
    .lang-selector,
    #language-selector,
    .section-header,
    button,
    .btn,
    .export-btn,
    .method-options,
    .location-method-selector,
    .location-input-group,
    .map-controls,
    .zoom-controls,
    .switch,
    input[type="checkbox"],
    input[type="radio"],
    .expand-icon,
    #export-button,
    #report-button,
    .no-print {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* ===== FIX CRÍTICO: OCULTAR SECTION HEADERS COMPLETAMENTE ===== */
    /* Estos headers vacíos causan páginas en blanco (especialmente página 7-8) */
    .section-header,
    .section-header.input-section,
    .section-header.output-section {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        page-break-before: avoid !important;
        page-break-after: avoid !important;
    }

    /* Ocultar elementos vacíos que causan espacios */
    .section-header:empty,
    .row-container:empty,
    .results-card:empty {
        display: none !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* ===== MEJORA CRÍTICA: CONTROL ESPECÍFICO PARA PÁGINAS EN BLANCO ===== */
    /* Eliminar alturas mínimas problemáticas */
    .section-header,
    [class*="container"],
    .row-container {
        min-height: 0 !important;
        height: auto !important;
    }

    /* Regla más agresiva para elementos vacíos */
    *:empty:not(script):not(style):not(br):not(hr):not(input):not(img) {
        display: none !important;
        height: 0 !important;
    }

    /* Forzar colapso de márgenes entre cards */
    .results-card+.results-card {
        margin-top: 0 !important;
        padding-top: 10px !important;
    }

    /* ===== FIX CRÍTICO: OCULTAR WIDGETS COMPLETAMENTE ===== */
    /* Thermodynamic Analysis Widget - ocultar TODO el widget */
    .thermodynamic-widget {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Widget headers (botones de expandir) */
    .widget-header {
        display: none !important;
        height: 0 !important;
    }

    /* Contenido de widgets */
    .widget-content {
        display: none !important;
        height: 0 !important;
    }

    /* Icons de expansión */
    .expand-icon,
    #thermo-expand-icon {
        display: none !important;
    }

    body {
        background-color: white !important;
        color: black !important;
        margin: 0 !important;
        padding: 0 !important;
        font-size: 12pt;
        line-height: 1.4;
        padding-top: 0 !important;
    }

    /* FIX: Resetear padding del body si tiene clase lang-selector */
    body.has-lang-selector {
        padding-top: 0 !important;
    }

    /* Contenedor principal - forzar al inicio */
    .container,
    main,
    #app,
    #main-content {
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        display: block !important;
        width: 100% !important;
    }

    /* ===== CARDS Y SECCIONES - REDUCIR MÁRGENES ===== */
    .input-card,
    .results-card {
        background: white !important;
        border: 1px solid #ddd !important;
        box-shadow: none !important;
        margin: 8px 0 !important;
        padding: 12px !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    /* Títulos */
    h1 {
        font-size: 24pt !important;
        margin: 0 0 15px 0 !important;
        padding: 0 !important;
        text-align: center !important;
        page-break-after: avoid !important;
        break-after: avoid !important;
    }

    h2 {
        font-size: 18pt !important;
        margin: 10px 0 8px 0 !important;
        padding: 0 0 6px 0 !important;
        border-bottom: 2px solid #333 !important;
        page-break-after: avoid !important;
        break-after: avoid !important;
        page-break-before: auto !important;
    }

    /* CRÍTICO: Forzar que contenido después de h2 se mantenga unido */
    h2+* {
        page-break-before: avoid !important;
        break-before: avoid !important;
    }

    h2+.js-plotly-plot,
    h2+div[id*="plot"],
    h2+div[id*="container"],
    h2+#dynamic-plot,
    h2+#concentration-plot {
        page-break-before: avoid !important;
        break-before: avoid !important;
        margin-top: 5px !important;
    }

    h3 {
        font-size: 14pt !important;
        margin: 10px 0 6px 0 !important;
        page-break-after: avoid !important;
        break-after: avoid !important;
    }

    h3+* {
        page-break-before: avoid !important;
        break-before: avoid !important;
    }

    h4,
    h5,
    h6 {
        font-size: 12pt !important;
        margin: 8px 0 4px 0 !important;
        page-break-after: avoid !important;
        break-after: avoid !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    /* ===== ROW CONTAINERS - CONTROL DE FLUJO ===== */
    .row-container {
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Forzar continuidad entre input-cards */
    .input-card+.input-card {
        page-break-before: avoid !important;
        break-before: avoid !important;
        margin-top: 8px !important;
    }

    /* ===== REDUCIR MÁRGENES DE BOOTSTRAP ===== */
    /* Estos márgenes grandes causan saltos de página innecesarios */
    .mb-4,
    .mb-5,
    .my-4,
    .my-5 {
        margin-bottom: 8px !important;
    }

    .mt-4,
    .mt-5,
    .my-4,
    .my-5 {
        margin-top: 8px !important;
    }

    /* Reducir espacios entre secciones de resultados */
    .results-section,
    .output-section,
    .simulation-section {
        margin-top: 8px !important;
        margin-bottom: 8px !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }

    /* Formularios y inputs - solo mostrar valores, no controles */
    .form-grid,
    .control-group {
        display: block !important;
    }

    input[type="text"],
    input[type="number"],
    input[type="email"],
    select,
    textarea {
        background: transparent !important;
        border: none !important;
        border-bottom: 1px solid #ccc !important;
        padding: 2px 0 !important;
        margin: 0 !important;
        -webkit-appearance: none !important;
        -moz-appearance: none !important;
        appearance: none !important;
    }

    /* Labels y texto */
    label {
        font-weight: bold !important;
        display: inline-block !important;
        margin-right: 8px !important;
        margin-bottom: 4px !important;
    }

    /* ===== OCULTAR SECTION-INTRO EN IMPRESIÓN ===== */
    .section-intro.print-hide,
    .section-intro {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* ===== GRÁFICOS PLOTLY - MANTENER JUNTOS ===== */
    /* Regla general para contenedores de gráficos */
    div[id*="plot"]:not(#plume-plot-top):not(#plume-plot-side):not(#dynamic-plot):not(#concentration-plot),
    div[id*="Plot"]:not(#plume-plot-top):not(#plume-plot-side):not(#dynamic-plot):not(#concentration-plot) {
        width: 100% !important;
        height: auto !important;
        max-height: 450px !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        page-break-after: avoid !important;
        break-after: avoid !important;
        page-break-before: auto !important;
        display: block !important;
        overflow: visible !important;
    }

    /* Regla general para gráficos Plotly (será sobrescrita por reglas específicas) */
    .js-plotly-plot {
        width: 100% !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        page-break-after: avoid !important;
        break-after: avoid !important;
        page-break-before: auto !important;
        display: block !important;
        overflow: visible !important;
    }

    /* ===== MEJORA CRÍTICA: OPTIMIZACIÓN ESPECÍFICA PARA PLOTLY ===== */
    /* Optimización Plotly */
    .js-plotly-plot .main-svg {
        overflow: visible !important;
    }

    /* Aplicar altura específica solo si no tiene altura ya definida */
    .plot-container:not(#plume-plot-top):not(#plume-plot-side):not(#dynamic-plot):not(#concentration-plot) {
        height: 400px !important;
        width: 100% !important;
        overflow: visible !important;
    }

    /* Control de canvas */
    canvas {
        max-height: 450px !important;
        page-break-inside: avoid !important;
    }

    #plume-plot-top,
    #plume-plot-side {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        page-break-after: avoid !important;
        break-after: avoid !important;
        min-height: 500px !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    #concentration-plot,
    #dynamic-plot {
        display: block !important;
        visibility: visible !important;
        width: 100% !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        page-break-after: avoid !important;
        break-after: avoid !important;
        min-height: 500px !important;
        height: 500px !important;
        max-height: 500px !important;
        overflow: visible !important;
    }

    /* Ajustar dynamic-plot con clase semántica - mantener altura consistente */
    #dynamic-plot.print-chart-container {
        min-height: 400px !important;
        height: auto !important;
        max-height: none !important;
    }

    /* Asegurar que los gráficos Plotly dentro de contenedores específicos respeten las alturas */
    #plume-plot-top .js-plotly-plot,
    #plume-plot-side .js-plotly-plot {
        height: auto !important;
        min-height: 500px !important;
        max-height: none !important;
    }

    #dynamic-plot .js-plotly-plot,
    #concentration-plot .js-plotly-plot {
        height: auto !important;
        min-height: 400px !important;
        max-height: none !important;
    }

    /* ===== IMÁGENES DE REEMPLAZO PARA IMPRESIÓN ===== */
    /* Asegurar que las imágenes de reemplazo sean visibles */
    .print-image,
    img[data-plotly-replacement],
    img[data-map-replacement] {
        display: block !important;
        visibility: visible !important;
        width: 100% !important;
        height: auto !important;
        max-height: 450px !important;
        margin: 10px auto !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    /* Ocultar gráficos originales durante impresión (cuando tienen imagen de reemplazo) */
    body.printing .js-plotly-plot[style*="display: none"],
    body.printing .js-plotly-plot:has(+ .print-image) {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
    }

    /* Ocultar canvas de mapas durante impresión (cuando tienen imagen de reemplazo) */
    body.printing canvas[style*="display: none"],
    body.printing canvas:has(+ .print-image) {
        display: none !important;
    }

    /* Asegurar que contenedores mantengan espacio */
    body.printing .print-chart-container,
    body.printing #dynamic-plot,
    body.printing #plume-plot-top,
    body.printing #plume-plot-side {
        display: block !important;
        visibility: visible !important;
        min-height: 400px !important;
    }

    /* Asegurar que títulos no queden solos */
    h2+.print-image,
    h2.print-chart-title+.print-image {
        margin-top: 5px !important;
        page-break-before: avoid !important;
        break-before: avoid !important;
    }

    .results-card:has(#concentration-plot),
    .results-card:has(#dynamic-plot) {
        display: block !important;
        visibility: visible !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        page-break-after: avoid !important;
        break-after: avoid !important;
    }

    div[id*="concentration"],
    div[id*="dynamic"] {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        page-break-after: avoid !important;
        break-after: avoid !important;
        max-height: 500px !important;
    }

    /* ===== MAPAS ===== */
    #mapbox-side-view-container {
        width: 100% !important;
        height: 450px !important;
        max-height: 450px !important;
        min-height: 450px !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        page-break-after: avoid !important;
        break-after: avoid !important;
        page-break-before: auto !important;
        display: block !important;
        overflow: hidden !important;
    }

    /* Asegurar que mapbox-side-view-container quepa en una página */
    .results-card:has(#mapbox-side-view-container) {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    /* ===== MEJORA CRÍTICA: CONTENEDORES ESPECÍFICOS DE MAPAS ===== */
    /* Contenedores específicos de mapas */
    #mapbox-side-view-container,
    #mapbox-top-view-container {
        height: 420px !important;
        position: relative !important;
    }

    /* Ocultar satellite-map-container (Top View) - solo mantener Side View */
    #satellite-map-container:not(#mapbox-side-view-container) {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
    }

    .mapboxgl-map,
    div[id*="map-container"],
    div[id*="Map"] {
        width: 100% !important;
        height: 400px !important;
        max-height: 400px !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        page-break-after: avoid !important;
        break-after: avoid !important;
        overflow: hidden !important;
    }

    #satellite-map-container img,
    #satellite-map-container svg,
    #satellite-map-container canvas,
    #mapbox-side-view-container img,
    #mapbox-side-view-container svg,
    #mapbox-side-view-container canvas,
    .results-card:has(#satellite-map-container) img,
    .results-card:has(#satellite-map-container) svg,
    .results-card:has(#satellite-map-container) canvas,
    .results-card:has(#mapbox-side-view-container) img,
    .results-card:has(#mapbox-side-view-container) svg,
    .results-card:has(#mapbox-side-view-container) canvas {
        max-width: 100% !important;
        height: auto !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    /* Tablas */
    table {
        width: 100% !important;
        border-collapse: collapse !important;
        margin: 10px 0 !important;
        page-break-inside: avoid;
        break-inside: avoid;
    }

    th,
    td {
        border: 1px solid #333 !important;
        padding: 6px !important;
        text-align: left !important;
    }

    th {
        background-color: #f0f0f0 !important;
        font-weight: bold !important;
    }

    /* Listas */
    ul,
    ol {
        margin: 10px 0 !important;
        padding-left: 25px !important;
    }

    li {
        margin: 4px 0 !important;
    }

    /* ===== FIX CRÍTICO: SECCIONES COMPLETAS EN UNA PÁGINA ===== */

    /* Evitar cortes GENERALES */
    .results-card {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .results-card:has(#plume-plot-top),
    .results-card:has(#plume-plot-side),
    .results-card:has(#concentration-plot),
    .results-card:has(#dynamic-plot),
    .results-card:has(#satellite-map-container),
    .results-card:has(#mapbox-side-view-container),
    .results-card:has(.js-plotly-plot),
    .results-card:has(.mapboxgl-map) {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        page-break-after: avoid !important;
        break-after: avoid !important;
        display: block !important;
    }

    .plume-section-container {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .row-container:has(.js-plotly-plot),
    .row-container:has(#satellite-map-container),
    .row-container:has(#mapbox-side-view-container) {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .row-container {
        margin: 0 !important;
        padding: 0 !important;
    }

    .results-card:has(#plume-plot-top),
    .results-card:has(#plume-plot-side) {
        page-break-before: auto !important;
    }

    /* 1. Resultados de la Simulación - MANTENER JUNTA */
    .results-card:has(#results-summary),
    .results-card:has(h2[data-i18n="results.simulationResults"]),
    #results-summary,
    [id*="simulation-results"],
    [class*="simulation-results"] {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        page-break-after: avoid !important;
        break-after: avoid !important;
        display: block !important;
        visibility: visible !important;
    }

    /* Asegurar que el título "Simulation Results" aparezca */
    h2[data-i18n="results.simulationResults"] {
        display: block !important;
        visibility: visible !important;
        page-break-after: avoid !important;
        break-after: avoid !important;
    }

    /* Compactar resultados para que quepan en una página */
    #results-summary {
        font-size: 10pt !important;
        line-height: 1.3 !important;
    }

    #results-summary.print-compact {
        max-height: 240mm !important;
        overflow: hidden !important;
        font-size: 9pt !important;
        line-height: 1.3 !important;
    }

    #results-summary table {
        font-size: 9pt !important;
        margin: 5px 0 !important;
    }

    #results-summary.print-compact table {
        font-size: 8pt !important;
        margin: 3px 0 !important;
    }

    #results-summary td,
    #results-summary th {
        padding: 4px !important;
    }

    #results-summary.print-compact td,
    #results-summary.print-compact th {
        padding: 3px !important;
    }

    /* 2. Categoría Química - MANTENER JUNTA */
    .results-card:has(.thermodynamic-widget),
    .thermodynamic-widget,
    .thermodynamic-widget .widget-content,
    [id*="chemical-category"],
    [class*="chemical-category"] {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        page-break-after: avoid !important;
        break-after: avoid !important;
    }

    /* 3. Evolución de la Fuga - MANTENER JUNTA (título + gráfico) */
    #leak-evolution-container,
    .results-card#leak-evolution-container,
    #leak-evolution-container h2,
    #leak-evolution-container #dynamic-plot,
    [id*="leak-evolution"],
    [class*="leak-evolution"] {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        page-break-after: avoid !important;
        break-after: avoid !important;
        page-break-before: auto !important;
    }

    /* Forzar que título y gráfico de Leak Evolution estén juntos */
    #leak-evolution-container h2 {
        page-break-after: avoid !important;
        break-after: avoid !important;
        margin-bottom: 5px !important;
    }

    #leak-evolution-container #dynamic-plot {
        page-break-before: avoid !important;
        break-before: avoid !important;
        margin-top: 0 !important;
    }

    /* 4. Pluma Superior - MANTENER JUNTA (título + imagen) */
    .results-card:has(#plume-plot-top),
    .results-card:has(#plume-plot-top) h2,
    .results-card:has(#plume-plot-top) #plume-plot-top,
    [id*="plume-top"],
    [class*="plume-top"] {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        page-break-after: avoid !important;
        break-after: avoid !important;
        page-break-before: auto !important;
    }

    /* Forzar que título y gráfico de Top View estén juntos */
    .results-card:has(#plume-plot-top) h2 {
        page-break-after: avoid !important;
        break-after: avoid !important;
        margin-bottom: 5px !important;
    }

    .results-card:has(#plume-plot-top) #plume-plot-top {
        page-break-before: avoid !important;
        break-before: avoid !important;
        margin-top: 0 !important;
    }

    /* 5. Vista Lateral - MANTENER JUNTA (título + mapa) */
    .results-card:has(#mapbox-side-view-container),
    .results-card:has(#mapbox-side-view-container) h2,
    .results-card:has(#mapbox-side-view-container) #mapbox-side-view-container,
    [id*="side-view"],
    [class*="side-view"],
    [id*="lateral"],
    [class*="lateral"] {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        page-break-after: avoid !important;
        break-after: avoid !important;
        page-break-before: auto !important;
    }

    /* Forzar que título y mapa Side View estén juntos */
    .results-card:has(#mapbox-side-view-container) h2 {
        page-break-after: avoid !important;
        break-after: avoid !important;
        margin-bottom: 5px !important;
    }

    .results-card:has(#mapbox-side-view-container) #mapbox-side-view-container {
        page-break-before: avoid !important;
        break-before: avoid !important;
        margin-top: 0 !important;
    }

    /* ===== ELIMINAR COMPLETAMENTE Satellite 3D Map Viewer ===== */
    .results-card:has(h2[data-i18n="ui.satellite3DMapViewer"]),
    .results-card:has(h2:contains("Satellite 3D Map Viewer")),
    .row-container:has(.results-card:has(h2[data-i18n="ui.satellite3DMapViewer"])),
    .row-container:has(.results-card:has(h2:contains("Satellite 3D Map Viewer"))) {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        page-break-before: avoid !important;
        page-break-after: avoid !important;
    }

    /* Ocultar cualquier contenedor de Satellite Map Viewer */
    h2[data-i18n="ui.satellite3DMapViewer"],
    h2:contains("Satellite 3D Map Viewer") {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
    }

    /* ===== FIX: Satellite 3D Map Top View Container ===== */
    /* Container should be image height + ~2cm (60px) */
    .results-card:has(#satellite-map-container) {
        height: auto !important;
        max-height: none !important;
        min-height: 0 !important;
        overflow: hidden !important;
        padding: 0 !important;
        padding-bottom: 60px !important;
        /* ~2cm extra space */
        margin-bottom: 0 !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    #satellite-map-container {
        height: 450px !important;
        max-height: 450px !important;
        min-height: 450px !important;
        overflow: hidden !important;
        display: block !important;
        position: relative !important;
    }

    /* Grids - convertir a bloque */
    .results-grid,
    .form-grid {
        display: block !important;
    }

    /* Colores y contrastes */
    .text-muted {
        color: #666 !important;
    }

    /* Limpiar floats */
    .clearfix::after {
        content: "";
        display: table;
        clear: both;
    }

    .results-section {
        page-break-before: auto;
    }

    /* Ocultar scrollbars */
    ::-webkit-scrollbar {
        display: none !important;
    }

    /* Ajustes de tamaño de fuente */
    .small-text {
        font-size: 10pt !important;
    }

    .large-text {
        font-size: 14pt !important;
    }

    /* Información del reporte */
    .report-header {
        text-align: center;
        margin-bottom: 20px;
        padding-bottom: 15px;
        border-bottom: 3px solid #000;
    }

    .report-footer {
        margin-top: 30px;
        padding-top: 15px;
        border-top: 1px solid #ccc;
        text-align: center;
        font-size: 10pt;
        color: #666;
    }

    /* Espaciado entre secciones */
    .input-card+.input-card {
        margin-top: 20px !important;
    }

    /* Gráficos responsive */
    .js-plotly-plot {
        width: 100% !important;
        height: 100% !important;
    }

    /* Tarjetas de resultados responsive */
    .results-section {
        width: 100% !important;
        max-width: 100% !important;
    }

    .results-card {
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 20px !important;
    }

    /* Controles de formulario */
    input[type="number"],
    input[type="text"],
    select {
        width: 100% !important;
        box-sizing: border-box !important;
        min-width: 0 !important;
    }

    /* Botón de simulación */
    button[type="submit"] {
        margin-top: 25px !important;
        margin-bottom: 25px !important;
    }

    /* Evitar páginas huérfanas y viudas */
    p,
    li {
        orphans: 3 !important;
        widows: 3 !important;
    }

    /* Clase genérica no-page-break */
    .no-page-break {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    /* Forzar nueva página (opcional) */
    .section-break {
        page-break-before: always !important;
        break-before: always !important;
    }

    /* Contenedores específicos - mantener juntos */
    .chemical-section,
    .source-section,
    .weather-section,
    .hazard-section,
    .phase-description {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    /* Imágenes */
    img {
        max-width: 100% !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    /* Tank visualization */
    .tank-visualization,
    .tank-diagram {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        margin: 1rem 0 !important;
    }

    /* Título HORIZONTAL TANK con imagen */
    .tank-type-header,
    #tank-type-display {
        page-break-after: avoid !important;
        break-after: avoid !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    #tank-diagram-placeholder {
        page-break-before: avoid !important;
        break-before: avoid !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .input-card:has(#tank-diagram-placeholder) {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    /* Phase cards */
    .phase-card,
    .phase-info {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        margin-bottom: 0.5rem !important;
    }

    /* Widget containers */
    .widget-container {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    /* ===== ESTILOS DE EMERGENCIA FINAL ===== */
    body.printing {
        background: white !important;
        color: black !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* ===== CONTENEDORES DE GRÁFICOS VISIBLES ===== */
    #dynamic-plot,
    #plume-plot-top,
    #plume-plot-side,
    .js-plotly-plot,
    /* Plotly graphs in print */
    .js-plotly-plot,
    .plotly,
    #plume-plot-top .js-plotly-plot,
    #plume-plot-side .js-plotly-plot {
        min-height: 500px !important;
        height: auto !important;
        max-height: none !important;
        width: 100% !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    /* Specific Plotly containers */
    .plot-container,
    #plume-plot-top,
    #plume-plot-side {
        height: auto !important;
        min-height: 500px !important;
        max-height: none !important;
    }

    /* ===== IMÁGENES DENTRO DE LOS GRÁFICOS ===== */
    .js-plotly-plot img[data-plot-guaranteed] {
        display: block !important;
        visibility: visible !important;
        width: 100% !important;
        height: auto !important;
        max-height: 400px !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        z-index: 1000 !important;
        background: white !important;
        page-break-inside: avoid !important;
    }

    /* ===== OCULTAR CANVAS PERO MANTENER CONTENEDOR ===== */
    .js-plotly-plot canvas {
        display: none !important;
    }

    /* ===== TÍTULOS PEGADOS A GRÁFICOS ===== */
    .results-card h2 {
        page-break-after: avoid !important;
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }

    .results-card h2+.js-plotly-plot,
    .results-card h2+div {
        margin-top: 5px !important;
        padding-top: 0 !important;
    }

    /* ===== ELIMINAR PÁGINAS EN BLANCO ===== */
    .section-header:empty,
    div:empty:not([class]):not([id]) {
        display: none !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* ===== FORZAR NUEVAS PÁGINAS PARA SECCIONES ===== */
    #results-summary {
        page-break-after: avoid !important;
    }

    #dynamic-plot {
        page-break-before: avoid !important;
    }

    #plume-plot-top {
        page-break-before: always !important;
    }

    #plume-plot-side {
        page-break-before: avoid !important;
    }

    /* Ocultar sliders */
    input[type="range"],
    .slider-control,
    .range-input {
        display: none !important;
    }

    /* ===== FIX CRÍTICO: ELIMINAR BOTONES DE CARGA (cajas vacías) ===== */

    /* Método 1: Ocultar por ID/clase directa */
    #thermo-content-placeholder,
    #encyclopedia-content-placeholder,
    #user-tips-content-placeholder,
    .encyclopedia-loading-button,
    .education-loading-button,
    .encyclopedia-placeholder,
    .education-placeholder,
    [class*="loading-button"],
    [class*="loading-placeholder"] {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Método 2: Ocultar párrafos con texto de carga */
    #thermo-content-placeholder p,
    #encyclopedia-content-placeholder p,
    #user-tips-content-placeholder p,
    p[data-i18n*="loading"],
    p[data-i18n*="Loading"] {
        display: none !important;
    }

    /* Método 3: Ocultar contenedores vacíos o con solo loading */
    .thermodynamic-widget .widget-content:empty,
    .encyclopedia-widget .widget-content:empty,
    .user-tips-widget .widget-content:empty {
        display: none !important;
    }

    /* Método 4: Ocultar mensajes específicos de carga */
    .thermodynamic-widget .widget-content p:only-child:not(:has(*)),
    .encyclopedia-widget .widget-content p:only-child:not(:has(*)),
    .user-tips-widget .widget-content p:only-child:not(:has(*)) {
        display: none !important;
    }

    /* ===== FIX CRÍTICO: ELIMINAR "Visor de Mapa Satelital 3D" ===== */

    /* Ocultar sección completa del visor */
    .results-card:has(h2[data-i18n="ui.satellite3DMapViewer"]),
    .row-container:has(.results-card:has(h2[data-i18n="ui.satellite3DMapViewer"])),
    .results-card:has(#open-3d-viewer),
    .row-container:has(#open-3d-viewer),
    #open-3d-viewer,
    [id*="satellite-viewer"],
    [class*="satellite-viewer"],
    [data-i18n="ui.satellite3DMapViewer"] {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
    }

    /* ===== FIX CRÍTICO: ELIMINAR PÁGINAS EN BLANCO (8 y otras) ===== */

    /* Método 1: Ocultar elementos vacíos */
    .section-header.output-section:empty,
    .section-header.print-section-header:empty,
    .row-container:empty,
    .results-card:empty,
    div:empty,
    section:empty {
        display: none !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Método 2: Eliminar page-breaks innecesarios */
    .section-header.output-section {
        page-break-after: avoid !important;
        break-after: avoid !important;
        page-break-before: avoid !important;
        break-before: avoid !important;
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
        display: none !important;
        /* Ocultar completamente headers de sección */
    }

    /* Ocultar section-header con clase print-section-header si está vacío */
    .section-header.print-section-header:empty {
        display: none !important;
        height: 0 !important;
    }

    /* Método 3: Eliminar saltos después de OBSTÁCULOS Y MEZCLA */
    .input-card:has(h3[data-i18n="ui.obstaclesMixingTitle"]),
    .input-card:has([class*="obstacle"]),
    .input-card:has([class*="mixing"]),
    #obstacles-section,
    #mixing-section,
    [id*="obstacle"],
    [id*="mixing"] {
        page-break-after: avoid !important;
        break-after: avoid !important;
        margin-bottom: 1rem !important;
        /* Reducir margen */
    }

    /* Método 4: Forzar continuidad entre input-cards */
    .input-card+.input-card {
        page-break-before: avoid !important;
        break-before: avoid !important;
        margin-top: 1rem !important;
        /* Reducir margen */
    }

    /* Método 5: Resetear márgenes de Bootstrap que causan espacios */
    .mb-4,
    .mb-5,
    .my-4,
    .my-5 {
        margin-bottom: 1rem !important;
    }

    .mt-4,
    .mt-5,
    .my-4,
    .my-5 {
        margin-top: 1rem !important;
    }

    /* Método 6: Eliminar espacios grandes entre secciones */
    .results-section,
    .output-section,
    .simulation-section {
        margin-top: 1rem !important;
        margin-bottom: 1rem !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }

    /* Asegurar vistas de pluma con fondo blanco */
    #plume-plot-top,
    #plume-plot-side {
        background-color: white;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        padding: 10px;
        box-sizing: border-box;
    }

    /* Títulos/ayudas */
    .hint {
        display: block;
        color: #a6b0c3;
        font-size: .85rem;
        line-height: 1.35;
        margin-top: 6px;
    }

    .inline {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
    }

    .inline small {
        opacity: .8;
    }

    .inline strong {
        font-variant-numeric: tabular-nums;
    }

    /* Sliders */
    #obstacle_drag_factor,
    #mixing_loss_factor {
        width: 100%;
        appearance: none;
        height: 6px;
        border-radius: 999px;
        background: linear-gradient(90deg, #ff6b6b, #f6c251, #2ecc71);
        outline: none;
        margin: 8px 0 6px;
        border: 1px solid rgba(255, 255, 255, .08);
    }

    #obstacle_drag_factor::-webkit-slider-thumb,
    #mixing_loss_factor::-webkit-slider-thumb {
        appearance: none;
        width: 18px;
        height: 18px;
        border-radius: 50%;
        background: #fff;
        border: 2px solid rgba(0, 0, 0, .2);
        box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
        cursor: pointer;
        transition: transform .08s;
    }

    #obstacle_drag_factor:active::-webkit-slider-thumb,
    #mixing_loss_factor:active::-webkit-slider-thumb {
        transform: scale(1.06);
    }

    #obstacle_drag_factor::-moz-range-thumb,
    #mixing_loss_factor::-moz-range-thumb {
        width: 18px;
        height: 18px;
        border-radius: 50%;
        background: #fff;
        border: 2px solid rgba(0, 0, 0, .2);
        box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
        cursor: pointer;
    }

    #obstacle_drag_factor::-moz-range-track,
    #mixing_loss_factor::-moz-range-track {
        height: 6px;
        border-radius: 999px;
        background: linear-gradient(90deg, #ff6b6b, #f6c251, #2ecc71);
        border: 1px solid rgba(255, 255, 255, .08);
    }

    #obstacle_drag_factor:focus,
    #mixing_loss_factor:focus {
        outline: none;
        box-shadow: 0 0 0 3px rgba(124, 196, 255, .25);
    }

    /* Tooltips - ocultar en print */
    .tooltip-bubble,
    .has-tooltip,
    .help-icon {
        display: none !important;
    }
}

/* --- 6. ARREGLOS ESPECÍFICOS --- */

/* Corregir el posicionamiento del botón original si estaba mal */
.original-button-position {
    /* Eliminar estilos que puedan estar causando problemas */
    position: relative !important;
    top: auto !important;
    right: auto !important;
    left: auto !important;
    bottom: auto !important;
}

/* Asegurar que las vistas de pluma tengan fondo blanco */
#plume-plot-top,
#plume-plot-side {
    background-color: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
    box-sizing: border-box;
}

/* ===== Obstáculos & Mezcla — bloque seguro para append ===== */

/* Títulos/ayudas nuevas */
.hint {
    display: block;
    color: #a6b0c3;
    font-size: .85rem;
    line-height: 1.35;
    margin-top: 6px;
}

.inline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.inline small {
    opacity: .8;
}

.inline strong {
    font-variant-numeric: tabular-nums;
}

/* Sliders nuevos (solo los IDs que agregaste) */
#obstacle_drag_factor,
#mixing_loss_factor {
    width: 100%;
    appearance: none;
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, #ff6b6b, #f6c251, #2ecc71);
    /* rojo→amarillo→verde */
    outline: none;
    margin: 8px 0 6px;
    border: 1px solid rgba(255, 255, 255, .08);
    /* borde suave; ajusta a tu tema */
}

/* Pulgar del slider (WebKit) */
#obstacle_drag_factor::-webkit-slider-thumb,
#mixing_loss_factor::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid rgba(0, 0, 0, .2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
    cursor: pointer;
    transition: transform .08s;
}

#obstacle_drag_factor:active::-webkit-slider-thumb,
#mixing_loss_factor:active::-webkit-slider-thumb {
    transform: scale(1.06);
}

/* Pulgar del slider (Firefox) */
#obstacle_drag_factor::-moz-range-thumb,
#mixing_loss_factor::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid rgba(0, 0, 0, .2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
    cursor: pointer;
}

/* Track (Firefox) */
#obstacle_drag_factor::-moz-range-track,
#mixing_loss_factor::-moz-range-track {
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, #ff6b6b, #f6c251, #2ecc71);
    border: 1px solid rgba(255, 255, 255, .08);
}

/* Accesibilidad: foco claro en sliders */
#obstacle_drag_factor:focus,
#mixing_loss_factor:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(124, 196, 255, .25);
    /* halo de foco suave */
}

/* Altura para gráficos nuevos si no la tienes ya */
#plume-plot-top,
#plume-plot-side {
    height: 360px;
    /* Plotly */
}

/* === Tooltips === */
.tooltip-bubble {
    position: fixed;
    max-width: 280px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(33, 33, 33, 0.95);
    color: #fff;
    font-size: 12px;
    line-height: 1.35;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    z-index: 9999;
    pointer-events: none;
    transform: translateY(-6px);
    opacity: 0;
    transition: opacity .12s ease, transform .12s ease;
}

.tooltip-bubble.show {
    opacity: 1;
    transform: translateY(0);
}

.tooltip-bubble .arrow {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(33, 33, 33, 0.95);
    bottom: -6px;
    left: 16px;
}

.has-tooltip {
    position: relative;
}

.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 6px;
    border-radius: 50%;
    background: #e3f2fd;
    color: #1565c0;
    font-size: 12px;
    font-weight: 700;
    cursor: help;
    user-select: none;
}

.help-icon:focus {
    outline: 2px solid #90caf9;
}

body.has-lang-selector {
    padding-top: 56px;
}

@media (max-width: 768px) {
    body.has-lang-selector {
        padding-top: 72px;
    }
}

/* ===== BOTÓN DE CONFIRMACIÓN DE UBICACIÓN ===== */
#confirm-location-btn {
    display: block !important;
    /* Forzar visibilidad */
    opacity: 1 !important;
    /* Asegurar opacidad completa */
    visibility: visible !important;
    /* Asegurar visibilidad */
    background: var(--color-primary);
    color: var(--color-white);
    border: none;
    padding: 12px 24px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    margin-top: 12px;
    margin-bottom: 12px;
    transition: var(--transition);
    width: auto;
    min-width: 200px;
    text-align: center;
}

#confirm-location-btn:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.4);
}

#confirm-location-btn:disabled {
    background: var(--color-secondary);
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
}

/* ===== CONTENEDOR DEL MAPA DE UBICACIÓN ===== */
.location-map {
    width: 100%;
    height: 300px;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    /* Forzar que se muestre */
    display: block !important;
    visibility: visible !important;
}

/* Asegurar que el contenedor del mapa esté visible cuando está activo */
.location-input-group.active .location-map {
    display: block !important;
    height: 300px;
    min-height: 300px;
}

/* Fix para el contenedor del método map */
#map-input.active {
    display: block !important;
}

/* Status row debajo del mapa */
.map-status-row {
    margin-top: 8px;
    font-family: monospace;
    font-size: 14px;
    color: #666;
    text-align: center;
    background: var(--color-light);
    padding: 8px;
    border-radius: 4px;
}

/* Selected location box */
.selected-location-box {
    margin-top: 16px;
    background: #e3f2fd;
    padding: 12px;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--color-primary);
}

.selected-location-box strong {
    display: block;
    margin-bottom: 8px;
    color: var(--color-primary-dark);
}

.selected-location-box div {
    margin-bottom: 4px;
    font-size: 14px;
}

/* Enhanced Results Styles */
.enhanced-results {
    margin: 0;
    padding: 0;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.result-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #e2e8f0;
    font-size: 14px;
}

.result-item:last-child {
    border-bottom: none;
}

.result-label {
    color: #475569;
    font-weight: 500;
}

.result-value {
    color: #1e293b;
    font-weight: 600;
    text-align: right;
}

.subsection-title {
    color: #1e293b;
    font-size: 16px;
    font-weight: 600;
    margin: 20px 0 12px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.model-flow {
    background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 50%, #ef4444 100%);
    height: 4px;
    border-radius: 2px;
    margin: 12px 0;
    position: relative;
}

.flow-marker {
    position: absolute;
    top: -8px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    border: 2px solid;
    font-size: 9px;
    font-weight: bold;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.marker-source {
    left: 5%;
    border-color: #3b82f6;
    background: #3b82f6;
}

.marker-near {
    left: 40%;
    border-color: #8b5cf6;
    background: #8b5cf6;
}

.marker-far {
    left: 75%;
    border-color: #ef4444;
    background: #ef4444;
}

.confidence-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    /* Colores por defecto - se sobrescriben con clases específicas */
    background: #dcfce7;
    color: #166534;
}

/* Confidence level specific styling */
.confidence-very-high {
    background-color: #d4edda !important;
    color: #155724 !important;
    border: 1px solid #c3e6cb;
}

.confidence-high {
    background-color: #d1ecf1 !important;
    color: #0c5460 !important;
    border: 1px solid #bee5eb;
}

.confidence-moderate {
    background-color: #fff3cd !important;
    color: #856404 !important;
    border: 1px solid #ffeaa7;
}

.confidence-low {
    background-color: #f8d7da !important;
    color: #721c24 !important;
    border: 1px solid #f5c6cb;
}

.confidence-very-low {
    background-color: #f8d7da !important;
    color: #721c24 !important;
    border: 1px solid #f5c6cb;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }

    100% {
        opacity: 1;
    }
}

.model-info-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #007bff;
    margin: 10px 0;
}

.confidence-details details {
    margin-top: 10px;
}

.confidence-details summary:hover {
    color: #007bff;
}

.model-tag {
    display: inline-block;
    background: #ede9fe;
    color: #5b21b6;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    margin: 1px;
}

.limitation-card {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 12px;
    margin-top: 16px;
}

/* Thermodynamic Analysis Widget Styles */
.thermodynamic-widget {
    margin: 16px 0;
    border: 2px solid #3b82f6;
    border-radius: 12px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.1);
}

.thermodynamic-widget .widget-header {
    background: #3b82f6;
    color: white;
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: background 0.2s;
}

.thermodynamic-widget .widget-header:hover {
    background: #2563eb;
}

.thermodynamic-widget .widget-title {
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.thermodynamic-widget .expand-icon {
    transition: transform 0.3s ease;
    font-size: 16px;
}

.thermodynamic-widget .widget-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    background: white;
}

.thermodynamic-widget .widget-content.expanded {
    max-height: calc(80vh - 100px);
    overflow-y: auto;
    overflow-x: hidden;
}

.thermodynamic-widget .content-inner {
    padding: 20px;
}

.phase-section {
    margin-bottom: 20px;
    border-left: 4px solid;
    padding: 16px;
    background: #f8fafc;
    border-radius: 0 8px 8px 0;
}

.phase-dense {
    border-left-color: #dc2626;
}

.phase-transition {
    border-left-color: #d97706;
}

.phase-passive {
    border-left-color: #059669;
}

.phase-title {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.phase-distance {
    font-size: 12px;
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
    color: #475569;
}

.phase-description {
    font-size: 14px;
    line-height: 1.5;
    color: #334155;
    margin-bottom: 12px;
}

.characteristics-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.characteristics-list li {
    font-size: 13px;
    padding: 4px 0;
    padding-left: 20px;
    position: relative;
    color: #475569;
}

.characteristics-list li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: #3b82f6;
    font-weight: bold;
}

.chemical-properties {
    background: #f1f5f9;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
}

.property-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
    font-size: 13px;
}

.property-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 8px;
    background: white;
    border-radius: 4px;
}

.property-label {
    font-weight: 500;
    color: #475569;
}

.property-value {
    font-weight: 600;
    color: #1e293b;
}

.key-insight {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 12px;
    margin-top: 16px;
}

.insight-title {
    font-weight: 600;
    color: #92400e;
    margin-bottom: 8px;
    font-size: 14px;
}

.insight-text {
    font-size: 13px;
    color: #78350f;
    line-height: 1.4;
}

/* ===== ENCYCLOPEDIA WIDGET STYLES ===== */
.encyclopedia-widget {
    margin: 16px 0;
    border: 2px solid #059669;
    border-radius: 12px;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(5, 150, 105, 0.1);
}

.encyclopedia-widget .widget-header {
    background: #059669;
    color: white;
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: background 0.2s;
}

.encyclopedia-widget .widget-header:hover {
    background: #047857;
}

.encyclopedia-widget .widget-title {
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.encyclopedia-widget .expand-icon {
    transition: transform 0.3s ease;
    font-size: 16px;
}

.encyclopedia-widget .widget-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    background: white;
}

.encyclopedia-widget .widget-content.expanded {
    max-height: 1200px;
}

.encyclopedia-widget .content-inner {
    padding: 20px;
}

/* Source type specific styles */
.source-field {
    display: block;
}

#source-type-selector {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

#source-type-selector input[type="radio"] {
    width: auto;
    margin: 0;
}

#source-type-selector label {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    background: var(--color-light);
    border: 2px solid #e2e8f0;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 0;
    font-weight: 500;
    gap: 8px;
}

#source-type-selector input[type="radio"]:checked+label,
#source-type-selector label:has(input[type="radio"]:checked) {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

/* Tank configuration placeholder */
#tank-configuration-container {
    min-height: 200px;
}

#tank-diagram-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 150px;
    background: var(--color-light);
    border: 2px dashed #e2e8f0;
    border-radius: var(--border-radius);
    color: #64748b;
    font-style: italic;
}

/* Section intro styling */
.section-intro {
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 15px;
    font-style: italic;
    line-height: 1.5;
}

/* Unit labels */
.unit-label {
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 400;
}

/* Inline stats for effective wind */
.inline-stats {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 0.9rem;
    color: #0369a1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .property-grid {
        grid-template-columns: 1fr;
    }

    .thermodynamic-widget .content-inner,
    .encyclopedia-widget .content-inner {
        padding: 12px;
    }

    .phase-section {
        padding: 12px;
    }

    #source-type-selector {
        flex-direction: column;
        gap: 10px;
    }

    #source-type-selector label {
        justify-content: center;
    }
}

/* ===== ENCYCLOPEDIA MODAL STYLES ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 1000px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

.modal-content h2 {
    color: #059669;
    font-size: 1.8rem;
    margin-bottom: 25px;
    border-bottom: 2px solid #059669;
    padding-bottom: 10px;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #666;
    transition: color 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
    border-radius: 50%;
}

/* Encyclopedia Content Styling */
.encyclopedia-content {
    line-height: 1.6;
    color: #333;
}

.phase-section {
    margin-bottom: 30px;
    padding: 20px;
    border-left: 4px solid;
    border-radius: 0 8px 8px 0;
    background: #f8fafc;
}

.phase-section.phase-1 {
    border-left-color: #dc2626;
}

.phase-section.phase-2 {
    border-left-color: #d97706;
}

.phase-section.phase-3 {
    border-left-color: #059669;
}

.phase-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 10px;
}

.phase-subtitle {
    font-size: 1rem;
    color: #64748b;
    font-style: italic;
    margin-bottom: 15px;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #374151;
    margin: 20px 0 10px 0;
}

.encyclopedia-content ul {
    margin: 10px 0 20px 20px;
}

.encyclopedia-content li {
    margin-bottom: 8px;
    position: relative;
    padding-left: 10px;
}

.encyclopedia-content li::before {
    content: "→";
    position: absolute;
    left: -10px;
    color: #059669;
    font-weight: bold;
}

.highlight-box {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
}

.highlight-box .box-title {
    font-weight: 600;
    color: #92400e;
    margin-bottom: 8px;
    font-size: 1rem;
}

.highlight-box .box-content {
    color: #78350f;
    font-size: 0.95rem;
    line-height: 1.5;
}

.key-equation {
    background: #e0f2fe;
    border: 1px solid #0369a1;
    border-radius: 6px;
    padding: 10px 15px;
    margin: 10px 0;
    font-family: monospace;
    font-size: 0.9rem;
    color: #0c4a6e;
}

.intro-text {
    font-size: 1.05rem;
    color: #4b5563;
    background: #f1f5f9;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border-left: 4px solid #3b82f6;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        padding: 20px;
        max-height: 90vh;
    }

    .modal-content h2 {
        font-size: 1.5rem;
    }

    .phase-title {
        font-size: 1.2rem;
    }
}

/* Scrollbar Styling */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #059669;
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: #047857;
}

/* Scrollbar styling for Thermodynamic Analysis Widget */
.thermodynamic-widget .widget-content.expanded::-webkit-scrollbar {
    width: 8px;
}

.thermodynamic-widget .widget-content.expanded::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.thermodynamic-widget .widget-content.expanded::-webkit-scrollbar-thumb {
    background: #3b82f6;
    border-radius: 4px;
}

.thermodynamic-widget .widget-content.expanded::-webkit-scrollbar-thumb:hover {
    background: #2563eb;
}

.user-tips-widget {
    margin: 16px 0;
    border: 2px solid #e74c3c;
    border-radius: 12px;
    background: linear-gradient(135deg, #fdedec 0%, #fadbd8 100%);
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(231, 76, 60, 0.1);
}

.user-tips-widget .widget-header {
    background: #e74c3c;
    color: white;
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: background 0.2s;
}

.user-tips-widget .widget-header:hover {
    background: #c0392b;
}

.user-tips-widget .widget-title {
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-tips-widget .expand-icon {
    transition: transform 0.3s ease;
    font-size: 16px;
}

.user-tips-widget .widget-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    background: white;
}

.user-tips-widget.expanded .content-inner {
    max-height: calc(80vh - 40px);
    overflow-y: auto;
}

.user-tips-widget.expanded .widget-content {
    max-height: 80vh;
}

.user-tips-widget .content-inner {
    padding: 20px;
}

.user-tips-container {
    padding: 15px;
}

.user-tips-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f4f8;
}

.user-tips-header h3 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 1.4em;
}

.user-tips-header p {
    margin: 0;
    color: #666;
    font-style: italic;
}

.user-tips-menu {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
}

.tip-section-card {
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafbfc;
}

.tip-section-card:hover {
    background: #f5f8fa;
    border-color: #c0392b;
    transform: translateY(-2px);
}

.tip-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-weight: 600;
    color: #2c3e50;
}

.tip-icon {
    font-size: 1.2em;
}

.tip-title {
    font-size: 0.95em;
}

.tip-section-preview {
    color: #666;
    font-size: 0.85em;
    line-height: 1.4;
}

.section-detail {
    margin-top: 20px;
}

button.back-button {
    background: #3498db !important;
    color: white !important;
    border: none !important;
    padding: 10px 20px !important;
    border-radius: 5px !important;
    cursor: pointer !important;
    margin-bottom: 20px !important;
    font-size: 0.9em !important;
    transition: background-color 0.3s ease !important;
    display: block !important;
    /* ← AGREGAR ESTA LÍNEA */
}

button.back-button:hover {
    background: #2980b9 !important;
}

.tank-type-header {
    font-size: 1.3em;
    font-weight: bold;
    text-align: center;
    color: #2c3e50;
    margin-bottom: 15px;
    padding: 12px;
    background: linear-gradient(135deg, #ecf0f1 0%, #d5dbdb 100%);
    border-radius: 8px;
    border: 2px solid #bdc3c7;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* El contenedor blanco que crea tu JS alrededor del SVG */
.tank-image-only {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    /* --- NUEVO: Ocupar todo el espacio disponible en su padre --- */
    width: 100%;
    height: 100%;
}

/* --- ESTILOS PARA EL NUEVO CONTENEDOR ADAPTABLE --- */

/* Contenedor Principal */
.tank-configuration-adaptive {
    display: flex;
    flex-direction: column;
    /* Apila el header y el contenido verticalmente */
    border: 1px solid #dee2e6;
    border-radius: 12px;
    background-color: #f8f9fa;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    /* Asegura que los bordes redondeados se apliquen a los hijos */
    margin: 20px auto;
    max-width: 900px;
    /* Ancho máximo del componente */
}

/* Wrapper para el contenido principal (las dos columnas) */
.tank-content-wrapper {
    display: flex;
    flex-direction: row;
    /* Coloca las columnas una al lado de la otra */
    flex-wrap: wrap;
    /* Permite que las columnas se apilen en pantallas pequeñas */
}

/* Columna de Texto (40%) */
.tank-text-content {
    flex: 2;
    /* Ocupa 2 de 5 partes (40%) */
    min-width: 280px;
    /* Ancho mínimo antes de que se apile */
    padding: 25px;
    background-color: #ffffff;
    border-right: 1px solid #dee2e6;
}

.tank-text-content h4 {
    margin-top: 0;
    color: #059669;
    /* Un color que combine */
}

.tank-text-content p {
    color: #495057;
    line-height: 1.6;
}

/* El placeholder que contiene el SVG (tu script lo necesita) */
#tank-diagram-placeholder {
    width: 100%;
    height: 100%;
}

/* Asegurar que el contenedor de imagen ocupe todo el espacio */
.tank-image-container {
    flex: 3;
    min-width: 320px;
    display: flex;
    align-items: stretch;
    /* Cambiado de center a stretch */
    justify-content: center;
    padding: 20px;
    min-height: 250px;
}

/* Asegurar que el SVG ocupe todo el espacio disponible */
#professional-tank-svg {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
}

/* Específico para pipeline - ajustar relación de aspecto */
.tank-configuration-adaptive[data-vessel-type="vertical_tank"] .tank-image-container {
    min-height: 300px;
    /* Reducido de 350px */
}

.tank-configuration-adaptive[data-vessel-type="pipeline"] .tank-image-container {
    min-height: 200px;
    /* Ajustado para pipeline */
}

/* === Export Button === */
.export-btn {
    background-color: #007bff;
    /* azul técnico */
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px 18px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    margin-top: 10px;
}

.export-btn:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}

.export-btn:active {
    background-color: #00448f;
    transform: translateY(1px);
}

/* Estilos para el sistema meteorológico híbrido */
.weather-mode-section {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.weather-mode-selector {
    margin-bottom: 15px;
}

.weather-mode-selector label {
    margin-right: 20px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.weather-mode-selector input[type="radio"] {
    margin-right: 5px;
}

.auto-weather-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

#fetch-weather-btn {
    background: #2196F3;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s;
}

#fetch-weather-btn:hover {
    background: #1976D2;
}

#fetch-weather-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.weather-status {
    font-size: 0.9em;
    color: #666;
}

.weather-preview {
    padding: 10px;
    background: white;
    border-radius: 6px;
    border: 1px solid #ddd;
    font-size: 0.85em;
    line-height: 1.4;
}

.weather-info {
    color: #333;
}


/* =========================================================================
   FIXES FINALES REPORTE PDF
   ========================================================================= */
@media print {

    /* FIX 2 & 4: Evitar cortes en secciones críticas (Climate, Hazard Zones) */
    .input-card,
    .results-card {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        display: block !important;
        /* Asegurar bloque para que el break funcione */
        margin-bottom: 20px !important;
    }

    /* Forzar que CADA tarjeta importante empiece limpia si no cabe */
    /* Selectores específicos si es necesario */
    #regulatory-region-container,
    #unit-switcher,
    div:has(> h3 > span[data-i18n="ui.climate"]),
    #hazard-zones-container {
        page-break-inside: avoid !important;
    }

    /* FIX DEFINITIVO 2: Mover CLIMATE a la siguiente página (Page 3) */
    #climate-card {
        page-break-before: always !important;
        page-break-inside: avoid !important;
        margin-top: 20px !important;
    }

    /* FIX 3: Estanque Horizontal - Protección Adicional */
    #tank-diagram-placeholder,
    .tank-configuration-adaptive,
    .tank-image-container,
    .tank-content-wrapper {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    img[data-tank-backup] {
        display: block !important;
        max-width: 100% !important;
        height: auto !important;
        page-break-inside: avoid !important;
        page-break-before: auto !important;
        /* Dejar que fluya, pero evitar cortes */
    }

    /* FIX 4: Hazard Zones específico */
    /* Agrupar título y contenido */
    #hazard-zones-container h2,
    #hazard-zones-container .section-intro,
    #hazard-summary {
        page-break-after: avoid !important;
    }
}

/* --- LOGO --- */
.logo-container {
    text-align: center;
    margin-top: 20px;
    margin-bottom: 10px;
}

.app-logo {
    max-height: 120px;
    height: auto;
    width: auto;
    display: inline-block;
    border-radius: var(--border-radius);
    /* Optional: rounded corners */
}

/* --- APP HEADER --- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 30px;
    background-color: #f8f9fa;
    /* Match existing background if needed */
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 20px;
    position: relative;
    /* Essential for absolute positioning of title */
}

.header-left {
    flex: 0 0 auto;
}

.logo-container {
    margin: 0;
    /* Override previous margin */
    text-align: left;
    /* Override previous center */
}

.app-logo {
    max-height: 150px;
    /* Doubled from previous visual ~75px or set large */
    width: auto;
}

.header-center {
    flex: 1;
    text-align: center;
}

.header-center h1 {
    margin: 0;
    font-size: 3.5rem;
    /* Large size */
    font-weight: 800;
    /* Extra bold */
    color: #2c3e50;
    /* Base color */
    line-height: 1.2;
    transform: translateY(-10px);
    /* Move up slightly as requested */
}

.highlight-x {
    color: #0d5f75;
    /* Teal/Blue from Logo - approx */
}

.header-right {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.header-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.header-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Language selector container styling */
#language-selector-container {
    margin-bottom: 5px;
}

/* --- APP HEADER CORRECTIONS --- */
.header-center {
    flex: 2;
    /* Allocate more space, but allow shrinking */
    text-align: center;
    overflow: hidden;
    /* Prevent spillover */
}

/* Ensure side columns don't get squashed */
.header-left,
.header-right {
    flex: 1;
    min-width: 250px;
    /* Ensure enough space for controls/logo */
}

.header-right {
    align-items: flex-end;
    /* Align to right */
}

/* BUTTON STACKING */
.header-buttons {
    display: flex;
    flex-direction: column;
    /* VERTICAL STACK */
    gap: 5px;
    align-items: flex-end;
    width: 100%;
    /* Take full width of parent */
}

.header-buttons .btn {
    width: 180px;
    /* Fixed width for both buttons for alignment */
    margin: 0;
    /* Clear margins */
}

/* LOGO UPDATES */
.app-logo {
    max-height: 200px;
    /* Increased from 150px */
    width: auto;
    filter: brightness(1.2) contrast(1.1);
    /* Slight brighten if image is dark */
}

/* TITLE UPDATES */
.header-center h1 {
    white-space: nowrap;
    /* Prevent wrap */
    transform: translateY(0);
    /* Reset transform just in case */
}

.highlight-x {
    color: #4db6ac;
    /* Lighter Teal to match a potential logo highlight, lighter than #00acc1 */
    /* If the logo X is gold/metallic, maybe #c0ca33 or #ffb74d? 
       User said "same color". Let's try a distinct Teal/Cyan that matches "THOR" vibe usually. 
       Let's go with a vibrant Cyan/Teal mix: #00bcd4 or the previous #0d5f75 was too dark? 
       Let's try #008da9 - standard 'Science' teal. */
    color: #558b99;
    /* Checking logo image... might be a slate blue/grey? */
    /* Let's pick a safe 'Logo' color based on Mjolnir handle/text often being gold or blueish.
     * User said X in the logo. Assuming the logo text is greenish-grey. */
    color: #78909c;
    /* Blue Grey? Let's try #26a69a (Teal) */
    color: #3b6e82;
    /* A guessed 'slate teal' */
}

/* Re-overriding with specific requested color attempt */
.highlight-x {
    color: #546e7a;
    /* Blue Grey 600 - often used in industrial logos */
}

/* Force language selector alignment */
#language-selector {
    margin-bottom: 5px;
    width: 180px;
    /* Match button width */
}

/* --- FINAL HEADER LAYOUT FIXES --- */

/* 1. Prevent Title Overlap */
.header-center {
    /* Absolute Centering */
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);

    text-align: center;
    white-space: nowrap;
    z-index: 1;
    /* Low z-index */
    pointer-events: none;
    /* Let clicks pass through if it overlaps loosely */
}

/* 2. Ensure controls have space */
/* 2. Ensure controls have space and sit ON TOP */
.header-right {
    flex: 0 0 auto;
    /* Do not shrink */
    min-width: 280px;
    /* Fixed minimum width for buttons */
    position: relative;
    z-index: 1000;
    /* High z-index to overlay title if needed */
}

/* 3. Improve Button Visibility & Stacking */
.header-buttons {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    /* Align to right edge */
    justify-content: center;
    gap: 8px;
    /* Slightly more gap */
    width: 100%;
}

.header-buttons .btn {
    width: 200px !important;
    /* Force matching width */
    margin: 0 !important;
}

/* 4. Logo Visibility & Size */
.app-logo {
    max-height: 500px;
    /* Doubled from 250px as requested */
    width: auto;
    /* increased brightness and contrast to make text pop against background */
    filter: brightness(1.4) contrast(1.2) saturate(1.1);
    /* Reverting blend mode, sticking to filters */
    border-radius: 4px;
    /* Slight polish */
}

/* Update X color to match metallic logo X */
.highlight-x {
    /* Metallic Cyan/Teal shade based on logo perception */
    color: #4DD0E1;
    text-shadow: 0 0 2px rgba(0, 255, 255, 0.4);
    /* Slight glow for metallic effect */
}

/* 5. Language Selector Visibility */
#language-selector-container {
    margin-bottom: 10px;
    position: relative;
    z-index: 1001;
    /* Ensure on top of everything */
    width: 200px;
    text-align: right;
}

#language-selector {
    width: 100%;
}