/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 * 🎨 PRGdb5 - Custom Styles & Variables
 * ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 * Este archivo NO modifica Bootstrap, solo extiende la funcionalidad
 * Mantiene compatibilidad con style.css existente
 * 
 * Autor: Marc Rodríguez
 * Proyecto: PRGdb5 - Plant Resistance Genes Database
 * ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

/* ═════════════════════════════════════════════════════════════════════════
   🔬 ALGORITHMS COMPARE - Estilos para la página de comparación
   ═════════════════════════════════════════════════════════════════════════ */

/* Tarjetas de algoritmos */
.algorithm-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    cursor: pointer;
}

.algorithm-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.algorithm-card:focus {
    outline: 2px solid #337ab7;
    outline-offset: 2px;
}

/* Métricas en tarjetas */
.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding: 2px 0;
}

.metric-label {
    font-weight: 600;
    color: #555;
    font-size: 0.9em;
}

.metric-value {
    font-weight: 700;
    font-size: 1em;
}

/* Colores para métricas */
.metric-value.text-success {
    color: #5cb85c !important;
}

.metric-value.text-warning {
    color: #f0ad4e !important;
}

.metric-value.text-danger {
    color: #d9534f !important;
}

/* Responsive para tarjetas */
@media (max-width: 768px) {
    .algorithm-card {
        margin-bottom: 15px;
    }

    .metric-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .metric-value {
        font-size: 0.9em;
    }
}

/* Tabla de métricas */
#metrics-table {
    font-size: 0.9em;
}

#metrics-table th {
    background-color: #343a40;
    color: white;
    font-weight: 600;
    text-align: center;
    vertical-align: middle;
}

#metrics-table td {
    text-align: center;
    vertical-align: middle;
}

#metrics-table tbody tr:hover {
    background-color: #f5f5f5;
}

/* Gráficos */
.chart-container {
    background-color: #fafafa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

/* Tooltips de Google Charts con fondo sólido y borde sutil */
.google-visualization-tooltip,
.google-visualization-tooltip * {
    background: rgba(255, 255, 255, 0.97) !important;
    color: #2c3e50 !important;
}

.google-visualization-tooltip {
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12) !important;
}

/* Notas de algoritmos */
#algorithm-notes {
    background-color: #f8f9fa;
    border-left: 4px solid #007bff;
    padding: 15px;
    border-radius: 4px;
}

/* Accesibilidad - foco visible */
.algorithm-card:focus,
.btn:focus,
select:focus,
input:focus {
    outline: 2px solid #337ab7;
    outline-offset: 2px;
}

/* Contraste mejorado para texto */
.metric-label,
.card-footer small {
    color: #333 !important;
}

/* Animaciones suaves */
.card,
.table,
.alert {
    transition: all 0.3s ease;
}

/* Dual panel layout for GO / KEGG curated sections */
.dual-panel-section {
    margin-top: 25px;
}
.dual-panel-section .dual-panel-api,
.dual-panel-section .dual-panel-local {
    margin-bottom: 20px;
}
.dual-panel-section.no-remote-data .dual-panel-api {
    display: none;
}
.dual-panel-section.no-remote-data .dual-panel-local {
    float: none;
    width: 100%;
    max-width: 100%;
}
.dual-panel-section.has-remote-data .dual-panel-api,
.dual-panel-section.has-remote-data .dual-panel-local {
    display: block;
}
.annotation-table {
    width: 100%;
    font-size: 13px;
}
.annotation-table thead th {
    white-space: nowrap;
    font-weight: 600;
}
.annotation-table td {
    vertical-align: middle;
}
.dual-panel-section .alert {
    margin-bottom: 0;
}

/* ═════════════════════════════════════════════════════════════════════════
   🔧 RESET BASE - Eliminar márgenes del body (AGRESIVO)
   ═════════════════════════════════════════════════════════════════════════ */

* {
    box-sizing: border-box;
}

html {
    margin: 0 !important;
    padding: 0 !important;
    /* overflow-x: hidden; - REMOVIDO: estaba recortando el footer full-bleed */
    width: 100%;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

body {
    margin: 0 !important;
    padding: 0 !important;
    /* overflow-x: hidden; - REMOVIDO: estaba recortando el footer full-bleed */
    width: 100% !important;
    max-width: 100% !important;
    /* Asegurar footer al fondo en páginas cortas: añadir espacio fantasma bajo el contenido */
    font-family: var(--prgdb-font-family);
    font-size: 14px;
    line-height: 1.42857143;
    color: var(--prgdb-text-primary);
    background-color: var(--prgdb-bg-main);
}

/* El alto mínimo dinámico (430px) se aplica por JS con un espaciador al final */
.container.theme-showcase {
    padding-bottom: 20px;
}

/* Reducir espacio superior bajo el navbar fijo en la home */
.home-top-tight .theme-showcase {
    padding-top: 14px !important;
    /* igual que ajuste manual */
}

/* ═════════════════════════════════════════════════════════════════════════
   🏠 HOME PAGE LAYOUT - Two-column and single-column layouts
   ═════════════════════════════════════════════════════════════════════════ */

/* Original two-column layout (PRGdb5 v5.0 - Commented but preserved for reference) */
/* This layout had Description (left) and News (right) in two equal columns */
.home-two-col-row {
    display: flex;
    gap: 15px;
}

.home-two-col-row>.col-md-6 {
    display: flex;
    flex-direction: column;
}

/* Single-column layout (PRGdb5 v5.0 - Current implementation) */
/* News section now occupies the full width of the container */
.home-single-col-row {
    display: flex;
    flex-direction: column;
}

.home-single-col-row>.col-md-12 {
    flex: 0 0 100%;
    max-width: 100%;
    width: 100%;
}

#news-sidebar .panel {
    height: 100%;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    /* eliminar margen inferior (área lila de DevTools) */
}

