/* Inquisite Main Stylesheet */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --main-purple: #6366f1;
    --main-dark: #1f1f1f;
    --accent-purple: #4f46e5;
    --accent-light: #fafafa;
    --bg-soft: #F9F7F7;
    --hover-purple: #4f46e5;
    --border-light: #e5e7eb;
    --text-secondary: #6b7280;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.07);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Helvetica Neue', 'Arial', sans-serif;
    background: #ffffff;
    color: var(--main-dark);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: var(--bg-soft);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-light);
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.25s ease;
}

.sidebar.collapsed {
    width: 60px;
}

.sidebar-header {
    padding: 1.5rem 1.25rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.sidebar.collapsed .sidebar-header {
    padding: 1.25rem 0 1rem;
    flex-direction: column;
    gap: 0.75rem;
}

.sidebar-toggle-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.375rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--main-dark);
}

.sidebar-toggle-btn i {
    font-size: 0.75rem;
    transition: transform 0.25s ease;
}

.sidebar.collapsed .sidebar-toggle-btn i {
    transform: rotate(180deg);
}

.sidebar.collapsed .sidebar-logo-full {
    display: none !important;
}

.sidebar.collapsed .sidebar-logo-icon {
    display: block !important;
}

.sidebar-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.sidebar-section-header .sidebar-title {
    flex: 1;
}

.sidebar-section-icon {
    display: none;
    font-size: 1rem;
    color: var(--text-secondary);
    flex-shrink: 0;
    width: 28px;
    text-align: center;
}

.sidebar.collapsed .sidebar-section-icon {
    display: block;
    cursor: pointer;
    padding: 0.5rem 0;
}

.sidebar.collapsed .sidebar-section-icon:hover {
    color: var(--main-dark);
}

/* Hide text elements when collapsed */
.sidebar.collapsed .sidebar-text {
    display: none !important;
}

.sidebar.collapsed .new-search-btn {
    padding: 0.5rem 0.75rem 1rem;
}

.sidebar.collapsed .new-search-btn button {
    padding: 0.625rem;
    justify-content: center;
}

.sidebar.collapsed .sidebar-section {
    padding: 0 0.75rem;
    display: block !important;
}

.sidebar.collapsed .sidebar-section-header {
    justify-content: center;
    margin-bottom: 0;
}

.sidebar.collapsed .sidebar-footer {
    padding: 0.5rem;
}

.sidebar.collapsed .user-menu {
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem 0.25rem;
}

.sidebar.collapsed .user-name {
    display: none;
}

.sidebar.collapsed .user-avatar {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
}

.sidebar.collapsed .auth-buttons-sidebar {
    padding: 0.25rem;
    gap: 0.25rem;
}

.sidebar.collapsed .auth-buttons-sidebar .btn {
    padding: 0.5rem 0.25rem;
    font-size: 0.625rem;
}

.sidebar-content {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.sidebar-section {
    padding: 0 1rem;
    margin-bottom: 1.5rem;
    display: none;
}

.sidebar-section.active {
    display: block;
}

.sidebar-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    padding: 0 0.25rem;
}

.sidebar-history-item {
    padding: 0.75rem;
    margin-bottom: 0.25rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.sidebar-history-item:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.sidebar-history-query {
    font-size: 0.875rem;
    color: var(--main-dark);
    margin-bottom: 0.25rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-history-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.sidebar-empty {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem 1.5rem;
    text-align: center;
}

.new-search-btn {
    display: block;
    padding: 0.5rem 1rem 1rem;
}

.new-search-btn button {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.new-search-btn button:hover {
    background: var(--accent-light);
    color: var(--main-dark);
    border-color: #d1d5db;
}

.new-search-btn button:active {
    transform: scale(0.98);
}

.new-search-btn button i {
    font-size: 0.75rem;
}

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--border-light);
}

.auth-buttons-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
}

.btn-block {
    width: 100%;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 240px;
    min-height: 100vh;
    overflow-x: hidden;
    width: calc(100vw - 240px);
    transition: margin-left 0.25s ease, width 0.25s ease;
}

body.sidebar-collapsed .main-content {
    margin-left: 60px;
    width: calc(100vw - 60px);
}

.user-info {
    display: none;
}

.user-info.active {
    display: block;
}

/* User Menu */
.user-menu {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.user-menu:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.user-name {
    flex: 1;
    overflow: hidden;
}

.user-name-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--main-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-email-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* User Avatar */
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5b4ddb 0%, #6366f1 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    user-select: none;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
    flex-shrink: 0;
}

/* User Dropdown */
.user-dropdown {
    position: absolute;
    bottom: calc(100% + 0.5rem);
    left: 0.5rem;
    right: 0.5rem;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.user-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.875rem;
    color: var(--main-dark);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-dropdown-item:first-child {
    border-radius: 8px 8px 0 0;
}

.user-dropdown-item:last-child {
    border-radius: 0 0 8px 8px;
}

.user-dropdown-item:hover {
    background-color: var(--accent-light);
}

.user-dropdown-item:active {
    background-color: #efefef;
}

.user-dropdown-divider {
    height: 1px;
    background-color: var(--border-light);
    margin: 0.25rem 0;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--main-purple);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-purple);
}

