/* Stylesheet principal para el dashboard de ANÁLISIS DE RIESGO */
/* Paleta: Azul con acentos Rojo Coral */

/* Importar fuente Roboto desde Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

:root {
    /* Azul - Paleta Principal */
    --blue-1: #000051;  /* Federal blue - más oscuro */
    --blue-2: #000080;  /* Navy blue */
    --blue-3: #4000C0;  /* Medium blue */
    --blue-4: #6000E0;  /* Chrysler blue */
    --blue-5: #E85A5A;  /* Rojo coral suave */
    
    /* Colores base */
    --primary: #000051;
    --secondary: #000080;
    --accent: #D94848;
    --accent-light: #E85A5A;
    --accent-dark: #C43C3C;
    --accent-bright: #FF6B6B;
    
    /* Colores de estado */
    --success: #00C853;
    --warning: #FFD600;
    --danger: #FF1744;
    --info: #E85A5A;
    
    /* Textos */
    --text-primary: #E8E0FF;
    --text-secondary: #FF8A8A;
    --text-muted: #CC7A7A;
    
    /* Bordes y fondos */
    --border: #D94848;
    --border-subtle: #C43C3C;
    --hover: #1A0066;
    --card-bg: rgba(60, 60, 90, 0.95);
    
    /* Gradientes */
    --gradient-main: #000015;
    --gradient-accent: linear-gradient(135deg, #D94848 0%, #E85A5A 100%);
    --gradient-button: linear-gradient(135deg, #E85A5A 0%, #D94848 100%);
}

/* ==================== ESTILOS GLOBALES ==================== */
* {
    font-family: 'Roboto', 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html, body {
    height: 100%;
    background: #0d0d70 !important;
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
}

/* Forzar mayúsculas en títulos principales y botones */
h1, h2, h3, h4, h5, h6,
.section-title,
.navbar-brand,
.card-title,
.footer-title,
.footer-subtitle {
    text-transform: uppercase !important;
    letter-spacing: 0.6px !important;
}

/* Asegurar que todos los botones estén en mayúscula */
.btn, button, .btn * {
    text-transform: uppercase !important;
}

#react-entry-point {
    height: 100%;
    background: #000015 !important;
}

/* Contenedores principales - FORZAR FONDO OSCURO */
.container, .container-fluid {
    background: transparent !important;
}

.p-4 {
    padding: 1rem !important;
}

._dash-loading, ._dash-loading-callback {
    background: #000015 !important;
}

/* Forzar fondo oscuro en todo */
div[id="react-entry-point"],
div[class*="dash-"],
.row, .col, [class*="col-"] {
    background-color: transparent !important;
}

/* Main wrapper */
#_dash-app-content,
._dash-app-content {
    background: #000015 !important;
}

/* Row backgrounds */
.row {
    background: transparent !important;
}

/* ==================== NAVBAR ==================== */
.navbar {
    background: #2a2a5e !important;
    backdrop-filter: blur(10px);
    border-bottom: 2px solid var(--accent);
    padding: 1rem 2rem !important;
    box-shadow: 0 8px 32px rgba(127, 0, 255, 0.3);
}

.navbar-brand {
    font-weight: 800 !important;
    font-size: 1.4rem !important;
    letter-spacing: -0.5px !important;
    color: var(--text-primary) !important;
    display: flex;
    align-items: center;
    gap: 12px;
}

.navbar-brand img {
    height: 45px;
    filter: drop-shadow(0 2px 8px rgba(127, 0, 255, 0.5));
    transition: transform 0.3s ease;
}

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

/* ==================== CARDS ==================== */
.card {
    background: var(--card-bg) !important;
    border: 1px solid var(--border-subtle) !important;
    border-radius: 16px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
}

.card:hover {
    border-color: var(--accent-light) !important;
    box-shadow: 0 15px 50px rgba(127, 0, 255, 0.25) !important;
    transform: translateY(-2px);
}

.card-body {
    padding: 1.25rem !important;
}

/* Control y Result Panels */
.control-panel,
.result-panel {
    background: var(--card-bg) !important;
    border-radius: 12px !important;
    padding: 1.25rem !important;
    border: 1px solid var(--border-subtle) !important;
    height: 100% !important;
}

/* ==================== FORMULARIOS ==================== */
.form-control, .form-select {
    background: #ffffff !important;
    border: 1px solid #cccccc !important;
    border-radius: 10px !important;
    padding: 10px 14px !important;
    color: #000000 !important;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent-light) !important;
    box-shadow: 0 0 0 4px rgba(127, 0, 255, 0.2) !important;
    background: #ffffff !important;
    color: #000000 !important;
}

.form-control:disabled, .form-select:disabled {
    background: #e0e0e0 !important;
    border-color: #cccccc !important;
    opacity: 0.6;
    cursor: not-allowed !important;
}

.form-control::placeholder {
    color: #888888;
    opacity: 0.7;
}

label {
    color: var(--accent-light);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

label i {
    font-size: 0.85rem;
    opacity: 0.9;
}

/* ==================== BOTONES ==================== */
.btn {
    border-radius: 12px !important;
    padding: 12px 24px !important;
    font-weight: 700 !important;
    font-size: 0.95rem !important;
    letter-spacing: 0.5px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none !important;
    text-transform: uppercase;
}

.btn-success {
    background: var(--gradient-button) !important;
    color: white !important;
    box-shadow: 0 6px 20px rgba(127, 0, 255, 0.4) !important;
}

.btn-success:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--accent-bright) 0%, var(--accent-light) 100%) !important;
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(127, 0, 255, 0.5) !important;
}

