/* styles.css - Estilos principales */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
    color: #2c3e50;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 60px 20px;
    text-align: center;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 30px;
}

.subtitle-home {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 5px;
}

.stats-bar {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.stats-bar div {
    background: rgba(255,255,255,0.15);
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 0.9rem;
    backdrop-filter: blur(10px);
}

.search-container {
    margin-top: 30px;
}

#search-input {
    width: 80%;
    max-width: 600px;
    padding: 14px 24px;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

#search-input:focus {
    outline: none;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    transform: scale(1.02);
}

.filters-bar {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    flex-wrap: wrap;
    background: white;
    margin: 20px auto;
    border-radius: 50px;
    width: fit-content;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.filter-label {
    font-weight: 600;
    color: #6c757d;
}

.filter-chip {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 6px 16px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.filter-chip:hover {
    background: #e9ecef;
}

.filter-chip.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.datasets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 25px;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.dataset-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}

.dataset-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.12);
}

.card-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: linear-gradient(135deg, #3498db, #2c3e50);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.dataset-card h3 {
    color: #2c3e50;
    margin-bottom: 12px;
    padding-right: 70px;
    font-size: 1.2rem;
    font-weight: 600;
}

.dataset-card p {
    color: #6c757d;
    font-size: 0.85rem;
    margin-bottom: 16px;
    line-height: 1.4;
    flex-grow: 1;
}

.card-metrics {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    font-size: 0.8rem;
    flex-wrap: wrap;
}

.card-metrics span {
    background: #f8f9fa;
    padding: 4px 10px;
    border-radius: 20px;
    color: #495057;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.card-link {
    display: inline-block;
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
}

.card-link:hover {
    text-decoration: underline;
}

.download-icon {
    background: #28a745;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.download-icon:hover {
    background: #218838;
}

/* Navegación */
.navbar {
    background: white;
    padding: 15px 25px;
    border-radius: 12px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    flex-wrap: wrap;
    gap: 15px;
}