#news-sidebar .panel-body {
    flex: 1 1 auto;
}

/* Tarjeta de noticia: evitar corte y sin scroll interno */
.news-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.news-card-title {
    margin-top: 0;
    font-size: 18px;
    line-height: 1.3;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
}

.news-card-meta {
    font-size: 12px;
    color: #476457;
    margin-bottom: 6px;
}

.news-card-summary {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 6;
    line-clamp: 6;
    overflow: hidden;
    min-height: 7.2em;
    /* Mantiene altura uniforme para el carrusel */
}

.news-card-link {
    margin-top: auto;
}

/* Crear "ventana" para el carrusel - solo se ve lo que está dentro de los límites */
#news-sidebar {
    overflow: hidden;
    /* La columna de news actúa como ventana */
    position: relative;
}

#news-carousel {
    position: relative;
    overflow: hidden;
    /* El carrusel también recorta el contenido */
}

#news-carousel .carousel-inner {
    overflow: hidden;
    position: relative;
    width: 100%;
    /* Altura fija para evitar que crezca durante las transiciones */
    min-height: 300px;
    /* Solo se ve el contenido dentro de los límites */
}

/* Los items del carrusel - Bootstrap los posiciona durante las transiciones */
#news-carousel .carousel-inner>.item {
    position: relative;
    display: block;
    width: 100%;
}

/* Item activo: visible y establece la altura del contenedor */
#news-carousel .carousel-inner>.item.active {
    position: relative;
    z-index: 2;
}

/* Items en transición: posicionados absolutamente para no afectar la altura */
#news-carousel .carousel-inner>.item.next,
#news-carousel .carousel-inner>.item.prev {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1;
    /* No afectan la altura del contenedor */
}

/* Ocultar items que no están activos ni en transición */
#news-carousel .carousel-inner>.item:not(.active):not(.next):not(.prev) {
    display: none;
}

/* Responsive: ajustar altura mínima en móviles */
@media (max-width: 768px) {
    #news-carousel .carousel-inner {
        min-height: 250px;
    }
}

@media (max-width: 576px) {
    #news-carousel .carousel-inner {
        min-height: 200px;
    }
}

.news-card {
    position: relative;
    z-index: 0;
}

.news-card:hover,
.news-card:focus-within {
    z-index: 1;
    /* En hover, se eleva ligeramente */
}

.home-two-col-row>.col-md-6:last-child {
    position: relative;
    z-index: 0;
    /* Columna derecha en nivel base */
}

/* Anular floats de Bootstrap y fijar 50/50 para esta fila específica */
.home-two-col-row>.col-md-6 {
    float: none !important;
    flex: 0 0 50%;
    max-width: 50%;
}

/* Estilos del lead de bienvenida en home */
.home-lead {
    font-size: 14px;
    max-width: 980px;
    margin: 8px auto 18px;
    padding: 0 15px;
    color: #476457;
    text-align: center;
}

/* Overlay y badges en grid de plantas (home) */
#main-plants .picture:hover .plant-name-overlay {
    display: none;
}

.plant-name-overlay {
    display: none;
}

/* Nuevo grupo de iconos centrado en hover */
.plant-badge-group {
    position: absolute;
    left: 50%;
    bottom: 8px;
    transform: translateX(-50%);
    display: none;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.55);
    border-radius: 6px;
}

.plant-badge-group .badge-dot {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

#main-plants .picture:hover .plant-badge-group {
    display: inline-flex;
}

/* Leyenda + Citation en dos columnas */
.legend-citation-row {
    margin: 10px 0 20px;
    display: flex;
    flex-wrap: wrap;
    /* forzar columnas igual altura */
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    /* Prevenir scroll horizontal */
    overflow-x: hidden;
}

.legend-card {
    background: #f3faf5;
    border: 1px solid var(--prgdb-border-light);
    border-radius: 5px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
}

.legend-title {
    margin: 0 0 8px 0;
    color: #29443a;
    font-weight: 700;
}

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

.legend-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.legend-list i {
    color: #29443a;
}

.citation-card {
    background: #FCE5DE;
    border-radius: 5px;
    padding: 12px 14px;
    border: 1px solid #f4c9c3;
    display: flex;
    flex-direction: column;
}