.btn-success:disabled {
    background: linear-gradient(135deg, #1a0066 0%, #000051 100%) !important;
    opacity: 0.5;
    cursor: not-allowed !important;
    box-shadow: none !important;
}

.btn-info,
.btn.btn-info,
button.btn-info {
    background: #2e7d32 !important;
    background-color: #2e7d32 !important;
    background-image: none !important;
    color: white !important;
    box-shadow: 0 6px 20px rgba(46, 125, 50, 0.4) !important;
}

.btn-info:hover:not(:disabled),
.btn.btn-info:hover:not(:disabled) {
    background: #388e3c !important;
    background-color: #388e3c !important;
    background-image: none !important;
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(46, 125, 50, 0.5) !important;
}

.btn-info:disabled,
.btn.btn-info:disabled {
    background: #1b5e20 !important;
    background-color: #1b5e20 !important;
    background-image: none !important;
    opacity: 0.5;
    cursor: not-allowed !important;
}

/* Botón de descarga específico */
#download-button,
button#download-button {
    background: #2e7d32 !important;
    background-color: #2e7d32 !important;
    background-image: none !important;
    border: none !important;
}

#download-button:disabled,
button#download-button:disabled {
    background: #1b5e20 !important;
    background-color: #1b5e20 !important;
    background-image: none !important;
}

/* Reglas con alta especificidad para asegurar color verde homogéneo */
body .download-section button#download-button,
.download-section .btn.btn-info#download-button,
button#download-button.btn.btn-info,
#download-button.btn-info {
    background: #2e7d32 !important;
    background-color: #2e7d32 !important;
    background-image: none !important;
    color: #ffffff !important;
    box-shadow: 0 6px 18px rgba(46,125,50,0.28) !important;
}

body .download-section button#download-button:hover,
.download-section .btn.btn-info#download-button:hover,
button#download-button.btn.btn-info:hover,
#download-button.btn-info:hover {
    background: #25662a !important;
    background-color: #25662a !important;
    background-image: none !important;
    transform: translateY(-2px) !important;
}

/* Forzar ausencia de gradiente en estados activos/focus */
button#download-button:active,
button#download-button:focus,
button#download-button[aria-pressed="true"] {
    background-image: none !important;
    background: #255e28 !important;
}

/* Estilos específicos para botón 'NUEVO ANÁLISIS' (reset-button) - Naranja amarillento */
#reset-button,
button#reset-button {
    background: #ffb300 !important;
    background-color: #ffb300 !important;
    background-image: none !important;
    color: #111111 !important;
    box-shadow: 0 6px 18px rgba(255,179,0,0.25) !important;
}

