/* Open Sans Regular (400) */
@font-face {
    font-family: 'Open Sans';
    font-style: normal;
    font-weight: 400;
    font-stretch: 100%;
    font-display: swap;
    src: url('fonts/OpenSans-Regular.woff2') format('woff2');
}

/* Open Sans Semi-Bold (600) */
@font-face {
    font-family: 'Open Sans';
    font-style: normal;
    font-weight: 600;
    font-stretch: 100%;
    font-display: swap;
    src: url('fonts/OpenSans-SemiBold.woff2') format('woff2');
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Open Sans', sans-serif;
}

body {
    font-family: 'Open Sans', sans-serif;
    background-color: #f5f5f5;
    font-size: 13px;
    padding-top: 42px;
    margin: 0;
    color: #333;
}

/* Fixed Header */
.custom-header {
    background-color: #8A2422;
    height: 42px;
    color: white;
    font-family: 'Open Sans', sans-serif;
    font-size: 18px;
    font-weight: 400;
    display: flex;
    align-items: center;
    width: 100%;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
}

.header-content {
    width: 100%;
    max-width: calc(100% - 30px);
    margin: 0 auto;
    padding: 0 15px;
    box-sizing: border-box;
}

.header-wrapper {
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.ku-title-link {
    color: white;
    text-decoration: none;
    font-size: 18px;
    font-weight: 400;
    transition: all 0.3s ease;
}

.ku-title-link strong {
    font-weight: 700;
    letter-spacing: -0.5px;
}

.ku-title-link:hover {
    color: white;
    text-decoration: none;
}

/* AI Usage Modal - Better vertical centering and wider for readability */
#aiUsageModal .modal-content {
    margin: 50px auto;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    max-width: 850px;
}

/* Infographic Modal */
#infographicModal .modal-content {
    max-width: 90%;
    width: auto;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 10px;
    margin: 2% auto;
    /* Tweak margin for better centering */
    max-height: 90vh;
    /* Add a max-height to prevent overflow on smaller screens */
    display: flex;
    /* Use flexbox to center the image */
    align-items: center;
    justify-content: center;
}

#infographic-thumbnail {
    width: 100%;
    margin-bottom: 20px;
    cursor: pointer;
}

#infographic-large {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

#infographicModal .modal-close {
    color: #fff;
    text-shadow: 0 0 5px #000;
    opacity: 0.9;
    font-size: 40px;
    line-height: 30px;
}

#infographicModal .modal-close:hover {
    color: #ddd;
}

/* Container */
.container {
    max-width: calc(100% - 30px);
    margin: 0 auto;
    padding: 0 15px;
    box-sizing: border-box;
}

header {
    display: none;
    /* Hide the old header since we have fixed header now */
}

main {
    background: #f5f5f5;
    padding: 25px 35px;
    margin-top: 20px;
    margin-bottom: 20px;
    border: none;
    box-shadow: none;
}

/* Search Section */
.search-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .search-section {
        grid-template-columns: 1fr;
    }
}

