/* ==========================================
   VARIABLES CSS
   ========================================== */
   :root {
    /* Colores principales */
    --primary-color: #3D8361;
    --secondary-color: #EEF2E6;
    --accent-color: #D6CDA4;
    --text-color: #1C3D36;
    --light-text: #4F6F52;
    --border-color: #D6CDA4;
    --white: #FFFFFF;
    --light-bg: #F5F5F5;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    
    /* Efectos modernos */
    --overlay-dark: rgba(0, 0, 0, 0.5);
    --overlay-light: rgba(255, 255, 255, 0.8);
    --glass-effect: rgba(255, 255, 255, 0.15);
    --button-hover: #2a6e4d;
    --button-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* ==========================================
   RESET Y BASE
   ========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: 'Lato', sans-serif;
    color: var(--text-color);
    background-color: var(--light-bg);
    line-height: 1.6;
    /* SCROLL NORMAL - NO RESTRICCIONES */
    height: auto !important;
    overflow: visible !important;
    overflow-x: hidden;
    overflow-y: auto;
    scroll-behavior: smooth;
}

/* ==========================================
   HEADER MODERNO
   ========================================== */
.modern-header {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 2rem 0;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    position: relative;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.logo-container {
    margin-right: 2rem;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
}

.logo-container img {
    max-width: 200px;
    height: auto;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2));
    width: 100%;
    display: block;
    object-fit: contain;
}

.title-container {
    flex: 1;
    min-width: 300px;
}

.title-container h1 {
    font-family: 'Playfair Display', serif;
    font-size: 3.0rem;
    font-weight: 700;
    color: var(--white);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--white);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    max-width: 600px;
    margin: 0 auto;
}

/* Contador de visitas */
.contador-visitas {
    position: absolute;
    font-size: 16px;
    top: 10px;
    right: 10px;
    background-color: rgba(255, 255, 255, 0.2);
    padding: 5px 10px;
    border-radius: 5px;
    color: var(--white);
}

/* ==========================================
   HEADER BÁSICO (FALLBACK)
   ========================================== */
header {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 1rem;
    box-shadow: var(--shadow);
}

h1, h2, h3, h4 {
    font-family: 'Playfair Display', serif;
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.5rem;
    text-align: center;
}

/* ==========================================
   LAYOUT PRINCIPAL
   ========================================== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    /* ASEGURAR QUE NO RESTRINJA EL SCROLL */
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

/* ==========================================
   FORMULARIOS DE BÚSQUEDA
   ========================================== */
.search-container {
    background-color: var(--white);
    padding: 1.5rem;
    margin: 1rem 0;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.search-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.search-tab {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    font-weight: 700;
    color: var(--light-text);
    background: transparent;
    border: none;
    outline: none;
    transition: all 0.3s;
}

.search-tab.active {
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
}

.search-content {
    display: none;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.search-content.active {
    display: block;
}

/* ==========================================
   FORMULARIOS - ESTILOS GENERALES
   ========================================== */
.form-group {
    margin-bottom: 1rem;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
}

.col-md-6 {
    padding: 0 15px;
    flex: 0 0 50%;
    max-width: 50%;
}

.col-md-4 {
    padding: 0 15px;
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 700;
    color: var(--light-text);
}

input[type="text"], select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

input[type="text"]:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(61, 131, 97, 0.25);
}

/* ==========================================
   FORMULARIOS - FLOATING LABELS
   ========================================== */
.floating-label-group {
    position: relative;
    margin-bottom: 20px;
}

.floating-input {
    width: 100%;
    height: 50px;
    padding: 15px 20px 0 20px;
    font-size: 16px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background-color: #fff;
    transition: all 0.2s ease;
}

.floating-input:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.25);
}

.floating-label {
    position: absolute;
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    color: #6c757d;
    font-size: 16px;
    pointer-events: none;
    transition: all 0.2s ease;
}