.nav-link-home {
    text-decoration: none;
    color: white;
    margin: 0 12px;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link {
    text-decoration: none;
    color: #2c3e50;
    margin: 0 12px;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover, .nav-link-home:hover {
    color: #3498db;
}

.nav-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.dataset-header {
    background: white;
    padding: 30px;
    border-radius: 16px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.header-badge {
    margin-bottom: 15px;
}

.badge-id {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: white;
    padding: 5px 15px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.85rem;
    display: inline-block;
}

.badge-version {
    background: #6c757d;
    color: white;
    padding: 5px 12px;
    border-radius: 25px;
    font-size: 0.75rem;
    margin-left: 10px;
}

.dataset-header h1 {
    margin: 15px 0;
    font-size: 1.8rem;
}

.description {
    color: #6c757d;
    line-height: 1.6;
}

.metrics-card {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric {
    background: white;
    padding: 20px;
    text-align: center;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: transform 0.2s;
}

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

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: #3498db;
}

.metric-label {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 5px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.info-card {
    background: white;
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.info-card h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.spec-table {
    width: 100%;
    border-collapse: collapse;
}

.spec-table th, .spec-table td {
    padding: 10px 0;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.spec-table th {
    font-weight: 600;
    width: 40%;
}

.info-card ul {
    list-style: none;
    padding-left: 0;
}

.info-card li {
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

.viz-card {
    background: white;
    padding: 25px;
    border-radius: 16px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.download-section {
    background: white;
    padding: 30px;
    border-radius: 16px;
    margin-bottom: 30px;
    text-align: center;
}

.download-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.download-note {
    margin-top: 15px;
    font-size: 0.8rem;
    color: #6c757d;
}

.btn {
    display: inline-block;
    padding: 14px 32px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52,152,219,0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

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

.citation-section {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 16px;
    margin-bottom: 30px;
}

.citation-block, .citation-block-new {
    background: #2c3e50;
    color: #e9ecef;
    padding: 20px;
    border-radius: 12px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    overflow-x: auto;
    margin: 20px 0;
}

.btn-copy {
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
}

.btn-copy:hover {
    background: #2980b9;
}

.alert {
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.alert-warning {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    color: #856404;
}

.reproducibility-note {
    background: #e8f4fd;
    border-left: 4px solid #3498db;
    padding: 15px 20px;
    border-radius: 8px;
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.note-icon {
    font-size: 1.5rem;
}

.reproducibility-note p {
    margin: 0;
    font-size: 0.9rem;
}

.reproducibility-note code {
    background: #d4e6f1;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

footer {
    text-align: center;
    padding: 30px;
    color: #6c757d;
    font-size: 0.85rem;
    border-top: 1px solid #dee2e6;
    margin-top: 40px;
}

.main-footer {
    background: #2c3e50;
    color: white;
    padding: 30px;
    text-align: center;
    margin-top: 50px;
}

.main-footer a {
    color: #3498db;
    text-decoration: none;
}

.main-footer a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    header h1 { font-size: 1.8rem; }
    .stats-bar { flex-direction: column; align-items: center; gap: 10px; }
    .datasets-grid { grid-template-columns: 1fr; }
    .filters-bar { flex-wrap: wrap; border-radius: 20px; padding: 15px; }
    .navbar { flex-direction: column; text-align: center; }
    .metric-value { font-size: 1.5rem; }
}

/* Estilos para las badges de mejora - SIEMPRE VISIBLES */
.improvement-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    margin-left: 0.5rem;
    border-radius: 20px;
    transition: all 0.2s ease;
    vertical-align: middle;
    white-space: nowrap;
}

/* Mejora positiva */
.improvement-badge.positive {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.improvement-badge.positive::before {
    content: "▲ ";
    font-size: 0.65rem;
}

/* Mejora negativa */
.improvement-badge.negative {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.improvement-badge.negative::before {
    content: "▼ ";
    font-size: 0.65rem;
}

/* Sin cambio */
.improvement-badge.neutral {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
    opacity: 0.8;
}

/* Efecto hover sutil (opcional, no necesario) */
.improvement-badge:hover {
    transform: scale(1.02);
    cursor: default;
}

/* Para dispositivos móviles */
@media (max-width: 768px) {
    .improvement-badge {
        font-size: 0.6rem;
        padding: 0.15rem 0.4rem;
    }
}

/* Estilos para la nota aclaratoria */
.aclaracion-nota {
    background-color: #f0f7ff;
    border-left: 4px solid #3b82f6;
    padding: 12px 16px;
    margin: 16px 20px 0 20px;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #1e40af;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-family: 'Inter', sans-serif;    
    max-width: 1400px;
}

.aclaracion-nota .icono {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.aclaracion-nota .texto {
    line-height: 1.4;
}

.aclaracion-nota .texto strong {
    font-weight: 600;
}

.aclaracion-nota .texto .destacado {
    background-color: #dbeafe;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.8rem;
}

/* Estilos para la comparación de métricas */
.metrics-comparison {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.metrics-card {
    flex: 1;
    min-width: 250px;
    max-width: 350px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    text-align: center;
    transition: transform 0.3s ease;
}

.metrics-card:hover {
    transform: translateY(-5px);
}

.metrics-card h4 {
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 1.1em;
}

.original-metrics {
    border-left: 4px solid #3498db;
}

.synthetic-metrics {
    border-left: 4px solid #2ecc71;
}

.best-metrics {
    background: linear-gradient(135deg, #f8fff8, #e8f5e9);
    border: 2px solid #2ecc71;
    position: relative;
}

.best-badge {
    position: absolute;
    top: -12px;
    right: -12px;
    background: #f39c12;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75em;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.improvement-arrow {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 10px;
    color: #2ecc71;
}

.arrow-icon {
    font-size: 2em;
}

.improvement-label {
    font-size: 0.8em;
    color: #27ae60;
    font-weight: bold;
    margin-top: 5px;
}

.metrics-comparison .metric {
    margin: 20px 0;
    padding: 8px;
}

.metric-value {
    font-size: 2em;
    font-weight: bold;
    color: #2c3e50;
}

.metric-label {
    font-size: 0.9em;
    color: #7f8c8d;
    margin-top: 5px;
}

.improvement-badge {
    display: inline-block;
    font-size: 0.7em;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 5px;
    font-weight: bold;
}

.improvement-badge.positive {
    background: #d5f5e3;
    color: #27ae60;
}

.improvement-badge.negative {
    background: #fadbd8;
    color: #e74c3c;
}

.metric.improved {
    background: rgba(46, 204, 113, 0.05);
    border-radius: 8px;
    padding: 8px;
}

/* Versión responsiva */
@media (max-width: 768px) {
    .metrics-comparison {
        flex-direction: column;
        gap: 20px;
    }
    
    .improvement-arrow {
        transform: rotate(90deg);
        padding: 10px 0;
    }
    
    .metrics-card {
        min-width: 200px;
        width: 100%;
    }
}

/* Estilos para las tablas de conjuntos derivados */
.derivados-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.derivados-table thead {
    background: #2c3e50;
    color: white;
}

.derivados-table th {
    padding: 10px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 0.8em;
    white-space: nowrap;
}

.derivados-table td {
    padding: 8px 6px;
    text-align: center;
    border-bottom: 1px solid #ecf0f1;
}

.derivados-table tbody tr:hover {
    background: #f8f9fa;
}

.derivados-table .best-row {
    background: #f0fff4;
    border-left: 3px solid #2ecc71;
}

.derivados-table .best-row:hover {
    background: #e8f5e9;
}

.best-badge-table {
    font-size: 1.2em;
}

.derivados-table .btn-small {
    display: inline-block;
    padding: 3px 10px;
    background: #3498db;
    color: white;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.75em;
    transition: background 0.3s;
}

.derivados-table .btn-small:hover {
    background: #2980b9;
}

/* Responsive para tablas */
@media (max-width: 768px) {
    .derivados-table {
        font-size: 0.7em;
    }
    
    .derivados-table th,
    .derivados-table td {
        padding: 5px 3px;
    }
    
    .table-container {
        overflow-x: auto;
    }
}

/* Mejor seleccionado */
.mejor-seleccionado {
    margin-top: 15px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #fff8e1, #fff3cd);
    border-left: 4px solid #f39c12;
    border-radius: 6px;
    font-size: 0.95em;
}

.mejor-seleccionado .star {
    color: #f39c12;
    font-size: 1.2em;
    margin-right: 5px;
}

/* Estilos para la guía de métricas */
.metricas-guia {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin: 30px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.metricas-guia h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.4em;
}

.guia-intro {
    color: #555;
    line-height: 1.6;
    margin-bottom: 25px;
    font-size: 0.95em;
}

.metricas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.metrica-grupo {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
}

.metrica-grupo h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.05em;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
}

.metrica-item {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 12px;
    border-left: 4px solid #3498db;
    transition: all 0.3s ease;
}

.metrica-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateX(5px);
}

.metrica-item.destacado {
    border-left-color: #f39c12;
    background: #fffdf5;
}

.metrica-nombre {
    font-weight: 700;
    color: #2c3e50;
    font-size: 1.05em;
    display: inline-block;
}

.metrica-rango {
    display: inline-block;
    font-size: 0.85em;
    color: #7f8c8d;
    margin-left: 8px;
    background: #ecf0f1;
    padding: 2px 10px;
    border-radius: 12px;
}

.metrica-descripcion {
    margin-top: 8px;
    font-size: 0.9em;
    color: #444;
    line-height: 1.5;
}

.metrica-descripcion p {
    margin: 5px 0;
}

.metrica-descripcion ul {
    margin: 5px 0 5px 20px;
    padding: 0;
}

.metrica-descripcion ul li {
    margin: 3px 0;
    font-size: 0.95em;
}

.ejemplo {
    background: #f0f7ff;
    padding: 8px 12px;
    border-radius: 6px;
    margin: 8px 0;
    font-style: italic;
    border-left: 3px solid #3498db;
}

.nota {
    background: #fff8e1;
    padding: 8px 12px;
    border-radius: 6px;
    margin: 8px 0;
    font-size: 0.9em;
    border-left: 3px solid #f39c12;
}

/* Resumen rápido */
.metricas-resumen {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
}

.metricas-resumen h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.resumen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.resumen-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.resumen-icon {
    font-size: 1.5em;
    flex-shrink: 0;
}

.resumen-item ul {
    margin: 5px 0 0 0;
    padding-left: 18px;
}

.resumen-item ul li {
    margin: 3px 0;
    font-size: 0.9em;
}

.resumen-item strong {
    color: #2c3e50;
}

/* Responsive */
@media (max-width: 768px) {
    .metricas-grid {
        grid-template-columns: 1fr;
    }
    
    .resumen-grid {
        grid-template-columns: 1fr;
    }
    
    .metrica-item {
        padding: 12px;
    }
    
    .metrica-rango {
        display: block;
        margin-left: 0;
        margin-top: 4px;
    }
}

/* Estilos para la sección de leyenda de categorías */
.leyenda-categorias {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin: 30px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.leyenda-categorias h2 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.4em;
}

.leyenda-intro {
    color: #555;
    line-height: 1.6;
    margin-bottom: 25px;
    font-size: 0.95em;
}

.leyenda-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.leyenda-card {
    background: #f8f9fa;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.leyenda-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.leyenda-card.leyenda-binaria {
    grid-column: 1 / -1;
}

.leyenda-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
}

.leyenda-var {
    font-weight: 600;
    font-size: 1.05em;
}

.leyenda-var code {
    background: rgba(255,255,255,0.15);
    padding: 2px 8px;
    border-radius: 4px;
    color: white;
}

.leyenda-tipo {
    font-size: 0.75em;
    padding: 3px 12px;
    border-radius: 20px;
    font-weight: 600;
    text-transform: uppercase;
}

.leyenda-tipo.categórico {
    background: #f39c12;
    color: white;
}

.leyenda-tipo.binario {
    background: #3498db;
    color: white;
}

.leyenda-body {
    padding: 15px;
}

.leyenda-tabla {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

.leyenda-tabla thead {
    background: #e9ecef;
}

.leyenda-tabla th {
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
}

.leyenda-tabla td {
    padding: 7px 12px;
    border-bottom: 1px solid #f1f3f5;
}

.leyenda-tabla tr:hover {
    background: #f1f3f5;
}

.codigo {
    display: inline-block;
    background: #e9ecef;
    padding: 2px 10px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85em;
    color: #2c3e50;
}

/* Estilos para variables binarias */
.leyenda-binaria-info {
    background: #e8f4fd;
    padding: 10px 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 0.95em;
    border-left: 4px solid #3498db;
}

.leyenda-binaria-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 8px;
    margin-bottom: 15px;
}

.binaria-item {
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    background: white;
    border-radius: 6px;
    border-left: 3px solid #3498db;
    transition: all 0.2s ease;
}

.binaria-item:hover {
    background: #f8f9fa;
    transform: translateX(3px);
}

.binaria-item.destacada {
    border-left-color: #e74c3c;
    background: #fdf2f2;
}

.binaria-item.destacada:hover {
    background: #fce4e4;
}

.binaria-var {
    font-weight: 600;
    font-size: 0.9em;
    color: #2c3e50;
}

.binaria-var code {
    background: #f1f3f5;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}

.binaria-desc {
    font-size: 0.85em;
    color: #666;
    margin-top: 2px;
}

.leyenda-nota {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #fff8e1;
    padding: 12px 15px;
    border-radius: 6px;
    border-left: 4px solid #f39c12;
    margin-top: 10px;
}

.leyenda-nota .nota-icon {
    font-size: 1.2em;
    flex-shrink: 0;
}

.leyenda-nota p {
    margin: 0;
    font-size: 0.9em;
    color: #555;
}

/* Resumen de la leyenda */
.leyenda-resumen {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 10px;
    padding: 20px;
}

.leyenda-resumen .resumen-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: white;
    padding: 12px 15px;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.leyenda-resumen .resumen-icon {
    font-size: 1.5em;
    flex-shrink: 0;
}

.leyenda-resumen ul {
    margin: 5px 0 0 0;
    padding-left: 18px;
}

.leyenda-resumen ul li {
    font-size: 0.85em;
    margin: 2px 0;
    color: #555;
}

/* Responsive */
@media (max-width: 768px) {
    .leyenda-grid {
        grid-template-columns: 1fr;
    }
    
    .leyenda-binaria-grid {
        grid-template-columns: 1fr;
    }
    
    .leyenda-resumen {
        grid-template-columns: 1fr;
    }
    
    .leyenda-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}

/* Estilos para la comparación horizontal de métricas */
.metrics-comparison-horizontal {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 20px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.metrics-card {
    flex: 1;
    min-width: 280px;
    max-width: 450px;
    padding: 20px 25px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.metrics-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.metrics-card h4 {
    text-align: center;
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 1.1em;
    letter-spacing: 0.5px;
}

/* Estilos para las filas horizontales de métricas */
.metrics-row-horizontal {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.metric-horizontal {
    flex: 1;
    min-width: 80px;
    text-align: center;
    padding: 10px 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.metric-horizontal:hover {
    background: #f8f9fa;
}

.metric-horizontal .metric-value {
    font-size: 1.8em;
    font-weight: bold;
    color: #2c3e50;
    line-height: 1.2;
}

.metric-horizontal .metric-label {
    font-size: 0.8em;
    color: #7f8c8d;
    margin-top: 4px;
    line-height: 1.4;
}

/* Estilos específicos para cada tarjeta */
.original-metrics {
    border-top: 4px solid #3498db;
}

.original-metrics .metric-horizontal .metric-value {
    color: #2980b9;
}

.synthetic-metrics {
    border-top: 4px solid #2ecc71;
}

.synthetic-metrics .metric-horizontal .metric-value {
    color: #27ae60;
}

.best-metrics {
    background: linear-gradient(135deg, #f8fff8, #e8f5e9);
    border: 2px solid #2ecc71;
    position: relative;
}

.best-badge {
    position: absolute;
    top: -12px;
    right: -12px;
    background: #f39c12;
    color: white;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.7em;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(243, 156, 18, 0.4);
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Métricas mejoradas */
.metric-horizontal.improved {
    background: rgba(46, 204, 113, 0.08);
    border-radius: 8px;
    padding: 8px 12px;
    border: 1px solid rgba(46, 204, 113, 0.15);
}

.metric-horizontal.improved:hover {
    background: rgba(46, 204, 113, 0.15);
}

.improvement-badge {
    display: inline-block;
    font-size: 0.7em;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 4px;
    font-weight: bold;
    white-space: nowrap;
}

.improvement-badge.positive {
    background: #d5f5e3;
    color: #27ae60;
}

.improvement-badge.negative {
    background: #fadbd8;
    color: #e74c3c;
}

/* Flecha de mejora horizontal */
.improvement-arrow-horizontal {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    color: #2ecc71;
    flex-shrink: 0;
}

.improvement-arrow-horizontal .arrow-icon {
    font-size: 2em;
    line-height: 1;
}

.improvement-arrow-horizontal .improvement-label {
    font-size: 0.7em;
    color: #27ae60;
    font-weight: bold;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Versión responsiva */
@media (max-width: 768px) {
    .metrics-comparison-horizontal {
        flex-direction: column;
        align-items: center;
        gap: 25px;
    }
    
    .metrics-card {
        max-width: 100%;
        width: 100%;
        min-width: 0;
    }
    
    .metrics-row-horizontal {
        justify-content: center;
        gap: 15px;
    }
    
    .metric-horizontal {
        min-width: 70px;
        flex: 0 1 auto;
    }
    
    .metric-horizontal .metric-value {
        font-size: 1.5em;
    }
    
    .improvement-arrow-horizontal {
        flex-direction: row;
        gap: 10px;
        padding: 5px 0;
    }
    
    .improvement-arrow-horizontal .arrow-icon {
        transform: rotate(90deg);
    }
    
    .best-badge {
        top: -10px;
        right: -10px;
        font-size: 0.6em;
        padding: 4px 10px;
    }
}

@media (max-width: 480px) {
    .metrics-row-horizontal {
        flex-direction: column;
        gap: 8px;
    }
    
    .metric-horizontal {
        width: 100%;
    }
    
    .metrics-card {
        padding: 15px;
    }
}

/* Estilos para la sección de eficacia predictiva */
.predictive-performance {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin: 30px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.predictive-performance h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.4em;
}

.performance-intro {
    color: #555;
    line-height: 1.6;
    margin-bottom: 25px;
    font-size: 0.95em;
}

.performance-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    align-items: stretch;
    margin-bottom: 30px;
}

.performance-card {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #e9ecef;
    position: relative;
    transition: all 0.3s ease;
}

.performance-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.performance-card h4 {
    text-align: center;
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 1.1em;
}

.original-performance {
    border-top: 4px solid #3498db;
}

.synthetic-performance {
    border-top: 4px solid #2ecc71;
}

.best-performance {
    background: linear-gradient(135deg, #f8fff8, #e8f5e9);
    border: 2px solid #2ecc71;
}

.best-badge {
    position: absolute;
    top: -12px;
    right: -12px;
    background: #f39c12;
    color: white;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.7em;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(243, 156, 18, 0.4);
}

/* Tablas de rendimiento */
.performance-table-container {
    overflow-x: auto;
    margin-bottom: 15px;
}

.performance-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
}

.performance-table thead {
    background: #2c3e50;
    color: white;
}

.performance-table th {
    padding: 8px 10px;
    text-align: center;
    font-weight: 600;
}

.performance-table td {
    padding: 6px 10px;
    text-align: center;
    border-bottom: 1px solid #e9ecef;
}

.performance-table tbody tr:hover {
    background: #f1f3f5;
}

.performance-table tfoot tr {
    background: #e9ecef;
    font-weight: 600;
}

.performance-table tfoot td {
    padding: 6px 10px;
}

.class-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
}

.class-0 {
    background: #d5f5e3;
    color: #27ae60;
}

.class-1 {
    background: #fadbd8;
    color: #e74c3c;
}

.improved-row {
    background: #f0fff4;
}

.improvement-indicator {
    display: inline-block;
    font-size: 0.75em;
    font-weight: bold;
    color: #27ae60;
    margin-left: 4px;
}

/* Flecha de mejora */
.performance-arrow {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    color: #2ecc71;
    flex-shrink: 0;
}

.performance-arrow .arrow-icon {
    font-size: 2.5em;
    line-height: 1;
}

.performance-arrow .arrow-label {
    font-size: 0.8em;
    color: #27ae60;
    font-weight: bold;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.arrow-improvements {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 5px;
}

.improvement-tag {
    font-size: 0.65em;
    background: #d5f5e3;
    color: #27ae60;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
    font-weight: 600;
}

/* Resumen de métricas */
.performance-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.summary-item {
    text-align: center;
    padding: 8px;
    background: white;
    border-radius: 6px;
}

.summary-item.improved {
    background: #f0fff4;
    border: 1px solid #a9dfbf;
}

.summary-label {
    display: block;
    font-size: 0.75em;
    color: #7f8c8d;
    margin-bottom: 2px;
}

.summary-value {
    display: block;
    font-size: 1.3em;
    font-weight: bold;
    color: #2c3e50;
}

.improvement-badge {
    display: inline-block;
    font-size: 0.6em;
    padding: 2px 8px;
    border-radius: 12px;
    margin-top: 2px;
    font-weight: bold;
}

.improvement-badge.positive {
    background: #d5f5e3;
    color: #27ae60;
}

/* Resumen de mejoras */
.improvements-summary {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-top: 10px;
}

.improvements-summary h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.05em;
    text-align: center;
}

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

.improvement-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.improvement-icon {
    font-size: 1.8em;
    flex-shrink: 0;
}

.improvement-bar {
    margin-top: 5px;
}

.bar-label {
    font-size: 0.75em;
    color: #7f8c8d;
    margin: 3px 0;
}

.bar-container {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin: 2px 0;
}

.bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.improvement-value {
    display: inline-block;
    font-size: 0.8em;
    font-weight: bold;
    color: #27ae60;
    margin-top: 2px;
}

/* Responsive */
@media (max-width: 992px) {
    .performance-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .performance-arrow {
        flex-direction: row;
        padding: 5px 0;
    }
    
    .performance-arrow .arrow-icon {
        transform: rotate(90deg);
    }
    
    .arrow-improvements {
        flex-direction: row;
        margin-top: 0;
        margin-left: 10px;
    }
}

@media (max-width: 768px) {
    .performance-summary {
        grid-template-columns: 1fr;
    }
    
    .improvements-grid {
        grid-template-columns: 1fr;
    }
    
    .performance-table {
        font-size: 0.75em;
    }
    
    .improvement-tag {
        font-size: 0.55em;
    }
}

@media (max-width: 480px) {
    .predictive-performance {
        padding: 15px;
    }
    
    .performance-card {
        padding: 12px;
    }
}

.fuente-section ul {
    color: #000; 
    font-size: 0.9rem; 
    line-height: 1.6; 
    padding-left: 1.2rem;    
}

.transformacion-card p {
    margin-top: 15px; 
    font-style: italic; 
    color: #555;
}