.btn-secondary {
    background-color: transparent;
    color: var(--main-dark);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover {
    background-color: var(--accent-light);
}

.btn-logout {
    background-color: transparent;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-logout:hover {
    background-color: var(--accent-light);
    color: var(--main-dark);
}

/* Layout */
.container {
    /* max-width: 1400px; */
    margin: 0 auto;
    padding: 2rem 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Search Section */
.search-section {
    width: 100%;
    max-width: none;
}

/* Project Section */
.project-section {
    width: 100%;
    margin: 0;
    animation: fadeIn 0.3s ease;
}

.project-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 2rem;
}

.project-title-section {
    flex: 1;
    min-width: 0;
}

.project-title-section h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--main-dark);
    margin: 0;
    line-height: 1.2;
}

.project-title-section p {
    margin: 0.25rem 0 0 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.project-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-shrink: 0;
}

.project-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
}

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

.hero-content {
    text-align: center;
    padding: 0 2rem 2.5rem;
    background: transparent;
    color: var(--main-dark);
}

.hero-content p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin: 0 auto;
    line-height: 1.5;
    font-weight: 400;
}

/* Search Container */
.search-container {
    position: relative;
    background: white;
    /* border: 1px solid var(--border-light); */
    border: 1px solid var(--main-purple);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    border-radius: 16px;
    padding: 1rem 1.5rem;
    margin: 0 4rem;
    transition: all 0.2s ease;
    width: calc(100% - 8rem);
}

.search-container:focus-within {
    border-color: var(--main-purple);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-input {
    width: 100%;
    min-height: 24px;
    max-height: 200px;
    padding: 0.5rem 0;
    font-size: 1rem;
    border: none;
    background: transparent;
    resize: none;
    font-family: inherit;
    line-height: 1.5;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #d1d5db transparent;
}

.search-input::-webkit-scrollbar {
    width: 6px;
}

.search-input::-webkit-scrollbar-track {
    background: transparent;
}

.search-input::-webkit-scrollbar-thumb {
    background-color: #d1d5db;
    border-radius: 3px;
}

.search-input:focus {
    outline: none;
}

.search-input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

/* Search Options Row - Above Textarea */
.search-options-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.search-options-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.search-options-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Search Input Row - Textarea with Submit Button */
.search-input-row {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
}

.search-input-row .search-input {
    flex: 1;
}

.search-input-row .submit-btn {
    flex-shrink: 0;
    margin-bottom: 0.5rem;
}

/* Visualization Type Row - Below Textarea */
.visualization-type-row {
    display: flex;
    align-items: center;
    margin-top: 0.5rem;
}

.viz-type-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    background: transparent;
    border: 1.5px dashed var(--border-light);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.viz-type-btn:hover {
    border-color: var(--main-purple);
    color: var(--main-purple);
    background: rgba(99, 102, 241, 0.04);
}

.viz-type-btn svg {
    flex-shrink: 0;
}

/* Search Actions Bar */
.search-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.search-actions:empty {
    display: none;
    margin-top: 0;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.action-btn:hover {
    background-color: var(--accent-light);
    color: var(--main-dark);
}

.filter-btn {
    padding-left: 0.5rem;
}

.submit-btn {
    background-color: var(--main-purple);
    color: white;
    padding: 0.5rem;
}

.submit-btn:hover {
    background-color: var(--accent-purple);
}

.submit-btn:disabled {
    background-color: #d1d5db;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Type Button */
.type-btn {
    padding-left: 0.5rem;
}

/* Type Panel */
.type-panel {
    position: absolute;
    bottom: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all 0.2s ease;
    z-index: 10;
}

.type-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.type-panel-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.type-option {
    padding: 0.875rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    background: white;
    border: 1px solid transparent;
}

.type-option:hover {
    background-color: var(--accent-light);
    border-color: var(--border-light);
}

.type-option.active {
    background-color: rgba(99, 102, 241, 0.05);
    border-color: var(--main-purple);
}

.type-option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.type-option-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--main-dark);
}

.type-option-badge {
    font-size: 0.875rem;
    color: var(--main-purple);
    font-weight: 600;
    min-width: 14px;
    text-align: center;
}

.type-option-description {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Scope Button */
.scope-btn {
    padding-left: 0.5rem;
}

/* Scope Panel */
.scope-panel {
    position: absolute;
    bottom: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all 0.2s ease;
    z-index: 10;
}

.scope-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scope-panel-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.scope-option {
    padding: 0.875rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    background: white;
    border: 1px solid transparent;
}

.scope-option:hover {
    background-color: var(--accent-light);
    border-color: var(--border-light);
}

.scope-option.active {
    background-color: rgba(99, 102, 241, 0.05);
    border-color: var(--main-purple);
}

.scope-option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.scope-option-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--main-dark);
}

.scope-option-badge {
    font-size: 0.875rem;
    color: var(--main-purple);
    font-weight: 600;
    min-width: 14px;
    text-align: center;
}

.scope-option-description {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Filter Panel */
.filter-panel {
    position: absolute;
    bottom: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all 0.2s ease;
    z-index: 10;
}

.filter-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Format Slider */
.format-slider-container {
    flex: 1;
    display: flex;
    align-items: center;
    max-width: 420px;
    min-width: 320px;
}

.format-slider {
    position: relative;
    width: 100%;
    padding: 0.25rem 0;
}

.format-slider-track {
    position: relative;
    height: 40px;
    background-color: #f3f4f6;
    border-radius: 10px;
    border: 1px solid var(--border-light);
    padding: 3px;
}

.format-slider-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: calc(25% - 4px);
    height: calc(100% - 6px);
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(99, 102, 241, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

.format-slider-options {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    padding: 3px;
    z-index: 2;
}

.format-slider-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    padding: 0 8px;
}

.format-slider-option span {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    user-select: none;
    z-index: 3;
    white-space: nowrap;
    position: relative;
}

.format-slider-option.active span {
    color: var(--main-purple);
    font-weight: 600;
}

.format-slider-option:hover:not(.active) span {
    color: var(--main-dark);
}

/* Custom tooltips for format slider */
.format-slider-option::before {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: white;
    color: var(--main-dark);
    padding: 0.625rem 1rem;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 1000;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.08);
    min-width: 280px;
    max-width: 320px;
    white-space: normal;
    text-align: center;
    line-height: 1.4;
}