/* Igualar altura: Legend y Citation tienen la misma altura */
.legend-citation-row .col-md-6 {
    display: flex;
    /* Asegurar que ambas columnas tengan el mismo ancho */
    flex: 0 0 50%;
    max-width: 50%;
    box-sizing: border-box;
    padding-left: 15px;
    padding-right: 15px;
    /* Asegurar que no exceda el ancho disponible */
    min-width: 0;
    width: 100%;
}

/* Margen entre las dos columnas en escritorio */
@media (min-width: 992px) {
    .legend-citation-row .col-md-6:first-child {
        padding-right: 7.5px;
    }

    .legend-citation-row .col-md-6:last-child {
        padding-left: 7.5px;
    }
}

/* En responsive, las columnas se apilan con margen vertical */
@media (max-width: 991px) {
    .legend-citation-row .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
        width: 100%;
    }

    .legend-citation-row .col-md-6:first-child {
        margin-bottom: 15px;
    }
}

.legend-card,
.citation-card {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    /* Asegurar que padding y border se incluyan en el ancho */
    /* Prevenir que el contenido cause overflow */
    overflow-wrap: break-word;
    word-wrap: break-word;
    min-width: 0;
}

/* En escritorio, ambos toman la altura del contenedor */
@media (min-width: 992px) {

    .legend-card,
    .citation-card {
        min-height: 100%;
    }
}

/* En responsive, ambos tienen altura mínima similar */
@media (max-width: 991px) {

    .legend-card,
    .citation-card {
        min-height: auto;
        /* Asegurar que ambos tengan padding y estructura similar */
    }
}


.legend-card .legend-list {
    margin-top: 6px;
    flex-grow: 1;
}

.legend-card::after {
    content: "";
    display: block;
    margin-top: auto;
}

/* Asegurar que citation-card también use flexbox para igualar altura */
.citation-card p {
    margin: 0;
    flex-grow: 1;
    /* Prevenir overflow de texto */
    overflow-wrap: break-word;
    word-wrap: break-word;
    max-width: 100%;
}

/* Nombres científicos en cursiva (convención científica) */
.scientific-name,
a.scientific-name,
strong.scientific-name,
.plant-title strong.scientific-name,
.plant-title a strong.scientific-name {
    font-style: italic !important;
}

/* Título bajo cada imagen */
.plant-title {
    margin-top: 6px;
    line-height: 1.25;
    /* Clamp a 3 líneas para normalizar alturas y evitar saltos */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
    min-height: calc(1.25em * 3);
}

.plant-title strong {
    display: block;
    font-weight: 700;
    color: #1f2937;
}

.plant-title .plant-subtitle {
    color: #374151;
    font-size: 13px;
}

/* Espaciado tarjeta de especie: aire entre imagen y texto siguiente */
#main-plants .main-plant {
    padding: 0 8px 18px;
}

#main-plants .main-plant .picture {
    margin-bottom: 6px;
}

/* Asegurar que el contenedor Bootstrap no añada scroll horizontal */
/* (intencionalmente sin overrides para .container / .container-fluid aquí) */


/* ═════════════════════════════════════════════════════════════════════════
   🎨 CSS VARIABLES - Design System
   ═════════════════════════════════════════════════════════════════════════ */

:root {
    /* Paleta extendida */
    --prg-green-100: #e9f7ef;
    --prg-green-300: #66b389;
    --prg-green-600: #1e7f5a;
    --prg-green-700: #205b37;
    --prg-gray-600: #4b5563;
    --prg-gray-700: #374151;
    --prg-gray-800: #1f2937;
    --prg-cream: #fff3d9;
    --prg-white: #ffffff;

    /* Colores principales */
    --prgdb-primary: #28a745;
    --prgdb-primary-dark: #1e7e34;
    --prgdb-primary-light: #71dd8a;

    /* Colores de fondo */
    --prgdb-bg-main: #FFFFFF;
    --prgdb-bg-light: #F6F6F5;
    --prgdb-bg-green-light: #f3faf5;

    /* Colores de texto */
    --prgdb-text-primary: #29443a;
    --prgdb-text-secondary: #476457;
    --prgdb-text-muted: #6c757d;

    /* Colores de borde */
    --prgdb-border-light: #e0efe6;
    --prgdb-border-dashed: #d6e8de;

    /* Espaciado */
    --prg-spacing-sm: 0.5rem;
    --prg-spacing-md: 1rem;
    --prg-spacing-lg: 1.5rem;
    --prg-spacing-xl: 2rem;
    --prgdb-spacing-xs: 0.5rem;
    --prgdb-spacing-sm: 1rem;
    --prgdb-spacing-md: 1.5rem;
    --prgdb-spacing-lg: 2rem;
    --prgdb-spacing-xl: 3rem;

    /* Tipografía */
    --prgdb-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --prgdb-font-size-base: 1rem;
    --prgdb-font-size-sm: 0.875rem;
    --prgdb-font-size-xs: 0.75rem;
    --prgdb-line-height-base: 1.5;

    /* Sombras */
    --prgdb-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --prgdb-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --prgdb-shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

    /* Transiciones */
    --prg-transition: all 0.3s ease;
    --prgdb-transition-fast: 120ms ease;
    --prgdb-transition-base: 250ms ease;
    --prgdb-transition-slow: 350ms ease;

    /* Bordes redondeados */
    --prgdb-radius-sm: 4px;
    --prgdb-radius-md: 6px;
    --prgdb-radius-lg: 8px;

    /* Z-index layers */
    --prgdb-z-dropdown: 1000;
    --prgdb-z-sticky: 1020;
    --prgdb-z-fixed: 1030;
    --prgdb-z-modal: 1040;
    --prgdb-z-tooltip: 1050;

    /* Variables de búsqueda (search bar) */
    --search-bg: var(--prg-white);
    --search-border: var(--prg-gray-600);
    --search-border-focus: var(--prg-green-600);
    --search-shadow: 0 1px 3px rgba(31, 41, 55, 0.1);
    --search-shadow-focus: 0 0 0 3px rgba(30, 127, 90, 0.15);
    --search-text: var(--prg-gray-800);
    --search-placeholder: var(--prg-gray-600);
    --search-suggestion-bg: var(--prg-white);
    --search-suggestion-hover: var(--prg-cream);
    --search-highlight: var(--prg-cream);
}


