* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', Roboto, sans-serif; background: #f5f9fc; color: #1e293b; line-height: 1.5; padding: 24px 20px; }
.app-container { max-width: 1400px; margin: 0 auto; }
.hero { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 28px; padding: 20px 32px; margin-bottom: 28px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 20px; }
.logo-container { flex: 1; }
.app-logo { max-width: 500px; width: 100%; height: auto; display: block; }
.author-badge { text-align: right; background: #f0f4f8; padding: 3px 16px; border-radius: 60px; border: 1px solid #e2e8f0; }
.author-badge .name { font-size: 0.80rem; font-weight: 500; color: #1e293b; }
.author-badge .name a { color: #4f8bc9; text-decoration: none; }
.author-badge .name a:hover { text-decoration: underline; }
.search-container { background: white; padding: 12px 28px; border-radius: 24px; margin-bottom: 28px; border: 1px solid #e2e8f0; }
#searchBox { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
#query { flex: 2; padding: 6px 18px; border: 1px solid #cbd5e1; border-radius: 40px; font-size: 0.9rem; }
#query:focus { outline: none; border-color: #4f8bc9; box-shadow: 0 0 0 3px rgba(79,139,201,0.1); }
button { padding: 10px 24px; border: none; border-radius: 40px; cursor: pointer; font-size: 0.85rem; font-weight: 500; color: white; }
#searchButton { background-color: #4f8bc9; }
#searchButton:hover { background-color: #3a6fa8; transform: translateY(-1px); }
#downloadButton { background-color: #5a9e7a; }
#downloadButton:hover:not(:disabled) { background-color: #458a66; transform: translateY(-1px); }
#downloadGEXF { background-color: #7a6aa5; }
#downloadGEXF:hover:not(:disabled) { background-color: #655792; transform: translateY(-1px); }
#centerButton { background-color: #7a6aa5; }
#centerButton:hover:not(:disabled) { background-color: #655792; transform: translateY(-1px); }
#resetButton { background-color: #c06a6a; }
#resetButton:hover { background-color: #a85555; transform: translateY(-1px); }
button:disabled { background-color: #cbd5e1; cursor: not-allowed; opacity: 0.6; }
.controls { display: flex; justify-content: flex-start; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.control-group { display: flex; gap: 6px; align-items: center; background: #f8fafc; padding: 4px 10px; border-radius: 40px; border: 1px solid #e2e8f0; }
.control-group label { font-weight: 500; color: #334155; font-size: 0.7rem; }
select, input[type="number"] { padding: 4px 8px; border: 1px solid #cbd5e1; border-radius: 30px; background: white; font-size: 0.7rem; width: auto; }
#loading { text-align: center; padding: 40px; display: none; font-size: 1rem; color: #4f8bc9; }
#resultsInfo { margin: 16px 0; font-style: italic; color: #475569; text-align: center; }
#visualizationContainer { display: flex; gap: 24px; margin-bottom: 28px; flex-wrap: wrap; }

/* Contenedor de nube + gráfico - altura dinámica */
#wordCloudContainer {
    flex: 0.35;
    background: white;
    padding: 20px;
    border-radius: 24px;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.visualization-title { color: #1e293b; margin-bottom: 16px; text-align: center; font-size: 1.1rem; font-weight: 600; }
.wordcloud-wrapper { width: 100%; flex: 2; background: #fafcff; border-radius: 20px; display: flex; align-items: center; justify-content: center; min-height: 0; overflow: hidden; }
canvas.wordcloud-canvas { width: 100%; height: auto; max-width: 100%; max-height: 260px; object-fit: contain; }

/* Sección del gráfico */
.chart-section { margin-top: 12px; border: 1px solid #e2e8f0; border-radius: 12px; padding: 10px; background: #ffffff; }
.chart-title { font-size: 0.8rem; font-weight: 600; color: #1e293b; margin-bottom: 8px; text-align: center; }
.chart-container { width: 100%; display: flex; justify-content: center; align-items: center; }
#yearChart { max-width: 100%; height: auto; }

/* Contenedor de red - misma altura dinámica que el contenedor de nube */
#semanticNetworkContainer {
    flex: 0.65;
    background: white;
    padding: 20px;
    border-radius: 24px;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
.title-with-buttons { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; flex-shrink: 0; }
.title-with-buttons h3 { font-size: 1.1rem; font-weight: 600; margin: 0; }
.network-buttons { display: flex; gap: 8px; }
.network-buttons button { background-color: #e2e8f0; color: #1e293b; padding: 6px 14px; font-size: 0.75rem; border-radius: 40px; }
.network-buttons button:hover { background-color: #cbd5e1; }
#semanticNetwork { width: 100%; flex: 1; background-color: #ffffff; border: 1px solid #e2e8f0; border-radius: 16px; min-height: 0; overflow: hidden; }

#articlesTableContainer { background: white; padding: 20px; border-radius: 24px; overflow-x: auto; border: 1px solid #e2e8f0; }
table { width: 100%; border-collapse: collapse; font-size: 0.7rem; }
th, td { padding: 12px 10px; text-align: left; border-bottom: 1px solid #e2e8f0; }
th { background-color: #d1dbe8; color: #1e293b; font-weight: 600; }
.pmid-link { color: #4f8bc9; text-decoration: none; }
.delete-btn { background-color: #c06a6a; padding: 4px 12px; font-size: 0.7rem; }
.delete-btn:hover { background-color: #a85555; }
.pagination { display: flex; justify-content: center; gap: 12px; margin-top: 20px; }
.pagination button { background-color: #e2e8f0; color: #1e293b; padding: 6px 16px; }
.pagination button:hover:not(:disabled) { background-color: #cbd5e1; }
.tooltip { position: absolute; background: rgba(0,0,0,0.8); color: white; padding: 8px 12px; border-radius: 12px; font-size: 12px; pointer-events: none; z-index: 100; opacity: 0; transition: opacity 0.2s; }
.sortable-header { cursor: pointer; position: relative; padding-right: 20px; }
.sortable-header::after { content: "↑↓"; position: absolute; right: 5px; font-size: 12px; opacity: 0.7; }
.sortable-header.asc::after { content: "↑"; opacity: 1; }
.sortable-header.desc::after { content: "↓"; opacity: 1; }

/* Footer styles */
.custom-footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 3px solid #dce5ec;
}
.footer-line1 {
    font-size: 0.90rem;
    color: #2c6288;
    margin-bottom: 6px;
}
.footer-line1 a {
    color: #1b4a6e;
    text-decoration: none;
    font-weight: 500;
}
.footer-line1 a:hover {
    text-decoration: underline;
}
.footer-line2 {
    font-size: 0.70rem;
    color: #2c3e50;
    line-height: 1.4;
    max-width: 900px;
    margin: 0 auto 12px auto;
}
.footer-callout {
    background: #f0f6ff;
    border-left: 5px solid #1b4a6e;
    border-radius: 14px;
    padding: 10px 16px;
    max-width: 620px;
    margin: 10px auto 0 auto;
    box-shadow: 0 1px 6px rgba(0,0,0,0.03);
    text-align: center;
}
.callout-text {
    font-size: 0.75rem;
    color: #1e4a6e;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}
.callout-text a {
    color: #1b6b9e;
    text-decoration: none;
    font-weight: 700;
    border-bottom: 1px dashed #9bc0da;
}
.callout-text a:hover {
    color: #0b2f4e;
    border-bottom: 1px solid #0b2f4e;
}
.callout-icon {
    font-size: 1rem;
}

@media (max-width: 1100px) { .controls { justify-content: center; } }
@media (max-width: 900px) { #visualizationContainer { flex-direction: column; } #wordCloudContainer, #semanticNetworkContainer { flex: 1; min-height: 400px; } }
@media (max-width: 700px) { body { padding: 16px; } .hero { flex-direction: column; align-items: center; text-align: center; } .app-logo { max-width: 280px; } #searchBox { flex-direction: column; } button { padding: 8px 16px; } .title-with-buttons { flex-direction: column; align-items: center; } }