.format-slider-option::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    border: 5px solid transparent;
    border-top-color: white;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 1000;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.08));
}

.format-slider-option:hover::before,
.format-slider-option:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.filter-panel-content {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 1rem;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-weight: 500;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.filter-group input[type="number"] {
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    background-color: white;
    font-family: inherit;
}

.filter-group input[type="number"]:hover {
    border-color: #d1d5db;
}

.filter-group input[type="number"]:focus {
    outline: none;
    border-color: var(--main-purple);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

.filter-group-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
}

.filter-group-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--main-purple);
}

.filter-group-checkbox label {
    cursor: pointer;
    font-weight: 400;
    font-size: 0.875rem;
    color: var(--main-dark);
    margin: 0;
    user-select: none;
}

/* Visualization Type Selector */
.visualization-type-selector {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--accent-light);
    border-radius: 8px;
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Visualization Type Buttons */
.visualization-type-btn {
    padding: 0.5rem 1rem;
    border: 1.5px solid var(--border-light);
    border-radius: 6px;
    background: white;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.visualization-type-btn:hover {
    border-color: var(--main-purple);
    background: rgba(99, 102, 241, 0.05);
}

.visualization-type-btn.active {
    border-color: var(--main-purple);
    background: var(--main-purple);
    color: white;
}

/* Results Section */
.results-section {
    display: none;
    overflow: hidden;
    width: 100%;
    padding: 1rem 1.5rem;
    height: 100vh;
    box-sizing: border-box;
    flex-direction: column;
}

.results-section.active {
    display: flex;
}

#resultsContainer {
    width: 100%;
    flex: 1;
    min-height: 0; /* Critical for nested flex to shrink properly */
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Visualization Section */
.visualization-container {
    background: transparent;
    border-radius: 0;
    border: none;
    padding: 0;
    /* margin-top: 0.5rem; */
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Zoom Controls */
.viz-zoom-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 10;
    background: rgba(255, 255, 255, 0.95);
    padding: 0.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-light);
}

.viz-zoom-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.viz-zoom-btn:hover {
    background: var(--bg-soft);
    color: var(--main-dark);
    border-color: var(--main-purple);
}

.viz-zoom-btn:active {
    transform: scale(0.95);
}

.viz-zoom-btn i {
    font-size: 0.875rem;
}

.visualization-svg {
    width: 100%;
    max-width: 100%;
    height: 100%;
    min-height: 400px;
    border-radius: 4px;
    cursor: grab;
    display: block;
}

.visualization-svg:active {
    cursor: grabbing;
}

/* Chart data points (used in timeline and graph visualizations) */
.bubble {
    cursor: pointer;
    transition: opacity 0.2s ease, filter 0.3s ease;
}

/* Filtered out (greyed out) bubbles */
.bubble.filtered-out {
    opacity: 0.15 !important;
    filter: grayscale(100%);
    pointer-events: none;
}

.bubble-group.filtered-out .bubble,
.bubble-group.filtered-out circle {
    opacity: 0.15 !important;
    filter: grayscale(100%);
}

.bubble-group.filtered-out {
    pointer-events: none;
}

/* Graph view paper nodes filtered out */
.paper-node.filtered-out circle {
    opacity: 0.15 !important;
    filter: grayscale(100%);
}

.paper-node.filtered-out text {
    opacity: 0.15 !important;
}

.paper-node.filtered-out {
    pointer-events: none;
}

/* Topic labels that are filtered out */
.topic-label.filtered-out {
    opacity: 0.3;
}

/* Visualization Filter Button */
.viz-filter-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.viz-filter-btn i {
    font-size: 0.8125rem;
}

.filter-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: white;
    color: var(--main-purple);
    font-size: 0.625rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Filter Modal Styles */
.filter-range-inputs {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.filter-range-separator {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.filter-input {
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.875rem;
    width: 100%;
    max-width: 120px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.filter-input:focus {
    outline: none;
    border-color: var(--main-purple);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.filter-input-full {
    max-width: none;
}

.filter-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    cursor: pointer;
    font-size: 0.9375rem;
}

.filter-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--main-purple);
    cursor: pointer;
}

.filter-active-count {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-soft);
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-align: center;
}

.filter-active-count #filterMatchCount {
    font-weight: 600;
    color: var(--main-purple);
}

/* Visualization Axes */
.x-axis path,
.y-axis path,
.x-axis line,
.y-axis line {
    stroke: #d1d5db;
    stroke-width: 1;
}

.x-axis text,
.y-axis text {
    fill: var(--text-secondary);
    font-size: 0.75rem;
}

.axis-label {
    fill: #4b5563;
    font-weight: 500;
}

/* Quickview Panel */
.quickview-panel {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 450px;
    background: white;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    border-left: 1px solid var(--border-light);
}

.quickview-panel.active {
    transform: translateX(0);
}

.quickview-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.quickview-header-info {
    flex: 1;
    min-width: 0;
}