#reset-button:hover,
button#reset-button:hover {
    background: #ff9f00 !important;
    background-color: #ff9f00 !important;
    transform: translateY(-2px) !important;
}

#reset-button:disabled,
button#reset-button:disabled {
    background: #b88300 !important;
    background-color: #b88300 !important;
    opacity: 0.6 !important;
    cursor: not-allowed !important;
}

.btn-danger {
    background: linear-gradient(135deg, #d32f2f 0%, #b71c1c 100%) !important;
    color: white !important;
    border-radius: 10px !important;
    padding: 8px 16px !important;
    font-size: 0.9rem !important;
    box-shadow: 0 6px 20px rgba(211, 47, 47, 0.4) !important;
}

.btn-danger:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 30px rgba(211, 47, 47, 0.5) !important;
}

.btn-warning {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%) !important;
    color: white !important;
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4) !important;
}

.btn-warning:hover:not(:disabled) {
    background: linear-gradient(135deg, #ffb74d 0%, #ff9800 100%) !important;
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(255, 152, 0, 0.5) !important;
}

.btn-warning:disabled {
    background: linear-gradient(135deg, #1a0066 0%, #000051 100%) !important;
    opacity: 0.5;
    cursor: not-allowed !important;
}

.btn-primary {
    background: var(--gradient-accent) !important;
    color: white !important;
    box-shadow: 0 6px 20px rgba(127, 0, 255, 0.4) !important;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent) 100%) !important;
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(127, 0, 255, 0.5) !important;
}

/* ==================== DROPDOWNS ==================== */
.Select-control {
    background: #ffffff !important;
    border: 1px solid #cccccc !important;
    border-radius: 10px !important;
    color: #000000 !important;
}

.Select-control .Select-value-label,
.Select-control .Select-placeholder {
    color: #000000 !important;
}

.Select-input input {
    color: #000000 !important;
}

.Select-menu-outer {
    background: #ffffff !important;
    background-color: #ffffff !important;
    border: 1px solid #7F00FF !important;
    border-radius: 10px !important;
    box-shadow: 0 10px 40px rgba(127, 0, 255, 0.3) !important;
}

.Select-menu,
.Select-menu-outer .Select-menu,
.Select-menu-outer > div,
.Select-menu-outer * {
    background: #ffffff !important;
    background-color: #ffffff !important;
}

.Select-option,
.VirtualizedSelectOption,
.Select-menu .Select-option,
div[class*="option"],
.Select-menu-outer .Select-option,
.Select-option.is-focused,
.VirtualizedSelectFocusedOption {
    background: #ffffff !important;
    background-color: #ffffff !important;
    color: #000000 !important;
    padding: 10px 14px !important;
}

.Select-option:hover, 
.VirtualizedSelectOption:hover {
    background: #e0d4f7 !important;
    background-color: #e0d4f7 !important;
    color: #000000 !important;
}

.Select-option.is-selected {
    background: #7F00FF !important;
    background-color: #7F00FF !important;
    color: #ffffff !important;
}

/* FORZAR FONDO BLANCO EN DROPDOWN - MÁXIMA PRIORIDAD */
.Select.is-open .Select-menu-outer,
.Select.is-open .Select-menu,
.is-open .Select-menu-outer,
.Select.is-open .Select-menu-outer *,
.Select-menu-outer .VirtualizedSelectOption,
.VirtualizedSelectFocusedOption,
.VirtualizedSelectOption {
    background: #ffffff !important;
    background-color: #ffffff !important;
    color: #000000 !important;
}

/* VirtualizedSelect - Forzar estilos */
div.VirtualizedSelectOption,
div.VirtualizedSelectFocusedOption,
[class*="VirtualizedSelect"] {
    background: #ffffff !important;
    background-color: #ffffff !important;
    color: #000000 !important;
}

div.VirtualizedSelectFocusedOption {
    background: #e0d4f7 !important;
    background-color: #e0d4f7 !important;
    color: #000000 !important;
}