.floating-input:focus + .floating-label,
.floating-input:not(:placeholder-shown) + .floating-label {
    top: 10px;
    transform: translateY(0);
    font-size: 12px;
    color: #007bff;
}

/* ==========================================
   BOTONES
   ========================================== */
button {
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

button:hover {
    background-color: var(--button-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-lg {
    padding: 10px 30px;
    font-size: 1.1rem;
    border-radius: 30px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.btn-lg:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #545b62;
    border-color: #4e555b;
}

.btn-info {
    background-color: #17a2b8;
    border-color: #17a2b8;
}

.btn-info:hover {
    background-color: #138496;
    border-color: #117a8b;
}

/* ==========================================
   CONTENEDOR DE RESULTADOS
   ========================================== */
.results-container {
    background-color: var(--white);
    padding: 1.5rem;
    margin: 1rem 0;
    border-radius: 8px;
    box-shadow: var(--shadow);
    min-height: 200px;
}

/* ==========================================
   TABS DE ESPECIES
   ========================================== */
.species-tabs {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.species-tab {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    font-weight: 700;
    color: var(--light-text);
    background: transparent;
    border: none;
    outline: none;
    transition: all 0.3s;
}

.species-tab.active {
    background-color: #4CAF50;
    color: white;
    /* color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color); */
}

.species-content {
    display: none;
}

.species-content.active {
    display: block;
}

/* ==========================================
   TABLAS Y RESULTADOS
   ========================================== */
.table-responsive {
    margin-top: 20px;
    overflow-x: auto;
}

.table thead th {
    background-color: #343a40;
    color: white;
}

.scientific-name {
    font-style: italic;
}

.author-name {
    font-style: normal;
}

.filter-section {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.registros-info {
    background-color: #f8f9fa;
    padding: 8px 15px;
    border-radius: 4px;
    font-size: 0.9rem;
}

.contador-registros {
    font-weight: 600;
    color: #28a745;
}

/* Estados para especies */
.estado-aceptado {
    color: green;
    font-weight: 500;
}

.estado-otro {
    color: #777;
}

.fila-aceptado {
    background-color: #f0fff0 !important;
}

.fila-otro {
    background-color: #f9f9f9 !important;
}

/* ==========================================
   PAGINACIÓN
   ========================================== */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
}

.pagination a {
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s;
}

.pagination a:hover, .pagination a.active {
    background-color: var(--primary-color);
    color: var(--white);
}

/* ==========================================
   ALERTAS Y MENSAJES
   ========================================== */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
}

.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

.alert-warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeeba;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

/* ==========================================
   LOADING/CARGA
   ========================================== */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100px;
    padding: 20px;
    text-align: center;
    font-style: italic;
    color: #6c757d;
}

.loading::after {
    content: "";
    width: 40px;
    height: 40px;
    border: 5px solid #ddd;
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================
   BOTONES ESPECIALES
   ========================================== */
#toggleSynonyms {
    transition: all 0.3s ease;
    min-width: 160px;
}

#toggleSynonyms .fas {
    margin-right: 5px;
}

.hidden-row {
    display: none;
}

/* ==========================================
   MAPAS
   ========================================== */
#mapa_distribucion {
    height: 430px;
    width: 100%;
    border: 1px solid #ddd;
    margin-top: 2px;
}

#mapa_loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.8);
    padding: 10px;
    border-radius: 5px;
    display: none;
}

#mapa_container {
    position: relative;
    height: 500px;
    margin-bottom: 5px;
}

/* ==========================================
   SCROLL SUAVE
   ========================================== */
.searchResults {
    scroll-margin-top: 100px;
}

/* ==========================================
   FOOTER
   ========================================== */
footer {
    text-align: center;
    margin-top: 2rem;
    padding: 1rem;
    background-color: var(--secondary-color);
    color: var(--text-color);
}

.modern-footer {
    padding: 2rem 0;
    margin-top: 3rem;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    text-align: center;
    color: var(--white);
}