.quickview-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.quickview-close:hover {
    background-color: var(--accent-light);
    color: var(--main-dark);
}

.quickview-content {
    padding: 1.5rem;
}

.quickview-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--main-dark);
    line-height: 1.4;
    margin-bottom: 0.75rem;
}

.quickview-title a {
    color: var(--main-dark);
    text-decoration: none;
}

.quickview-title a:hover {
    color: var(--main-purple);
}

.quickview-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0;
}

.quickview-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.quickview-meta-item i {
    width: 16px;
    text-align: center;
}

.quickview-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.quickview-section {
    margin-bottom: 1.5rem;
}

.quickview-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--main-dark);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.quickview-abstract {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.875rem;
}

.quickview-authors-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.quickview-author {
    color: var(--text-secondary);
    font-size: 0.875rem;
    padding: 0.25rem 0;
}

/* Legacy legend (below chart) - no longer used */
.visualization-legend {
    display: none;
}

/* Overlay legend (bottom right corner) */
.visualization-legend-overlay {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    z-index: 10;
    background: rgba(255, 255, 255, 0.95);
    padding: 0.625rem 0.875rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-light);
    font-size: 0.75rem;
}

.visualization-legend-overlay .legend-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.visualization-legend-overlay .legend-item strong {
    color: var(--main-dark);
}

.visualization-legend-overlay .legend-gradient {
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    width: 100%;
}

.visualization-legend-overlay .legend-gradient-bar {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    width: 100%;
}

.visualization-legend-overlay .legend-color-bar {
    width: 100%;
    height: 12px;
    border-radius: 3px;
    border: 1px solid var(--border-light);
    background: linear-gradient(to right, rgba(255,255,255,0.9), rgba(0,0,0,0.7));
}