/* Dash Dropdown específico - FORZAR FONDO BLANCO en control */
.dash-dropdown .Select-control,
.dash-dropdown .Select,
.Select,
.Select-control,
.Select-multi-value-wrapper,
.Select-value,
.Select--single > .Select-control,
.Select--single > .Select-control .Select-value {
    background: #ffffff !important;
    background-color: #ffffff !important;
}

.dash-dropdown,
.dash-dropdown > div,
div[class*="dash-dropdown"] {
    background: transparent !important;
}

.dash-dropdown input,
.Select-input > input {
    background: transparent !important;
    color: #000000 !important;
}

/* ==================== ALERTS ==================== */
.alert {
    border-radius: 12px !important;
    border: 1px solid var(--border-subtle) !important;
    backdrop-filter: blur(5px);
}

.alert-light {
    background: rgba(0, 0, 81, 0.8) !important;
    border-color: var(--border-subtle) !important;
    color: var(--text-primary) !important;
}

.alert-success {
    background: rgba(0, 200, 83, 0.2) !important;
    border-color: #00C853 !important;
    color: #69F0AE !important;
}

.alert-warning {
    background: rgba(255, 214, 0, 0.2) !important;
    border-color: #FFD600 !important;
    color: #FFEB3B !important;
}

.alert-danger {
    background: rgba(255, 23, 68, 0.2) !important;
    border-color: #FF1744 !important;
    color: #FF5252 !important;
}

.alert-info {
    background: rgba(127, 0, 255, 0.2) !important;
    border-color: #7F00FF !important;
    color: #B794F6 !important;
}

/* ==================== MAP CONTAINER ==================== */
#map-container {
    min-height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 128, 0.3);
    border-radius: 12px;
    border: 1px dashed var(--border-subtle);
    padding: 15px;
}

/* ==================== SELECTION SUMMARY ==================== */
.selection-summary {
    background: rgba(30, 30, 60, 0.8) !important;
    border: 1px solid rgba(232, 90, 90, 0.3) !important;
    border-radius: 12px !important;
    padding: 20px !important;
}

.selection-summary strong {
    color: #E85A5A;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.summary-item i {
    font-size: 1rem;
    color: #E85A5A;
}

/* ==================== LOGIN STYLES ==================== */
.login-title {
    color: #ffffff !important;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: #ffffff !important;
    font-size: 1rem;
    font-weight: 400;
    opacity: 0.9;
}

/* ==================== FOOTER ==================== */
.contact-footer {
    position: relative;
    width: calc(100% - 40px);
    max-width: none;
    margin: 80px 20px 30px 20px;
    background: #2d2d2d;
    padding: 20px 25px;
    border-radius: 16px;
    border: 1px solid rgba(232, 90, 90, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    z-index: 1;
    display: flex;
    flex-direction: row;
    gap: 30px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.contact-footer:hover {
    background: #353535;
    border-color: var(--blue-5);
    box-shadow: 0 6px 30px rgba(127, 0, 255, 0.25);
}

/* Dropdown menus above footer - Dash specific */
.Select-menu-outer,
.VirtualizedSelectFocusedOption,
div[class*="menu"],
.dash-dropdown .Select-menu-outer,
.Select.is-open,
.Select.is-open > .Select-control,
.Select.is-open > .Select-menu-outer {
    z-index: 9999 !important;
}

/* Card with dropdowns needs higher stacking context */
.card, .card-body {
    position: relative;
    z-index: 50;
}

/* Footer Header */
.footer-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.footer-subtitle {
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.footer-title {
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 1px;
}

/* Social Links Container */
.social-links {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap;
    gap: 40px;
    align-items: center;
    justify-content: center;
}

.social-link {
    display: flex !important;
    flex-direction: column !important;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.social-link:hover {
    transform: translateY(-3px);
}

.social-icon {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: #404040;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.social-icon i {
    font-size: 1.3rem;
    color: #ffffff;
}

.social-link:hover .social-icon {
    background: var(--blue-5);
    box-shadow: 0 4px 15px rgba(127, 0, 255, 0.4);
}

.social-label {
    color: #cccccc;
    font-size: 0.75rem;
    font-weight: 500;
}

.contact-footer a {
    color: var(--blue-5) !important;
    text-decoration: none !important;
    transition: color 0.3s ease;
}

.contact-footer a:hover {
    color: #a366ff !important;
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--primary);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-dark);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* ==================== LOADING STATES ==================== */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 81, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 12px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-subtle);
    border-top-color: var(--accent-light);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==================== RESPONSIVE ==================== */
@media (max-width: 992px) {
    .navbar {
        padding: 0.75rem 1rem !important;
    }
    
    .card-body {
        padding: 1.5rem !important;
    }
    
    .btn {
        padding: 10px 18px !important;
        font-size: 0.85rem !important;
    }
}

@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1.1rem !important;
    }
    
    .navbar-brand img {
        height: 35px;
    }
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animated {
    animation: fadeIn 0.5s ease-out;
}

/* ==================== PANEL DE CONTROL ==================== */
.control-panel {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border-subtle);
}