/* ═════════════════════════════════════════════════════════════════════════
   🦶 FOOTER CORPORATIVO - Diseño Moderno y Accesible
   ═════════════════════════════════════════════════════════════════════════ */

.prgdb-footer {
    background: var(--prgdb-bg-green-light);
    border-top: 1px solid var(--prgdb-border-light);
    color: var(--prgdb-text-primary);
    margin-top: var(--prgdb-spacing-lg);
    padding: var(--prgdb-spacing-md) 0;
    /* menos aire arriba y abajo */
    width: 100%;
    margin-left: 0;
    margin-right: 0;
}

.prgdb-footer__inner {
    width: 100%;
    margin: 0;
    padding: 0 var(--prgdb-spacing-lg);
}

.prgdb-footer__top {
    text-align: center;
    margin-bottom: var(--prgdb-spacing-xs);
    justify-items: center;
    /* aún menos aire sobre los logos */
}

.prgdb-footer__text {
    font-family: Arial, var(--prgdb-font-family);
    font-size: 13px;
    line-height: var(--prgdb-line-height-base);
    text-transform: uppercase;
    color: #29443a73;
    font-weight: 500;
    margin: 0;
    text-align: justify;
}

.prgdb-footer__logos {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 3rem;
    padding: 6px 0;
    /* aún menos aire vertical alrededor de logos */
    width: 100%;
    max-width: none;
    margin: 0;
}

.prgdb-footer__logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 90px;
    transition: opacity var(--prgdb-transition-base), filter var(--prgdb-transition-base);
    opacity: 0.85;
    text-decoration: none;
}

.prgdb-footer__logo:hover {
    opacity: 1;
    filter: brightness(1.05);
}

.prgdb-footer__logo:focus {
    opacity: 1;
    outline: 2px solid var(--prgdb-text-primary);
    outline-offset: 4px;
}

.prgdb-footer__logo img {
    max-height: 70px;
    /* reducir altura para compactar footer */
    max-width: 240px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.prgdb-footer__bottom {
    border-top: 1px solid var(--prgdb-border-light);
    margin-top: var(--prgdb-spacing-sm);
    /* menos distancia desde logos a frase inferior */
    padding-top: 6px;
    text-align: center;
}

.prgdb-footer__legal {
    font-size: 10px;
    /* solicitado: 10px */
    color: var(--prgdb-text-secondary);
    margin: 0;
}

/* Neutralizar el pseudo-elemento full-bleed heredado para evitar overflow horizontal */
.prgdb-footer::before {
    left: 0 !important;
    right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Evitar scroll lateral provocado por el footer en escritorio */
.prgdb-footer {
    overflow-x: hidden;
}


/* ─────────────────────────────────────────────────────────────────────────
   📱 RESPONSIVE - Mobile First
   ───────────────────────────────────────────────────────────────────────── */

/* Tablets (≤992px) */
@media (max-width: 992px) {
    .prgdb-footer__logos {
        flex-wrap: wrap;
        gap: 1.5rem;
    }

    .prgdb-footer__logo {
        height: 75px;
        flex: 0 0 calc(50% - 1.5rem);
    }

    .prgdb-footer__logo img {
        max-height: 65px;
        max-width: 200px;
    }
}

/* Móviles (≤576px) */
@media (max-width: 576px) {
    .prgdb-footer {
        padding: var(--prgdb-spacing-md) 0;
    }

    .prgdb-footer__inner {
        padding: 0 var(--prgdb-spacing-sm);
    }

    .prgdb-footer__logos {
        flex-direction: column;
        gap: var(--prgdb-spacing-md);
    }

    .prgdb-footer__logo {
        height: 60px;
        flex: 0 0 auto;
    }

    .prgdb-footer__logo img {
        max-height: 55px;
        max-width: 180px;
    }

    .prgdb-footer__text {
        font-size: 10px;
        /* mantener 10px también en móvil */
    }
}


/* ═════════════════════════════════════════════════════════════════════════
   ♿ ACCESIBILIDAD - WAI-ARIA Enhancements
   ═════════════════════════════════════════════════════════════════════════ */

/* Mejor contraste para focus visible */
*:focus-visible {
    outline: 2px solid var(--prgdb-primary);
    outline-offset: 2px;
}

/* Skip to main content link (para screen readers) */
.skip-to-main {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--prgdb-primary);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    z-index: var(--prgdb-z-tooltip);
}

.skip-to-main:focus {
    top: 0;
}

/* Reducir animaciones para usuarios que prefieren menos movimiento */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .prgdb-footer__logo:hover {
        filter: none;
    }
}