.visualization-legend-overlay .legend-labels {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 0.625rem;
    color: var(--text-secondary);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.legend-gradient {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-color-bar {
    width: 100px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid var(--border-light);
}

.legend-labels {
    display: flex;
    justify-content: space-between;
    width: 100px;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* Quickview Overlay */
.quickview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

.quickview-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Hide container (search/loading) when results or project are showing */
.main-content:has(.results-section.active) .container,
.main-content:has(.project-section[style*="display: block"]) .container {
    display: none;
}

/* Hide search section when loading */
.container:has(.loading.active) .search-section {
    display: none;
}

.container:has(.loading.active) {
    justify-content: center;
}

/* Project section padding */
.project-section {
    padding: 1.5rem 2rem;
}

@media (min-width: 769px) {
    .project-section {
        padding: 2rem;
    }
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* margin-bottom: 0.75rem; */
    padding: 0 0 0.5rem 0;
    flex-shrink: 0; /* Don't shrink header, let visualization take remaining space */
}

.results-header-left {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.results-header-right {
    display: flex;
    align-items: center;
}

.results-header h2 {
    color: var(--main-dark);
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.results-count {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 400;
}

.sort-dropdown {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: white;
    color: var(--text-primary);
    border-color: var(--main-dark);
    box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.1);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.sort-dropdown:hover {
    border-color: var(--main-dark);
}

.sort-dropdown:focus {
    outline: none;
    border-color: var(--main-dark);
    box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.1);
}

/* Export CSV Button */
.btn-export-csv {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    margin-right: 1.5rem;
    background-color: var(--main-purple);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-export-csv:hover {
    background-color: var(--accent-purple);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(109, 40, 217, 0.25);
}

.btn-export-csv:active {
    transform: translateY(0);
}

.btn-export-csv i {
    font-size: 0.8rem;
}

/* Extract Sort Row (below header) */
.extract-sort-row {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

/* Reduce header margin when extract sort row is shown */
.results-header.extract-mode {
    margin-bottom: 0.5rem;
}

/* Paper Cards */
.paper-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid var(--border-light);
    transition: all 0.2s ease;
}

.paper-card:hover {
    border-color: #d1d5db;
    box-shadow: var(--shadow-sm);
}

.paper-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.paper-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--main-dark);
    line-height: 1.5;
    flex: 1;
    min-width: 0;
}

.paper-title a {
    color: var(--main-dark);
    text-decoration: none;
    transition: color 0.2s ease;
}

.paper-title a:hover {
    color: var(--main-purple);
}

.paper-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.paper-meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-oa {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-citations {
    background-color: #e0e7ff;
    color: #4338ca;
}

.badge-relevance {
    background-color: #e0e7ff;
    color: var(--accent-purple);
}

.badge-relevance-top {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.paper-abstract {
    color: var(--text-secondary);
    margin-top: 0.75rem;
    line-height: 1.6;
    font-size: 0.875rem;
}

.abstract-truncated {
    display: inline;
}

.abstract-full {
    display: none;
}

.abstract-full.active {
    display: inline;
}

.abstract-truncated.hidden {
    display: none;
}

.abstract-toggle {
    color: var(--main-purple);
    cursor: pointer;
    font-weight: 500;
    margin-left: 0.25rem;
    transition: color 0.2s ease;
    border: none;
    background: none;
    padding: 0;
    font-size: 0.875rem;
    text-decoration: none;
}

.abstract-toggle:hover {
    color: var(--accent-purple);
    text-decoration: underline;
}

/* Paper Card Hover Actions */
.paper-card-with-actions {
    position: relative;
}

.paper-header-right {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    flex-shrink: 0;
}

.paper-hover-actions {
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.paper-card-with-actions:hover .paper-hover-actions {
    opacity: 1;
    visibility: visible;
}

.paper-action-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-soft);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.paper-action-btn:hover {
    color: var(--main-purple);
    background: #f0f0ff;
    border-color: var(--main-purple);
}

.paper-action-btn i {
    font-size: 0.75rem;
}

/* Similar Papers Modal */
.modal.similar-papers-modal {
    max-width: 1100px;
    width: 90%;
    max-height: 85vh;
    flex-direction: column;
}

.modal.similar-papers-modal.active {
    display: flex;
}

.similar-papers-modal .modal-body {
    overflow-y: auto;
    padding: 1.5rem;
    flex: 1;
}

.similar-papers-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.similar-papers-loading,
.similar-papers-empty,
.similar-papers-error {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
}

.similar-papers-loading .spinner {
    margin: 0 auto 1rem;
}

.similar-papers-empty i,
.similar-papers-error i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
}

.similar-papers-error {
    color: #dc2626;
}

.similar-paper-card {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 1.25rem;
    transition: all 0.2s ease;
}

.similar-paper-card:hover {
    border-color: #d1d5db;
    box-shadow: var(--shadow-sm);
}

.similar-paper-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.625rem;
}

.similar-paper-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--main-dark);
    line-height: 1.4;
    flex: 1;
}

.similar-paper-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.similar-paper-title a:hover {
    color: var(--main-purple);
}

.badge-similarity {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.6875rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.similar-paper-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.875rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.625rem;
}

.similar-paper-meta i {
    margin-right: 0.25rem;
    font-size: 0.75rem;
}

.similar-paper-badges {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.625rem;
}

.badge-oa-small {
    background-color: #d1fae5;
    color: #065f46;
    padding: 0.125rem 0.375rem;
    font-size: 0.6875rem;
    border-radius: 3px;
}

.badge-citations-small {
    background-color: #e0e7ff;
    color: #4338ca;
    padding: 0.125rem 0.375rem;
    font-size: 0.6875rem;
    border-radius: 3px;
}

.similar-paper-abstract {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.similar-paper-actions {
    display: flex;
    gap: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-light);
}

/* Loading State */
.loading {
    text-align: center;
    padding: 2rem;
    display: none;
}

.loading.active {
    display: block;
}

.loading p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.spinner {
    border: 3px solid var(--border-light);
    border-top: 3px solid var(--main-purple);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Error Message */
.error-message {
    background-color: #fef2f2;
    color: #991b1b;
    padding: 0.875rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    display: none;
    border: 1px solid #fecaca;
    font-size: 0.875rem;
}

.error-message.active {
    display: block;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 0.875rem;
}

.empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 1rem;
    opacity: 0.2;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 200px;
    }

    .sidebar.collapsed {
        width: 52px;
    }

    .main-content {
        margin-left: 200px;
        width: calc(100vw - 200px);
    }

    body.sidebar-collapsed .main-content {
        margin-left: 52px;
        width: calc(100vw - 52px);
    }

    .container {
        padding: 1rem;
        min-height: 100vh;
    }
    
    .hero-content p {
        font-size: 0.9375rem;
    }

    .hero-content {
        padding: 0 1rem 2rem;
    }

    .filter-panel-content {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .paper-meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    .user-name {
        display: none;
    }

    .format-slider-container {
        max-width: 100%;
    }

    .format-slider-option span {
        font-size: 0.75rem;
    }

    .search-options-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .search-options-left {
        width: 100%;
        justify-content: flex-start;
    }

    .search-options-right {
        width: 100%;
        justify-content: flex-start;
    }

    .search-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .search-actions > div {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .sidebar {
        width: 180px;
    }

    .sidebar.collapsed {
        width: 48px;
    }

    .main-content {
        margin-left: 180px;
        width: calc(100vw - 180px);
    }

    body.sidebar-collapsed .main-content {
        margin-left: 48px;
        width: calc(100vw - 48px);
    }

    .sidebar-header {
        padding: 1rem;
    }

    .sidebar.collapsed .sidebar-header {
        padding: 1rem 0.5rem;
    }

    .sidebar-logo {
        height: 30px;
    }

    .quickview-panel {
        width: 100%;
    }

    .visualization-legend-overlay {
        bottom: 0.5rem;
        right: 0.5rem;
        padding: 0.5rem 0.625rem;
        font-size: 0.6875rem;
    }

    .visualization-svg {
        height: 400px;
    }
}

/* ============================================================================
   Project Management Styles
   ============================================================================ */

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 9998;
    display: none;
}

.modal-overlay.active {
    display: block;
}

/* Modal */
.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    max-width: 500px;
    width: 90%;
    max-height: 85vh;
    display: none;
    flex-direction: column;
}

.modal.modal-large {
    max-width: 900px;
}

.modal.active {
    display: flex;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--main-dark);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--accent-light);
    color: var(--main-dark);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--main-dark);
    font-size: 0.875rem;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.9375rem;
    background: #ffffff;
    color: var(--main-dark);
    transition: all 0.2s ease;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--main-purple);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-textarea {
    resize: vertical;
    font-family: inherit;
}

/* Button Styles */
.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--main-purple);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-purple);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--accent-light);
    color: var(--main-dark);
}

.btn-secondary:hover:not(:disabled) {
    background: #f3f4f6;
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #b91c1c;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-icon-small {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.375rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
}

.btn-icon-small:hover {
    background: var(--accent-light);
    color: var(--main-dark);
}