.plantnet-attribution {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.8;
}

.plantnet-logo {
    width: 150px;
    height: auto;
}

.plantnet-attribution a {
    color: var(--accent-color);
    text-decoration: none;
}

.plantnet-attribution a:hover {
    text-decoration: underline;
}

/* ==========================================
   BOTONES DE ACCIÓN MODERNOS
   ========================================== */
.button-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
}

.action-button {
    width: 100%;
    max-width: 500px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.action-button:hover {
    transform: translateY(-5px);
}

.btn-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    background-color: var(--glass-effect);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    color: var(--white);
    text-decoration: none;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.btn-action:hover {
    background-color: var(--primary-color);
    box-shadow: var(--button-shadow);
    color: var(--white);
    text-decoration: none;
}

.btn-action i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.btn-action span {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.btn-action .subtitle {
    font-size: 1rem;
    opacity: 0.8;
}

.contador {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    background-color: var(--glass-effect);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    color: var(--white);
    text-decoration: none;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */
@media (max-width: 768px) {
    .title-container h1 {
        font-size: 2.5rem;
    }
    
    .logo-container {
        margin-right: 0;
        margin-bottom: 1.5rem;
    }
    
    .header-content {
        flex-direction: column;
    }
    
    .search-tabs, .species-tabs {
        overflow-x: auto;
        white-space: nowrap;
        flex-wrap: nowrap;
    }
    
    .search-tab, .species-tab {
        padding: 0.75rem 1rem;
    }
    
    .col-md-6, .col-md-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .btn-action {
        padding: 1.5rem;
    }
    
    .btn-action i {
        font-size: 2rem;
    }
    
    .btn-action span {
        font-size: 1.2rem;
    }
    
    .image-gallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    table {
        display: block;
        overflow-x: auto;
    }
}

@media (max-width: 480px) {
    .title-container h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .search-tab, .species-tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    .species-name {
        font-size: 1.5rem;
    }
    
    .btn-action {
        padding: 1.2rem;
    }
    
    .btn-action i {
        font-size: 1.5rem;
    }
    
    .btn-action span {
        font-size: 1.1rem;
    }
    
    .container {
        padding: 0.5rem;
    }
    
    .search-container {
        padding: 1rem;
    }
}
/* =============================================== */
/* ESTILOS PARA DISTRIBUCIÓN CONDICIONAL */
/* =============================================== */

/* Contenedor principal de distribución */
#seccion-distribucion.species-content {
    /* display: flex; */
    flex-direction: column;
    height: 100%;
    min-height: 300px; /* Altura mínima para el mensaje */
}

/* Contenedor cuando hay datos */
#seccion-distribucion .contenedor-con-datos {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 500px;
}

/* Mensaje cuando no hay datos */
#seccion-distribucion .alert {
    margin-top: 20px;
    padding: 20px;
    text-align: center;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Estilos para el mapa_container */
#mapa_container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 400px;
    position: relative;
}

.species-Distrib {
    overflow-y: auto;
    max-height: 50vh;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

#mapa_distribucion_container {
    flex: 1;
    min-height: 350px;
    position: relative;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background-color: #f5f5f5;
}

#mapa_distribucion {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Diseño para pantallas grandes */
@media (min-width: 992px) {
    #mapa_container {
        flex-direction: row;
    }
    
    .species-Distrib {
        max-height: none;
        max-width: 40%;
        margin-right: 20px;
        margin-bottom: 0;
    }
    
    #mapa_distribucion_container {
        flex: 1;
        min-height: 400px;
    }
}
.species-habitat {
    color: #27ae60;
    font-style: italic;
}
.species-elevacion {
    color: #7f8c8d;
}

/* =============================================== */
/* ESTILOS PARA GRADO DE CONSERVACIÓN RESPONSIVO */
/* =============================================== */

.species-conservation {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border: 1px solid #e0e0e0;
}