/* ═════════════════════════════════════════════════════════════════════════
   🎨 UTILIDADES - Helper Classes
   ═════════════════════════════════════════════════════════════════════════ */

.prgdb-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.prgdb-text-center {
    text-align: center;
}

.prgdb-mt-auto {
    margin-top: auto;
}

.prgdb-mb-0 {
    margin-bottom: 0;
}


/* ═════════════════════════════════════════════════════════════════════════
   🔧 MEJORAS PROGRESIVAS - Progressive Enhancement
   ═════════════════════════════════════════════════════════════════════════ */

/* Flexbox ya está implementado - no se necesita fallback */


/* ═════════════════════════════════════════════════════════════════════════
   🖨️ PRINT STYLES - Optimización para impresión
   ═════════════════════════════════════════════════════════════════════════ */

@media print {
    .prgdb-footer {
        page-break-after: avoid;
        border-top: 1px solid #000;
    }

    .prgdb-footer__logo:hover,
    .prgdb-footer__logo:focus {
        transform: none;
        outline: none;
    }
}

/* ═════════════════════════════════════════════════════════════════════════
   🖼️ BEFORE/AFTER SLIDER - Comparador visual PRGdb4 vs PRGdb5
   ═════════════════════════════════════════════════════════════════════════ */

.before-after-container {
    margin: 20px 0;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.before-after-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: 500px;
    overflow: hidden;
    cursor: ew-resize;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.before-after-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.before-image {
    z-index: 1;
    clip-path: inset(0 50% 0 0);
    transition: clip-path 0.1s ease-out;
}

.after-image {
    z-index: 2;
    clip-path: inset(0 0 0 50%);
    transition: clip-path 0.1s ease-out;
}

.slider-handle {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    background: #fff;
    z-index: 10;
    cursor: ew-resize;
    transform: translateX(-50%);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    transition: left 0.1s ease-out;
}

.slider-line {
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    background: #fff;
    transform: translateX(-50%);
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

.slider-arrow-left,
.slider-arrow-right {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: background 0.2s ease;
}

.slider-arrow-left:hover,
.slider-arrow-right:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.slider-arrow-left {
    left: -20px;
}

.slider-arrow-right {
    right: -20px;
}

.slider-arrow-left i,
.slider-arrow-right i {
    color: #333;
    font-size: 14px;
}

.slider-label {
    position: absolute;
    top: 20px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-weight: bold;
    font-size: 14px;
    border-radius: 4px;
    z-index: 11;
    pointer-events: none;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.slider-label-before {
    left: 20px;
}

.slider-label-after {
    right: 20px;
}

/* Responsive: ajustar altura en pantallas más pequeñas */
@media (max-width: 768px) {
    .before-after-wrapper {
        height: 350px;
    }
    
    .slider-arrow-left,
    .slider-arrow-right {
        width: 35px;
        height: 35px;
    }
    
    .slider-arrow-left {
        left: -17.5px;
    }
    
    .slider-arrow-right {
        right: -17.5px;
    }
    
    .slider-label {
        font-size: 12px;
        padding: 6px 12px;
        top: 10px;
    }
    
    .slider-label-before {
        left: 10px;
    }
    
    .slider-label-after {
        right: 10px;
    }
}

@media (max-width: 480px) {
    .before-after-wrapper {
        height: 250px;
    }
}

/* ═════════════════════════════════════════════════════════════════════════
   🧬 AVAILABLE GENE TYPES - Spacing improvements for plant details page
   ═════════════════════════════════════════════════════════════════════════ */

/* 
 * Target sections with "Available Gene Types" / "Available Data Types" 
 * that have 3 .col-md-4 columns (Reference, Putative, Expression pattern)
 * 
 * AFFECTED VIEWS:
 * - plantDetails.jade: "Available Gene Types" (3 .col-md-4) ✅ Primary target
 * - pathogenDetails.jade: "Available Data Types" (3 .col-md-4) ⚠️ Also affected
 * 
 * NOT AFFECTED:
 * - diseaseDetails.jade: "Available Data Types" (2 .col-md-6) - Different structure
 * 
 * Structure: .row.container[style*="margin-top: 20px"] > .col-md-12 > h4 + .row > 3x .col-md-4
 */
/* Container for sections with 3-column alert layout */
.row.container[style*="margin-top: 20px"]:has(.col-md-12 > .row > .col-md-4:nth-child(3)) {
    margin-top: var(--prgdb-spacing-lg) !important;
    margin-bottom: var(--prgdb-spacing-lg) !important;
    padding-top: var(--prgdb-spacing-md);
    padding-bottom: var(--prgdb-spacing-md);
}

/* Title spacing - "Available Gene Types" heading */
.row.container[style*="margin-top: 20px"]:has(.col-md-12 > .row > .col-md-4:nth-child(3)) .col-md-12>h4 {
    margin-bottom: var(--prgdb-spacing-md) !important;
    margin-top: 0;
    display: block;
}

/* Spacing between title and alert cards row */
.row.container[style*="margin-top: 20px"]:has(.col-md-12 > .row > .col-md-4:nth-child(3)) .col-md-12>h4+.row {
    margin-top: var(--prgdb-spacing-sm);
    margin-bottom: 0;
    /* Remove gap - use consistent padding instead */
}

/* Alert cards container - Reference, Putative, Expression */
.row.container[style*="margin-top: 20px"]:has(.col-md-12 > .row > .col-md-4:nth-child(3)) .col-md-12>.row {
    display: flex;
    flex-wrap: wrap;
    margin-left: 0;
    margin-right: 0;
    /* Remove negative margins to prevent first element misalignment */
}

/* Individual alert card columns - only when there are 3 .col-md-4 */
.row.container[style*="margin-top: 20px"]:has(.col-md-12 > .row > .col-md-4:nth-child(3)) .col-md-12>.row>.col-md-4 {
    margin-bottom: var(--prgdb-spacing-sm);
    margin-top: 0;
    /* Remove top margin to align all 3 elements */
    padding-left: 8px;
    padding-right: 8px;
    /* Reduced padding for more compact layout */
    flex: 0 0 32%;
    max-width: 32%;
    /* Slightly smaller (32% each = 96%, leaving 4% for gaps) */
}

/* First column - remove any left padding/margin that causes misalignment */
.row.container[style*="margin-top: 20px"]:has(.col-md-12 > .row > .col-md-4:nth-child(3)) .col-md-12>.row>.col-md-4:first-child {
    padding-left: 0;
    margin-left: 0;
}

/* Last column - remove right padding */
.row.container[style*="margin-top: 20px"]:has(.col-md-12 > .row > .col-md-4:nth-child(3)) .col-md-12>.row>.col-md-4:last-child {
    padding-right: 0;
    margin-right: 0;
}

/* Alert cards internal spacing and alignment - more compact for desktop */
.row.container[style*="margin-top: 20px"]:has(.col-md-12 > .row > .col-md-4:nth-child(3)) .alert {
    margin-bottom: 0;
    padding: 8px 12px;
    /* Reduced padding for more compact cards */
    min-height: 50px;
    /* Reduced height for desktop */
    display: flex;
    align-items: center;
    gap: 8px;
    /* Slightly reduced gap between icon and text */
}

/* Alert icons spacing - ensure icon doesn't shrink and has proper spacing */
.row.container[style*="margin-top: 20px"]:has(.col-md-12 > .row > .col-md-4:nth-child(3)) .alert i.fa {
    flex-shrink: 0;
    /* No margin-right needed - gap handles spacing */
    display: inline-flex;
    align-items: center;
}

/* Ensure text (strong) elements align properly */
.row.container[style*="margin-top: 20px"]:has(.col-md-12 > .row > .col-md-4:nth-child(3)) .alert strong {
    flex: 1;
    /* Text takes remaining space after icon */
}

/* Responsive adjustments for tablets */
@media (max-width: 992px) {
    .row.container[style*="margin-top: 20px"]:has(.col-md-12 > .row > .col-md-4:nth-child(3)) .col-md-12>.row>.col-md-4 {
        flex: 0 0 50%;
        max-width: 50%;
        padding-left: 8px;
        padding-right: 8px;
    }

    /* Reset first/last padding adjustments for tablets */
    .row.container[style*="margin-top: 20px"]:has(.col-md-12 > .row > .col-md-4:nth-child(3)) .col-md-12>.row>.col-md-4:first-child {
        padding-left: 8px;
    }

    .row.container[style*="margin-top: 20px"]:has(.col-md-12 > .row > .col-md-4:nth-child(3)) .col-md-12>.row>.col-md-4:last-child {
        padding-right: 8px;
    }
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
    .row.container[style*="margin-top: 20px"]:has(.col-md-12 > .row > .col-md-4:nth-child(3)) {
        margin-top: var(--prgdb-spacing-md) !important;
        margin-bottom: var(--prgdb-spacing-md) !important;
        padding-top: var(--prgdb-spacing-sm);
        padding-bottom: var(--prgdb-spacing-sm);
    }

    .row.container[style*="margin-top: 20px"]:has(.col-md-12 > .row > .col-md-4:nth-child(3)) .col-md-12>.row>.col-md-4 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: var(--prgdb-spacing-sm);
        padding-left: 0;
        padding-right: 0;
    }

    /* Reset first/last padding for mobile */
    .row.container[style*="margin-top: 20px"]:has(.col-md-12 > .row > .col-md-4:nth-child(3)) .col-md-12>.row>.col-md-4:first-child,
    .row.container[style*="margin-top: 20px"]:has(.col-md-12 > .row > .col-md-4:nth-child(3)) .col-md-12>.row>.col-md-4:last-child {
        padding-left: 0;
        padding-right: 0;
    }

    .row.container[style*="margin-top: 20px"]:has(.col-md-12 > .row > .col-md-4:nth-child(3)) .alert {
        min-height: 50px;
        padding: 8px 12px;
    }
}

/* ═════════════════════════════════════════════════════════════════════════
   🔎 DATATABLES FILTERS - Align search label to the right
   ═════════════════════════════════════════════════════════════════════════ */
.dataTables_filter {
    width: 100%;
}

.dataTables_filter label {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    width: 100%;
    margin-bottom: 0;
}

.dataTables_filter input[type="search"] {
    margin: 0;
    max-width: 240px;
}

/* DREM results table: keep within page width with horizontal scroll */
.drem-results-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.drem-results-scroll table.dataTable {
    width: 100% !important;
    margin: 0 !important;
}

.drem-results-scroll table.dataTable th,
.drem-results-scroll table.dataTable td {
    white-space: nowrap;
}

/* ═════════════════════════════════════════════════════════════════════════
   🧬 SEQUENCE ACCORDION - DNA/Protein collapsible panels
   ═════════════════════════════════════════════════════════════════════════ */
.sequence-accordion {
    margin-top: 15px;
}

.sequence-accordion .sequence-panel {
    border: 1px solid #d9e4dc;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    background-color: #fff;
}

.sequence-accordion .sequence-panel + .sequence-panel {
    margin-top: 12px;
}

.sequence-accordion .panel-heading {
    padding: 0;
    /* Match navbar search buttons color: #1e7f5a78 = rgba(30, 127, 90, 0.47) */
    background: rgba(30, 127, 90, 0.47) !important;
    background-color: rgba(30, 127, 90, 0.47) !important;
    background-image: none !important;
    border-bottom: 0;
}

.sequence-accordion .sequence-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 18px;
    font-weight: 600;
    letter-spacing: 0.15px;
    text-transform: none;
    text-decoration: none;
    color: #fff;
    /* Ensure Bootstrap doesn't apply gradients/shadows */
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

.sequence-accordion .sequence-toggle:hover,
.sequence-accordion .sequence-toggle:focus {
    text-decoration: none;
    color: #fff;
    /* Same hover feel as navbar search buttons */
    background-color: rgba(22, 93, 67, 0.28) !important;
}

.sequence-accordion .sequence-toggle::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(255, 255, 255, 0.9);
    transition: transform 0.2s ease;
}

.sequence-accordion .sequence-toggle[aria-expanded="true"]::after {
    transform: rotate(180deg);
}

.sequence-accordion .panel-body {
    border-top: 1px solid #d9e4dc;
    background-color: #fff;
}

.sequence-accordion .panel-body .btn-copy-seq {
    margin-top: 10px;
}

/* ═════════════════════════════════════════════════════════════════════════
   🧩 KEGG BUCKETS (genesDetailsPu.jade) - avoid 1:1 KO↔Pathway perception
   ═════════════════════════════════════════════════════════════════════════ */
.kegg-bucket .panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kegg-help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 8px;
    border-radius: 50%;
    font-size: 12px;
    line-height: 1;
    cursor: help;
    color: #ffffff;
    background: rgba(30, 127, 90, 0.47); /* Match navbar search buttons */
}