/* Sidebar Project Items */
.sidebar-project-item {
    padding: 0.625rem 0.75rem;
    margin-bottom: 0.25rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-project-item:last-child {
    margin-bottom: 0;
}

.sidebar-project-item:hover {
    background: var(--accent-light);
}

.sidebar-project-name {
    font-size: 0.875rem;
    color: var(--main-dark);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Project List (in modal) */
.project-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.project-list-item {
    padding: 1rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.project-list-item:hover {
    border-color: var(--main-purple);
    background: var(--accent-light);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.project-list-item-name {
    font-weight: 500;
    color: var(--main-dark);
    margin-bottom: 0.25rem;
}

.project-list-item-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Project Papers Table */
.project-papers-table {
    overflow-x: auto;
}

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

.project-papers-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-light);
    background: var(--accent-light);
}

.project-papers-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9375rem;
    color: var(--main-dark);
}

.project-papers-table tr:last-child td {
    border-bottom: none;
}

.project-papers-table tr:hover {
    background: var(--accent-light);
}

.project-papers-table a {
    color: var(--main-purple);
    text-decoration: none;
    transition: color 0.2s ease;
}

.project-papers-table a:hover {
    color: var(--accent-purple);
    text-decoration: underline;
}

/* Badge Variants */
.badge-success {
    background-color: #d1fae5;
    color: #065f46;
    padding: 0.25rem 0.625rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-block;
}

.badge-secondary {
    background-color: var(--accent-light);
    color: var(--text-secondary);
    padding: 0.25rem 0.625rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-block;
}

.badge-primary {
    background-color: #dbeafe;
    color: #1e40af;
    padding: 0.25rem 0.625rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-block;
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid var(--border-light);
    border-top-color: var(--main-purple);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Upload Area Styles */
.upload-area {
    border: 2px dashed var(--border-light);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
}

.upload-area.drag-over {
    border-color: var(--main-purple);
    background-color: rgba(99, 102, 241, 0.05);
}

.upload-area-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 2rem 1rem;
}

.upload-area-content:hover {
    opacity: 0.8;
}

.upload-area-selected {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.upload-area-processing {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

/* Responsive adjustments for modals and project section */
@media (max-width: 768px) {
    .modal {
        max-width: 95%;
        width: 95%;
    }
    
    .modal.modal-large {
        max-width: 95%;
    }
    
    .modal-header {
        padding: 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-footer {
        padding: 1rem;
        flex-wrap: wrap;
    }
    
    .project-papers-table {
        font-size: 0.875rem;
    }
    
    .project-papers-table th,
    .project-papers-table td {
        padding: 0.5rem;
        font-size: 0.8125rem;
    }
    
    .project-section {
        max-width: 100%;
    }
    
    .project-header {
        padding-bottom: 1rem;
        margin-bottom: 1rem;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .project-title-section {
        order: 1;
        width: 100%;
    }
    
    .project-title-section h2 {
        font-size: 1.5rem;
    }
    
    .project-actions {
        order: 2;
        width: 100%;
    }
    
    .project-content {
        padding: 1.25rem;
        border-radius: 8px;
    }
    
    .upload-area {
        padding: 1rem;
    }
    
    .upload-area-content,
    .upload-area-selected,
    .upload-area-processing {
        padding: 1rem 0.5rem;
    }
}

/* ========================================
   Extract Workflow Styles
   ======================================== */

.extract-options-row {
    margin-top: 0.5rem;
    position: relative;
}

.extract-attributes-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.add-attribute-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    background: transparent;
    border: 1.5px dashed var(--border-light);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.add-attribute-btn:hover {
    border-color: var(--main-purple);
    color: var(--main-purple);
    background: rgba(99, 102, 241, 0.04);
}

.add-attribute-btn svg {
    flex-shrink: 0;
}

/* Selected Attributes as Tags */
.selected-attributes {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.attribute-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.625rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(79, 70, 229, 0.08) 100%);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--main-purple);
    animation: tagAppear 0.2s ease-out;
}

@keyframes tagAppear {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.attribute-tag-name {
    white-space: nowrap;
}

.attribute-tag-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border: none;
    background: transparent;
    color: var(--main-purple);
    cursor: pointer;
    border-radius: 4px;
    padding: 0;
    transition: all 0.15s ease;
    opacity: 0.6;
}

.attribute-tag-remove:hover {
    opacity: 1;
    background: rgba(99, 102, 241, 0.15);
}

.attribute-tag-remove svg {
    width: 10px;
    height: 10px;
    pointer-events: none;
}

/* Attribute Selection Menu */
.attribute-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    width: 340px;
    max-height: 420px;
    overflow-y: auto;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 0.75rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.attribute-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.attribute-menu-header {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    padding: 0.375rem 0.5rem;
    margin-bottom: 0.25rem;
}

.attribute-menu-options {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.attribute-option {
    display: grid;
    grid-template-columns: 20px 1fr;
    grid-template-rows: auto auto;
    gap: 0.125rem 0.625rem;
    padding: 0.625rem 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.attribute-option:hover {
    background: var(--accent-light);
}

.attribute-option.selected {
    background: rgba(99, 102, 241, 0.08);
}

.attribute-checkbox {
    grid-row: span 2;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-light);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    margin-top: 2px;
    pointer-events: none;
}

.attribute-option.selected .attribute-checkbox {
    background: var(--main-purple);
    border-color: var(--main-purple);
}

.attribute-option.selected .attribute-checkbox::after {
    content: '';
    width: 10px;
    height: 10px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2.5 6L5 8.5L9.5 3.5' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
}

.attribute-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--main-dark);
    pointer-events: none;
}

.attribute-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
    pointer-events: none;
}

.attribute-menu-divider {
    height: 1px;
    background: var(--border-light);
    margin: 0.75rem 0;
}

/* Custom Attribute Input */
.custom-attribute-input {
    display: flex;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
}

.custom-attribute-input input {
    flex: 1;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--main-dark);
    transition: all 0.15s ease;
    background: var(--accent-light);
}