.search-box {
    background: white;
    padding: 25px;
    border: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.search-box h2 {
    color: #8A2422;
    margin-bottom: 10px;
    font-size: 1.5rem;
    font-weight: 600;
}

.description {
    color: #6c757d;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

/* Input Group */
.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.autocomplete-wrapper {
    flex: 1;
    position: relative;
}

.input-group input {
    width: 100%;
    padding: 0 16px;
    border: 1px solid #000000;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    height: 40px;
    line-height: 40px;
}

.input-group input::-webkit-calendar-picker-indicator {
    display: none;
}

.input-group input::-webkit-list-button {
    display: none;
}

.input-group input:focus {
    outline: none;
    border-color: #8A2422;
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #000000;
    border-top: none;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 100;
}

.autocomplete-dropdown.show {
    display: block;
}

.autocomplete-item {
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid #e9ecef;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background: #f8f9fa;
}

.autocomplete-item.selected {
    background: #8A2422;
    color: white;
}

.autocomplete-no-results {
    padding: 10px 16px;
    color: #6c757d;
    font-style: italic;
}

.input-group button {
    padding: 0 30px;
    background: #8A2422;
    color: white;
    border: none;
    height: 40px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.input-group button:hover {
    background: #6A1C1A;
}

.input-group button:active {
    background: #6A1C1A;
}

.examples {
    font-size: 0.85rem;
    color: #6c757d;
    font-style: italic;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #8A2422;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Results */
.results {
    margin-top: 30px;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 3px solid #8A2422;
}

.results-header h2 {
    color: #8A2422;
    font-size: 1.8rem;
    font-weight: 600;
}

.close-btn {
    background: #e9ecef;
    border: none;
    padding: 8px 16px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #495057;
    font-weight: 500;
}

.close-btn:hover {
    background: #dc3545;
    color: white;
}

/* Theme Card */
.theme-card {
    background: white;
    padding: 25px;
    margin-bottom: 25px;
    border-left: 5px solid #8A2422;
}

.theme-card h3 {
    color: #8A2422;
    margin-bottom: 15px;
    font-size: 1.4rem;
    font-weight: 600;
}

.theme-card .description {
    margin-bottom: 20px;
    line-height: 1.6;
}

/* Researcher List */
.researcher-list {
    margin-bottom: 20px;
}

.researcher-list h4 {
    color: #495057;
    margin-bottom: 10px;
    font-size: 1rem;
    font-weight: 600;
}

.researcher-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    background: #8A2422;
    color: white;
    padding: 6px 12px;
    font-size: 0.85rem;
}

.tag a {
    color: white;
    text-decoration: none;
}

.tag a:hover {
    text-decoration: underline;
}

/* Papers List */
.papers-list h4 {
    color: #495057;
    margin-bottom: 10px;
    font-size: 1rem;
    font-weight: 600;
}

.paper-item {
    background: #f8f9fa;
    padding: 15px;
    margin-bottom: 10px;
    border: 1px solid #dee2e6;
}

.paper-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.paper-meta {
    font-size: 0.9rem;
    color: #6c757d;
}

/* Collaborator Section */
.collaborator-section {
    margin-bottom: 30px;
}

.collaborator-section h3 {
    color: #8A2422;
    margin-bottom: 20px;
    font-size: 1.5rem;
    font-weight: 600;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 10px;
}

.collaborator-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

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

.collaborator-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

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

/* Badges */
.rank-badge {
    background: #8A2422;
    color: white;
    padding: 4px 10px;
    font-weight: 600;
    font-size: 0.9rem;
}

.similarity-badge {
    background: #e9ecef;
    padding: 4px 10px;
    font-size: 0.85rem;
    color: #495057;
}

.theme-badge {
    background: #ffc107;
    color: #333;
    padding: 4px 10px;
    font-size: 0.85rem;
}

.explanation {
    color: #6c757d;
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Error */
.error {
    background: #f8d7da;
    border: 2px solid #f5c2c7;
    padding: 20px;
    margin-top: 20px;
    text-align: center;
}

.error h3 {
    color: #842029;
    margin-bottom: 10px;
    font-weight: 600;
}

.error p {
    color: #58151c;
    margin-bottom: 15px;
}

.error button {
    background: #dc3545;
    color: white;
    border: none;
    padding: 10px 25px;
    cursor: pointer;
    font-size: 1rem;
}

.error button:hover {
    background: #bb2d3b;
}

/* Footer */
footer {
    text-align: center;
    color: #666;
    margin-top: 30px;
    padding: 20px;
    font-size: 0.9rem;
}

/* Raw Output */
.raw-output {
    background: #f8f9fa;
    padding: 20px;
    border-left: 4px solid #6c757d;
    white-space: pre-wrap;
    font-family: monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Link styles */
a {
    color: #8A2422;
    text-decoration: none;
    transition: all 0.2s ease;
}

a:hover {
    color: #6A1C1A;
    text-decoration: underline;
}

/* Result name links - show underline by default to indicate clickable profile */
.result-name a {
    color: #8A2422;
    text-decoration: underline;
    font-weight: inherit;
}

.result-name a:hover {
    color: #6A1C1A;
}

.paper-title a {
    color: #333;
    font-weight: 600;
}

.paper-title a:hover {
    color: #8A2422;
}

/* Author highlighting */
.author-highlight {
    background-color: #8A2422;
    color: white;
    padding: 2px 8px;
    font-weight: 500;
}

.author-highlight a {
    color: white;
    text-decoration: none;
}

.author-highlight a:hover {
    color: white;
    text-decoration: underline;
}

/* Visualization Button on Landing Page */
.viz-button-container {
    margin-top: 30px;
    text-align: center;
}

.viz-button {
    display: inline-block;
    background: white;
    padding: 20px 40px;
    text-decoration: none;
    color: #8A2422;
    transition: all 0.3s ease;
    border: 2px solid #8A2422;
}

.viz-button:hover {
    background: #8A2422;
    color: white;
    text-decoration: none;
}

.viz-button-text {
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.viz-button-desc {
    display: block;
    font-size: 0.9rem;
    font-weight: 400;
}

/* UMAP Mini Visualization */
.umap-mini-section {
    background: white;
    padding: 25px;
    margin-bottom: 30px;
    border-left: 5px solid #8A2422;
}

.umap-mini-header h3 {
    color: #8A2422;
    margin-bottom: 10px;
    font-size: 1.4rem;
    font-weight: 600;
}

.umap-mini-header .description {
    margin-bottom: 20px;
}

.umap-mini-plot {
    width: 100%;
    height: 450px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

.umap-mini-plot>div {
    width: 100% !important;
    height: 100% !important;
    box-sizing: border-box;
}

.umap-error {
    color: #6c757d;
    font-style: italic;
    padding: 20px;
    text-align: center;
}

/* Contact Link in Header */
.contact-link {
    color: white;
    text-decoration: none;
    font-size: 14px;
    margin-left: auto;
    padding: 5px 15px;
    border: 1px solid white;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.contact-link:hover {
    background-color: white;
    color: #8A2422;
}

/* Voting Buttons */
.vote-buttons {
    display: flex;
    gap: 5px;
}

.vote-btn {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #666;
}

/* Upvote button - green theme */
.vote-btn.vote-up {
    border-color: #d4edda;
}

.vote-btn.vote-up:hover {
    border-color: #28a745;
    background: #f1f9f3;
}

.vote-btn.vote-up .vote-arrow {
    font-size: 10px;
    color: #28a745;
    font-weight: bold;
}

.vote-btn.vote-up.active {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

.vote-btn.vote-up.active .vote-arrow {
    color: white;
}

.vote-btn.vote-up:hover:not(.active) .vote-arrow {
    transform: translateY(-1px);
}

/* Downvote button - red theme */
.vote-btn.vote-down {
    border-color: #f8d7da;
}

.vote-btn.vote-down:hover {
    border-color: #dc3545;
    background: #fef5f6;
}

.vote-btn.vote-down .vote-arrow {
    font-size: 10px;
    color: #dc3545;
    font-weight: bold;
}

.vote-btn.vote-down.active {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

.vote-btn.vote-down.active .vote-arrow {
    color: white;
}

.vote-btn.vote-down:hover:not(.active) .vote-arrow {
    transform: translateY(1px);
}

.vote-count {
    font-size: 12px;
    font-weight: 600;
    min-width: 16px;
    text-align: center;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border: 1px solid #dee2e6;
    width: 90%;
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    line-height: 20px;
    cursor: pointer;
}

.modal-close:hover,
.modal-close:focus {
    color: #000;
}

.modal-content h2 {
    color: #8A2422;
    margin-bottom: 20px;
}

.modal-content>p {
    color: #6c757d;
    margin-bottom: 20px;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 14px;
    font-family: 'Open Sans', sans-serif;
}

.form-group textarea {
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #8A2422;
    box-shadow: 0 0 0 2px rgba(138, 36, 34, 0.1);
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.btn-primary,
.btn-secondary {
    padding: 10px 25px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: #8A2422;
    color: white;
}

.btn-primary:hover {
    background-color: #6d1c1a;
}

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

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

.success-message {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 15px;
    border-radius: 4px;
    text-align: center;
}

.success-message p {
    margin: 0;
    font-weight: 600;
}

/* Author Visualization Button */
.author-viz-button:hover {
    background: #6A1C1A !important;
    color: white;
    text-decoration: none;
}