.kegg-help-icon:focus {
    outline: 2px solid rgba(30, 127, 90, 0.47);
    outline-offset: 2px;
}

.kegg-bucket-list {
    max-height: 260px;
    overflow: auto;
    padding-right: 6px;
}

.kegg-bucket-item + .kegg-bucket-item {
    margin-top: 6px;
}

/* ═════════════════════════════════════════════════════════════════════════
   🧬 GO (Putative) - Figma vertical layout (genesDetailsPu.jade)
   ═════════════════════════════════════════════════════════════════════════ */
.go-figma-info {
    background: #e6e6e6;
    padding: 14px 16px;
    border-radius: 4px;
    margin-bottom: 12px;
    color: #2b2b2b;
}

.go-figma-block {
    background: #f3f3f3;
    border-radius: 4px;
    margin-bottom: 12px;
    overflow: hidden;
}

.go-figma-title {
    background: #7DBE7E;
    color: #000;
    font-weight: 700;
    padding: 10px 12px;
}

.go-figma-body {
    padding: 12px;
    background: #f3f3f3;
}

.go-figma-term + .go-figma-term {
    margin-top: 6px;
}

/* === ABOUT PAGE REPAIR STYLES === */

/* 1. Hero Section Text Fix */
.about-hero-text p {
    font-size: 18px !important;      /* Mucho más grande que el default 14px */
    line-height: 1.6 !important;
    color: #333 !important;
    text-align: justify;
}