.custom-attribute-input input::placeholder {
    color: #9ca3af;
}

.custom-attribute-input input:focus {
    outline: none;
    border-color: var(--main-purple);
    background: white;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.add-custom-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--main-purple);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.add-custom-btn:hover {
    background: var(--accent-purple);
    transform: scale(1.05);
}

.add-custom-btn:active {
    transform: scale(0.95);
}

/* Model Selector Row */
.extract-model-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.model-selector-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.model-selector-label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.model-selector-label svg {
    color: var(--text-secondary);
}

.model-select-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.model-select {
    appearance: none;
    -webkit-appearance: none;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--main-dark);
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    min-width: 180px;
}

.model-select:hover {
    border-color: #d1d5db;
}

.model-select:focus {
    outline: none;
    border-color: var(--main-purple);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.model-select-arrow {
    position: absolute;
    right: 0.625rem;
    pointer-events: none;
    color: var(--text-secondary);
}

/* API Key Container */
.api-key-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.api-key-input-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.api-key-input {
    width: 200px;
    padding: 0.4375rem 0.625rem;
    font-size: 0.8125rem;
    color: var(--main-dark);
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    transition: all 0.15s ease;
}

.api-key-input::placeholder {
    color: #9ca3af;
}

.api-key-input:focus {
    outline: none;
    border-color: var(--main-purple);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

.api-key-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.api-key-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--main-dark);
}

/* Save Key Checkbox */
.save-key-checkbox {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    cursor: pointer;
    user-select: none;
}

.save-key-checkbox input {
    display: none;
}

.save-key-checkmark {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-light);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    background: white;
}

.save-key-checkbox input:checked + .save-key-checkmark {
    background: var(--main-purple);
    border-color: var(--main-purple);
}

.save-key-checkbox input:checked + .save-key-checkmark::after {
    content: '';
    width: 10px;
    height: 10px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2.5 6L5 8.5L9.5 3.5' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
}

.save-key-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Hidden state for API key container when key is saved */
.api-key-container.hidden {
    display: none;
}

/* Saved API Key Status */
.api-key-saved-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #16a34a;
}

.api-key-saved-status svg {
    flex-shrink: 0;
}

.api-key-saved-status.hidden {
    display: none;
}

.api-key-clear-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-left: 0.25rem;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: #16a34a;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.15s ease;
}

.api-key-clear-btn:hover {
    background: rgba(34, 197, 94, 0.15);
    opacity: 1;
}

/* Responsive adjustments for Extract options */
@media (max-width: 768px) {
    .attribute-menu {
        width: calc(100vw - 3rem);
        max-width: 340px;
    }
    
    .extract-attributes-container {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .selected-attributes {
        width: 100%;
    }
    
    .extract-model-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .api-key-container {
        width: 100%;
    }
    
    .api-key-input {
        flex: 1;
        min-width: 0;
    }
}

/* ========================================
   Extract Results Table
   ======================================== */

.extract-table-wrapper {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    background: white;
}

.extract-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    min-width: 800px;
}

.extract-table thead {
    background: var(--accent-light);
    position: sticky;
    top: 0;
    z-index: 10;
}

.extract-table th {
    padding: 0.875rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--main-dark);
    border-bottom: 2px solid var(--border-light);
    white-space: nowrap;
}

.extract-th-title {
    min-width: 280px;
    width: 30%;
}

.extract-th-attr {
    min-width: 180px;
}

.extract-row {
    transition: background-color 0.15s ease;
}

.extract-row:hover {
    background-color: rgba(99, 102, 241, 0.03);
}

.extract-row:not(:last-child) td {
    border-bottom: 1px solid var(--border-light);
}

.extract-table td {
    padding: 1rem;
    vertical-align: top;
}

.extract-td-title {
    background: rgba(249, 250, 251, 0.5);
}

.extract-paper-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.extract-paper-title {
    font-weight: 500;
    color: var(--main-dark);
    line-height: 1.4;
}

.extract-paper-title a,
.extract-paper-link {
    color: var(--main-dark);
    text-decoration: none;
    transition: color 0.15s ease;
}

.extract-paper-title a:hover,
.extract-paper-link:hover {
    color: var(--main-purple);
}

.extract-paper-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.extract-paper-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.extract-paper-meta i {
    font-size: 0.625rem;
    opacity: 0.7;
}