.conservation-header {
    margin-bottom: 15px;
    font-size: 1.0rem;
    text-align: left;
}

.conservation-header strong {
    color: var(--primary-color);
}

.conservation-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    background-color: white;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.conservation-image {
    max-width: 100%;
    height: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
}

/* Efecto hover para pantallas grandes */
@media (hover: hover) {
    .conservation-image:hover {
        transform: scale(1.15);
    }
}

/* Ajustes para pantallas pequeñas */
@media (max-width: 768px) {
    .conservation-header {
        font-size: 1rem;
        text-align: left;
    }
    
    .conservation-image-container {
        padding: 5px;
    }
}

/* Ajustes para pantallas muy pequeñas */
@media (max-width: 480px) {
    .species-conservation {
        padding: 10px;
    }
    
    .conservation-header {
        font-size: 0.9rem;
    }
}
/* =============================================== */
/* ESTILOS PARA GRADOS DE CONSERVACIÓN CRÍTICOS */
/* =============================================== */

.conservation-critical {
    color: #d9534f; /* Rojo Bootstrap para peligro */
    font-weight: 700;
    font-family: 'Arial Black', 'Arial Bold', Gadget, sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.conservation-header .conservation-critical {
    font-size: 1.1em;
    padding: 2px 5px;
    border-radius: 3px;
}

/* Para pantallas pequeñas */
@media (max-width: 768px) {
    .conservation-header .conservation-critical {
        font-size: 1em;
    }
}
/* 
/* =============================================== */
/* ESTILOS MEJORADOS PARA BOTÓN COPIAR ENLACE */
/* =============================================== */

.copy-taxon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;  /* Aumentado de 24px */
    height: 52px; /* Aumentado de 24px */
    cursor: pointer;
    color: var(--primary-color);
    background: none;
    border: none;
    padding: 0;
    transition: all 0.3s ease;
    position: absolute; /* Cambiado a posición absoluta */
    top: 0;            /* Alineado arriba */
    right: 0;          /* Alineado a la derecha */
    margin: 5px 10px;  /* Margen para separación */
}

/* Contenedor relativo para posicionar el botón */
.species-header {
    position: relative; /* Necesario para el posicionamiento absoluto del botón */
    padding-right: 40px; /* Espacio para el botón */
}

.copy-taxon-link i {
    font-size: 1.5rem; /* Aumentado de 1.2rem */
}

/* Tooltip ajustado para nueva posición */
.copy-taxon-link .tooltip {
    visibility: hidden;
    width: 180px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: auto;   /* Reset */
    top: 100%;      /* Aparece debajo del ícono */
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.8rem;
    font-weight: normal;
}

/* Efecto hover más pronunciado */
.copy-taxon-link:hover {
    color: #2a6e4d;
    transform: scale(1.15);
}

/* Ajustes para pantallas pequeñas */
@media (max-width: 768px) {
    .copy-taxon-link {
        width: 28px;
        height: 28px;
    }
    
    .copy-taxon-link i {
        font-size: 1.3rem;
    }
}
/*Estilo para busqueda de imagnes

/* Estilos para el autocompletado */
.autocomplete-input {
    position: relative;
    z-index: 1000;
    width: 100%;
    padding: 10px 15px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.autocomplete-dropdown {
    position: absolute;
    border: 1px solid #ddd;
    border-top: none;
    background-color: white;
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    z-index: 999;
    display: none;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border-radius: 0 0 4px 4px;
}

.autocomplete-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
    font-size: 15px;
}

.autocomplete-item:hover, .autocomplete-item.active {
    background-color: #f5f5f5;
}

.autocomplete-item strong {
    color: #1a73e8;
    font-weight: bold;
}

/* Estilo para tipos de resultados */
.autocomplete-item:after {
    content: attr(data-type);
    float: right;
    color: #70757a;
    font-size: 12px;
    margin-left: 10px;
    text-transform: capitalize;
}