/* 1. FIX BORDE VERDE DEL MONSTRUO (Specific Override) */
/* Aseguramos que la imagen del Hero no tenga el borde verde de style.css */
.about-hero-img, 
.col-md-6.text-center img[src*="about1_1.svg"] { 
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    background: transparent !important;
}

/* 2. Feature Column Alignment (Lock Icon + Circle) */
.feature-wrapper {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important; /* Centra horizontalmente icono y círculo */
    justify-content: flex-start !important;
    margin-bottom: 30px;
}

.feature-icon {
    height: 110px !important;       /* Tamaño fijo para los iconos */
    width: auto !important;
    margin-bottom: 20px !important; /* Espacio entre icono y círculo */
    background: transparent !important; /* Elimina cualquier fondo */
    background-color: transparent !important;
    background-image: none !important;
    border: none !important;
    border-width: 0 !important;
    outline: none !important;
    outline-width: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    display: block !important;
    z-index: 10;
}

/* Eliminar cualquier estilo que pueda crear el cuadrado azul en los iconos */
.feature-wrapper img.feature-icon,
.feature-wrapper .feature-icon {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* 2. FIX BURBUJAS VERDES (Eliminar 'margin-top: auto') */
.green-circle {
    /* Aseguramos que el contenedor centre el contenido y no lo disperse */
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important; /* Centrado vertical estricto */
    align-items: center !important;
    /* Dimensiones fijas */
    width: 270px !important;
    height: 270px !important;
    background-color: #7DBE7E !important;
    border-radius: 50% !important;
    padding: 20px !important;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1) !important;
}