.extract-paper-badges {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Extract Table Action Buttons */
.extract-th-actions {
    min-width: 80px;
    width: 80px;
    text-align: center;
}

.extract-td-actions {
    text-align: center;
    vertical-align: middle;
}

.extract-row-actions {
    display: flex;
    gap: 0.375rem;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.extract-row-with-actions:hover .extract-row-actions {
    opacity: 1;
    visibility: visible;
}

.extract-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    background: var(--bg-soft);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.extract-action-btn:hover {
    color: var(--main-purple);
    background: #f0f0ff;
    border-color: var(--main-purple);
}


.extract-td-attr {
    color: var(--main-dark);
    line-height: 1.5;
    max-width: 300px;
}

.extract-th-source {
    width: 90px;
    text-align: center;
}

.extract-td-source {
    text-align: center;
    vertical-align: middle;
}

.badge-source-full {
    background-color: rgba(34, 197, 94, 0.15);
    color: #15803d;
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

.badge-source-abstract {
    background-color: rgba(99, 102, 241, 0.12);
    color: var(--main-purple);
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

.badge-source-error {
    background-color: rgba(239, 68, 68, 0.12);
    color: #dc2626;
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

/* Responsive table adjustments */
@media (max-width: 1024px) {
    .extract-table-wrapper {
        margin: 0 -1rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}

/* ========================================
   Extract Paper Selection UI
   ======================================== */

.extract-selection-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.selected-count {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    background: rgba(99, 102, 241, 0.08);
    border-radius: 6px;
}

.btn-select-all {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-select-all:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--main-purple);
}

.btn-start-extraction {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--main-purple), #7c3aed);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.btn-start-extraction:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.btn-start-extraction:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Paper selection card layout */
.extract-selection-card {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    border: 2px solid transparent;
    transition: all 0.15s ease;
}

.extract-selection-card.selected {
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(99, 102, 241, 0.03);
}

.extract-selection-card:hover {
    border-color: rgba(99, 102, 241, 0.2);
}

.paper-selection-checkbox {
    display: flex;
    align-items: flex-start;
    padding-top: 0.25rem;
}

.extract-checkbox-label {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    width: 24px;
    height: 24px;
}

.extract-paper-checkbox,
.synthesis-paper-checkbox {
    display: none;
}

.extract-checkbox-custom {
    width: 22px;
    height: 22px;
    border: 2px solid #9ca3af;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    position: relative;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.extract-checkbox-custom::after {
    content: '';
    width: 10px;
    height: 6px;
    border-left: 2px solid white;
    border-bottom: 2px solid white;
    transform: rotate(-45deg) translate(0, -1px);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.extract-paper-checkbox:checked + .extract-checkbox-custom,
.synthesis-paper-checkbox:checked + .extract-checkbox-custom {
    background: var(--main-purple);
    border-color: var(--main-purple);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.extract-paper-checkbox:checked + .extract-checkbox-custom::after,
.synthesis-paper-checkbox:checked + .extract-checkbox-custom::after {
    opacity: 1;
}

.extract-checkbox-label:hover .extract-checkbox-custom {
    border-color: var(--main-purple);
    background: #f3f4ff;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.paper-card-content {
    flex: 1;
    min-width: 0;
}

/* Responsive adjustments for selection controls */
@media (max-width: 768px) {
    .extract-selection-controls {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .btn-start-extraction {
        width: 100%;
        justify-content: center;
    }
    
    .extract-selection-card {
        padding: 1rem;
        gap: 0.75rem;
    }
}

/* ========================================
   Synthesis Paper Selection & Results
   ======================================== */


/* Synthesis paper checkbox styles are combined with extract styles above */

/* Synthesis source info in header */
.synthesis-source-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    padding: 0.5rem 0.75rem;
    background: rgba(99, 102, 241, 0.08);
    border-radius: 6px;
}

.synthesis-source-info i {
    color: var(--main-purple);
}

/* Synthesis Results Container */
.synthesis-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.synthesis-content {
    background: var(--bg-soft);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 1.5rem;
}

.synthesis-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-light);
}

.synthesis-header svg {
    color: var(--main-purple);
}

.synthesis-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.synthesis-text {
    color: var(--text-primary);
    font-size: 0.9375rem;
    line-height: 1.75;
}

.synthesis-text p {
    margin: 0 0 1rem 0;
}

.synthesis-text p:last-child {
    margin-bottom: 0;
}

/* Papers Included Section */
.synthesis-papers-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.synthesis-papers-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.synthesis-papers-header i {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.synthesis-papers-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Citation links in synthesis text */
.synthesis-citation {
    color: var(--main-purple);
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.15s ease;
}

.synthesis-citation:hover {
    color: #7c3aed;
    text-decoration: underline;
}

.synthesis-paper-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.synthesis-paper-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    background: var(--bg-hover);
}

/* Citation highlight animation */
.synthesis-paper-card.citation-highlight {
    border-color: var(--main-purple);
    background: rgba(99, 102, 241, 0.08);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Citation index number */
.synthesis-paper-index {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--main-purple);
    min-width: 24px;
    flex-shrink: 0;
}

.synthesis-paper-source {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: 6px;
    background: rgba(99, 102, 241, 0.08);
    color: var(--main-purple);
    font-size: 0.75rem;
}

.synthesis-paper-source i.fa-file-pdf {
    color: var(--main-purple);
}

.synthesis-paper-source i.fa-file-alt {
    color: var(--text-secondary);
}

.synthesis-paper-content {
    flex: 1;
    min-width: 0;
}

.synthesis-paper-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.synthesis-paper-title a {
    color: inherit;
    text-decoration: none;
}

.synthesis-paper-title a:hover {
    color: var(--main-purple);
}

.synthesis-paper-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.synthesis-paper-badges {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.badge-oa-small {
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border-radius: 4px;
    font-weight: 600;
}

.badge-citations-small {
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
    background: rgba(99, 102, 241, 0.08);
    color: var(--text-secondary);
    border-radius: 4px;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .synthesis-content {
        padding: 1.25rem;
    }
    
    .synthesis-paper-card {
        flex-wrap: wrap;
    }
    
    .synthesis-paper-badges {
        width: 100%;
        margin-top: 0.5rem;
        margin-left: 2.75rem;
    }
}

