/**
 * Estilos para contenido extraído de PDFs
 * Incluye tablas, secciones y formato mejorado
 */

/* Tablas extraídas */
.extracted-table {
    margin: 20px 0;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #ddd;
    overflow-x: auto;
}

.extracted-table table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.extracted-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.extracted-table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 0.95em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.extracted-table th:last-child {
    border-right: none;
}

.extracted-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    font-size: 0.9em;
    line-height: 1.5;
}

.extracted-table tbody tr:hover {
    background: #f5f7fa;
}

.extracted-table tbody tr:last-child td {
    border-bottom: none;
}

/* Alternancia de colores en filas */
.extracted-table tbody tr:nth-child(even) {
    background: #fafbfc;
}

/* Indicador de tipo de tabla */
.extracted-table::before {
    content: "📊 Tabla extraída del PDF";
    display: block;
    font-size: 0.85em;
    color: #666;
    margin-bottom: 10px;
    font-weight: 500;
}

/* Contenido de sección mejorado */
.section-content {
    line-height: 1.8;
    color: #333;
}

.section-text {
    margin: 10px 0;
    padding: 8px 0;
}

.section-text p {
    margin: 8px 0;
}

/* Subtítulos y encabezados dentro de secciones */
.subsection {
    margin: 15px 0 10px 0;
    padding: 8px 12px;
    background: #f0f4f8;
    border-left: 4px solid #667eea;
    border-radius: 4px;
    font-weight: 600;
    color: #2d3748;
}

.subsection-title {
    margin: 12px 0 8px 0;
    padding: 6px 0;
    font-weight: 600;
    color: #4a5568;
    text-transform: uppercase;
    font-size: 0.9em;
    letter-spacing: 0.5px;
}

/* Listas numeradas */
.numbered-point {
    margin: 8px 0 8px 20px;
    padding-left: 10px;
    position: relative;
}

.numbered-point strong {
    color: #667eea;
    margin-right: 5px;
}

/* Viñetas */
.bullet-point {
    margin: 8px 0 8px 20px;
    padding-left: 10px;
    position: relative;
}

.bullet-point::before {
    content: "•";
    position: absolute;
    left: -10px;
    color: #667eea;
    font-weight: bold;
}

/* Pares clave-valor */
.key-value {
    margin: 10px 0;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 4px;
    display: flex;
    flex-wrap: wrap;
}

.key-value strong {
    color: #4a5568;
    margin-right: 8px;
    min-width: 150px;
}

/* Secciones vacías */
.empty-section {
    padding: 20px;
    text-align: center;
    color: #a0aec0;
    font-style: italic;
    background: #f7fafc;
    border-radius: 8px;
    border: 2px dashed #cbd5e0;
}

/* Contenido por defecto de la base de datos */
.default-content {
    padding: 15px;
    background: #fffaf0;
    border: 1px solid #fbd38d;
    border-radius: 8px;
    margin: 10px 0;
}

.default-content::before {
    content: "ℹ️ Información de la base de datos (no extraída del PDF)";
    display: block;
    font-size: 0.85em;
    color: #975a16;
    margin-bottom: 10px;
    font-weight: 600;
}

.default-content ul {
    margin: 10px 0;
    padding-left: 20px;
}

.default-content li {
    margin: 5px 0;
    color: #744210;
}

/* Indicadores de confianza de extracción */
.extraction-confidence {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    margin-left: 10px;
}

.confidence-high {
    background: #c6f6d5;
    color: #22543d;
}

.confidence-medium {
    background: #feebc8;
    color: #7c2d12;
}

.confidence-low {
    background: #fed7d7;
    color: #742a2a;
}

/* Metadatos de extracción */
.extraction-metadata {
    margin: 20px 0;
    padding: 15px;
    background: #edf2f7;
    border-radius: 8px;
    border-left: 4px solid #4299e1;
    font-size: 0.9em;
}

.extraction-metadata h4 {
    margin: 0 0 10px 0;
    color: #2d3748;
    font-size: 1em;
}

.extraction-metadata ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.extraction-metadata li {
    margin: 5px 0;
    color: #4a5568;
}

.extraction-metadata li strong {
    color: #2d3748;
    margin-right: 5px;
}

/* Estadísticas de extracción */
.extraction-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.stat-item {
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.stat-value {
    font-size: 2em;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.85em;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Indicador de OCR utilizado */
.ocr-indicator {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: #e6fffa;
    border: 1px solid #81e6d9;
    border-radius: 6px;
    font-size: 0.85em;
    color: #234e52;
    margin: 10px 0;
}

.ocr-indicator::before {
    content: "🔍";
    margin-right: 8px;
    font-size: 1.2em;
}

/* Responsive */
@media (max-width: 768px) {
    .extracted-table {
        padding: 10px;
    }
    
    .extracted-table th,
    .extracted-table td {
        padding: 8px 10px;
        font-size: 0.85em;
    }
    
    .key-value {
        flex-direction: column;
    }
    
    .key-value strong {
        min-width: auto;
        margin-bottom: 4px;
    }
    
    .extraction-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Modo oscuro */
@media (prefers-color-scheme: dark) {
    .extracted-table {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .extracted-table table {
        background: #1a202c;
    }
    
    .extracted-table tbody tr:nth-child(even) {
        background: #2d3748;
    }
    
    .extracted-table tbody tr:hover {
        background: #4a5568;
    }
    
    .extracted-table td {
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    .section-content {
        color: #e2e8f0;
    }
    
    .subsection {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .key-value {
        background: #2d3748;
    }
    
    .empty-section {
        background: #2d3748;
        border-color: #4a5568;
        color: #718096;
    }
    
    .default-content {
        background: #2d3748;
        border-color: #f6ad55;
    }
    
    .extraction-metadata {
        background: #2d3748;
        border-color: #4299e1;
    }
    
    .extraction-metadata h4,
    .extraction-metadata li strong {
        color: #e2e8f0;
    }
    
    .extraction-metadata li {
        color: #cbd5e0;
    }
    
    .stat-item {
        background: #2d3748;
    }
}

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

.extracted-table,
.extraction-metadata {
    animation: fadeIn 0.3s ease-out;
}