.green-circle h4 {
    color: #000 !important;
    font-weight: 800 !important; /* Bold fuerte */
    font-size: 1.4em !important;
    margin-bottom: 5px !important; /* Separación pequeña hacia el texto */
    margin-top: 0 !important;
    line-height: 1.1 !important;
    text-align: center !important; /* Forzar centrado del título */
}

.green-circle p {
    /* AQUÍ ESTABA EL ERROR: Cambiamos 'auto' por un margen fijo pequeño */
    margin-top: 10px !important;  /* Separación controlada del título */
    margin-bottom: 0 !important;
    
    color: #000 !important;
    font-size: 15px !important;   /* Texto un poco más grande para rellenar mejor */
    line-height: 1.3 !important;
    text-align: center !important;
}

/* 4. Footer Text Fix */
.about-project-text p {
    font-size: 16px !important;
    line-height: 1.6 !important;
    text-align: justify !important;
}

/* ═════════════════════════════════════════════════════════════════════════
   🧬 GO LEGEND BADGES - Forzar colores consistentes con resultados
   ═════════════════════════════════════════════════════════════════════════ */
/* 
 * Asegurar que los badges de la leyenda GO tengan los mismos colores que los resultados.
 * Usamos selectores muy específicos basados en la estructura HTML de la leyenda.
 * 
 * Estructura: #go-pathways-content-re > p.small > span (3 spans: P, F, C)
 */

/* P - Biological Process: Azul (primer span con margin-right:25px) */
#go-pathways-content-re p.small span[style*="margin-right:25px"]:nth-of-type(1) span.badge {
    background-color: #E3F2FD !important;
    color: #1976D2 !important;
}

/* F - Molecular Function: Morado/Violeta (segundo span con margin-right:25px) */
#go-pathways-content-re p.small span[style*="margin-right:25px"]:nth-of-type(2) span.badge {
    background-color: #F3E5F5 !important;
    color: #7B1FA2 !important;
}

/* C - Cellular Component: Verde (último span, sin margin-right:25px) */
#go-pathways-content-re p.small span:last-child span.badge {
    background-color: #E8F5E9 !important;
    color: #388E3C !important;
}

/* Fallback: Si los selectores anteriores no funcionan, usar nth-child */
#go-pathways-content-re p.small > span:nth-child(1) span.badge {
    background-color: #E3F2FD !important;
    color: #1976D2 !important;
}

#go-pathways-content-re p.small > span:nth-child(2) span.badge {
    background-color: #F3E5F5 !important;
    color: #7B1FA2 !important;
}

#go-pathways-content-re p.small > span:nth-child(3) span.badge {
    background-color: #E8F5E9 !important;
    color: #388E3C !important;
}

/* ═════════════════════════════════════════════════════════════════════════
   🧬 GO LEGEND BADGES - Clases específicas para leyenda
   ═════════════════════════════════════════════════════════════════════════ */
/* GO Legend Badges */
.badge-go-p {
    background-color: #E3F2FD !important;
    color: #1976D2 !important;
    border: 1px solid #1976D2 !important; /* Borde sutil para asegurar visibilidad */
}
.badge-go-f {
    background-color: #F3E5F5 !important;
    color: #7B1FA2 !important;
    border: 1px solid #7B1FA2 !important;
}
.badge-go-c {
    background-color: #E8F5E9 !important;
    color: #388E3C !important;
    border: 1px solid #388E3C !important;
}