.result-panel {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border-subtle);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: var(--accent-light);
    margin-bottom: 16px;
    font-size: 1.1rem;
}

.section-title i {
    font-size: 1.2rem;
}

/* ==================== FORZAR FONDO OSCURO EN TODO ==================== */
#page-content,
#page-content > div,
.main-container,
.main-container > .row,
.main-container .card-body {
    background: transparent !important;
}

/* Asegurar que el wrapper principal tenga fondo oscuro */
body > div,
body > div > div {
    background: #000051 !important;
}

/* ==================== SELECTOR DE TIPOS DE PELIGRO ==================== */
.tipo-selector {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: 100% !important;
}

.tipo-selector > .btn-tipo,
.tipo-selector > button,
.btn-tipo {
    flex: 0 0 calc(33.33% - 6px) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    padding: 10px 4px !important;
    background: rgba(0, 0, 128, 0.5) !important;
    border: 1px solid var(--border-subtle) !important;
    border-radius: 8px !important;
    color: var(--text-primary) !important;
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.1px !important;
    transition: all 0.3s ease !important;
    min-height: 70px !important;
    max-width: calc(33.33% - 6px) !important;
    text-align: center !important;
    line-height: 1.1 !important;
}

.btn-tipo i,
.tipo-selector > button i {
    font-size: 1.6rem !important;
    color: var(--accent-light) !important;
    display: block !important;
    margin-bottom: 6px !important;
}

.tipo-selector > .btn-tipo:hover:not(:disabled),
.tipo-selector > button:hover:not(:disabled),
.btn-tipo:hover:not(:disabled) {
    background: rgba(127, 0, 255, 0.3) !important;
    border-color: var(--accent-light) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(127, 0, 255, 0.3) !important;
}

.tipo-selector > .btn-tipo:disabled,
.tipo-selector > button:disabled,
.btn-tipo:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

.tipo-selector > .btn-tipo.active,
.tipo-selector > button.active,
.btn-tipo.active,
.btn-tipo-active,
button.btn-tipo-active,
.btn.btn-tipo-active {
    background: #2e7d32 !important;
    background-color: #2e7d32 !important;
    border: 2px solid #4caf50 !important;
    border-color: #4caf50 !important;
    box-shadow: 0 4px 20px rgba(46, 125, 50, 0.5) !important;
    color: #ffffff !important;
}

/* Botones de Elementos Expuestos - más grandes */
#btn-elementos-expuestos,
#btn-mapa-comprension {
    font-size: 1.3rem !important;
    padding: 28px 30px !important;
    min-height: 80px !important;
    max-width: 100% !important;
    flex: 1 1 auto !important;
    width: 100% !important;
}

.badge-soon {
    background: rgba(255, 214, 0, 0.25) !important;
    color: #FFD600 !important;
    padding: 2px 6px !important;
    border-radius: 8px !important;
    font-size: 0.5rem !important;
    font-weight: 700 !important;
    margin-top: 2px !important;
    display: inline-block !important;
}

@media (max-width: 768px) {
    .tipo-selector {
        flex-wrap: wrap !important;
    }
    .tipo-selector > .btn-tipo,
    .tipo-selector > button,
    .btn-tipo {
        max-width: 100% !important;
        flex: 1 1 100% !important;
    }
}