/* --- Cabecera y Navegación --- */
.tab-header {
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.tab-header nav {
    display: flex;
}

.tab-button {
    background-color: transparent;
    border: 1px solid transparent;
    color: var(--primary-color);
    padding: 10px 15px;
    margin: 0 2px -1px 0;
    border-radius: 5px 5px 0 0;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 1rem;
    font-weight: 500;
}

.tab-button:hover {
    background-color: var(--light-gray);
}

.tab-button.active {
    background-color: var(--white);
    color: var(--text-color);
    border-color: var(--border-color) var(--border-color) transparent;
    border-bottom: 1px solid var(--white); 
    cursor: default;
}

/* --- Caja de Información (Story Box) --- */
.story-box {
  background: #eef3f7;
  padding: 15px;
  border-radius: 8px;
  font-size: 0.85em;
  border-left: 5px solid var(--secondary-color);
  margin-top: 10px;
  margin-bottom: 15px;
  flex-shrink: 0; /* Para que no se encoja */
}

.story-box h3 {
  color: var(--primary-color);
  font-size: 1em;
  margin-top: 0;
  margin-bottom: 8px;
  font-weight: 700;
}

.story-box p {
  line-height: 1.5;
  margin-bottom: 8px;
}

.story-box .section-title {
  font-weight: 700;
  color: #004085;
  margin-top: 1rem;
  font-size: 0.9em;
  margin-bottom: 0.5rem;
}

.story-box ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.story-box li {
  font-size: 0.9em;
  padding: 0.25rem 0;
}

.story-box a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}
.story-box a:hover {
    text-decoration: underline;
}

/* --- Botón 'Acerca de' --- */
.about-button {
    margin-left: auto; /* Empuja el botón a la derecha */
    background-color: transparent;
    border: 1px solid transparent;
    color: var(--primary-color);
    padding: 10px 15px;
    border-radius: 5px 5px 0 0;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 1rem;
    font-weight: 500;
}

.about-button:hover {
    background-color: var(--light-gray);
}

.about-button i {
    margin-right: 8px;
}

/* --- Modal 'Acerca de' --- */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    /* Fondo transparente para no oscurecer el mapa */
    background-color: transparent;
    /* Permite que los clics "atraviesen" el fondo y lleguen al mapa */
    pointer-events: none;
}

/* Anulación para el modal 'Acerca de' para que tenga un fondo oscuro */
#about-modal {
    background-color: rgba(0,0,0,0.4);
    pointer-events: auto; /* Bloquea los clics en los elementos de detrás */
}

.modal-content {
    background-color: #fefefe;
    border: 1px solid #888;
    width: 60%; 
    max-width: 700px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: absolute;
    top: 15%; /* Initial position */
    left: 20%; /* Initial position */

    /* For resizing and layout */
    resize: both;
    overflow: hidden; /* Hide overflow from resize */
    display: flex;
    flex-direction: column;
    min-width: 350px; /* Prevent it from becoming too small */
    min-height: 250px;
    /* Restaura la capacidad de hacer clic en el contenido del modal */
    pointer-events: auto;
}

.modal-header {
    padding: 10px 20px;
    cursor: move;
    background-color: #ffffff;
    color: var(--text-color);
    border-bottom: 1px solid #ddd;
    border-top-left-radius: 7px;
    border-top-right-radius: 7px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; /* Prevent header from shrinking */
}

.modal-title {
    color: var(--text-color);
    margin: 0;
    font-size: 1.1rem;
}

/* Estilo específico para el título del modal 'Acerca de' */
#about-modal .modal-title {
    color: var(--title-orange);
}

.modal-body {
    padding: 20px;
    overflow-y: auto; /* Allow vertical scroll */
    flex-grow: 1; /* Take available space */
}

.modal-body p, .modal-body ul {
    font-size: 0.85rem;
    line-height: 1.6;
    color: #555;
}

.modal-body ul {
    padding-left: 20px;
}

.modal-subtitle {
    color: var(--title-orange);
    font-weight: 700;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.modal-sources {
    font-size: 0.75rem;
    color: #6c757d; /* Un gris un poco más claro */
    font-style: italic;
}

.close-button {
    color: #888;
    font-size: 28px;
    font-weight: bold;
}

.close-button:hover,
.close-button:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
}

/* --- Estilos para Slim Select --- */
.ss-main .ss-single-selected {
    height: 35px;
    padding: 6px 8px;
    border: 1px solid #ced4da;
    border-radius: .25rem;
}

.ss-main .ss-content .ss-list .ss-option {
    padding: 8px 12px;
}

.ss-main .ss-content .ss-list .ss-option.ss-highlighted,
.ss-main .ss-content .ss-list .ss-option:hover {
    background-color: #e9ecef;
    color: #000;
}

/* --- Estilos para Control de Leyenda --- */
.leaflet-control-custom {
    width: 34px;
    height: 34px;
    line-height: 34px;
    text-align: center;
    background-color: white;
    cursor: pointer;
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.65);
}
.leaflet-control-custom:hover {
    background-color: #f4f4f4;
}
.leaflet-control-custom i {
    vertical-align: middle;
    font-size: 1.3rem;
}

/* --- Legend Info Modal --- */
#legend-info-modal .modal-content {
    width: 450px; /* Ancho fijo */
    max-width: 90vw;
    height: auto; /* Altura automática basada en el contenido */
    min-height: 200px; /* Altura mínima */
    max-height: 80vh; /* Altura máxima */
    resize: both; /* Permitir redimensionar en ambas direcciones */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* Centrar por defecto */
    pointer-events: auto; /* El contenido del modal sí debe ser interactivo */
}

#legend-info-modal .modal-header {
    cursor: grab;
}

#legend-info-modal .modal-header:active {
    cursor: grabbing;
}

#legend-info-modal .modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

#legend-info-modal .modal-body .section-title {
    font-weight: bold;
    margin-top: 1rem;
    font-size: 0.9em;
    margin-bottom: 0.5rem;
}

#legend-info-modal .modal-body ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#legend-info-modal .modal-body li {
    font-size: 0.9em;
    padding: 0.2rem 0;
}
.acciones-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.accion-btn {
    background-color: #fff;
    border: 1px solid var(--border-color);
    color: var(--primary-color);
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 0.8em;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.accion-btn:hover {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}