/* VeriScribe Vault - Zotero-like Library View Styles */

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

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-hover: #e9ecef;
    --bg-selected: #d3e4f4;
    --border-color: #dee2e6;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --accent-color: #0d6efd;
    --toolbar-bg: #343a40;
    --toolbar-text: #ffffff;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-secondary);
    overflow: hidden;
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--toolbar-bg);
    color: var(--toolbar-text);
    padding: 8px 16px;
    border-bottom: 1px solid #495057;
    box-shadow: var(--shadow);
}

.toolbar-left, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.app-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.library-selector select {
    padding: 4px 8px;
    border: 1px solid #495057;
    border-radius: 4px;
    background: #495057;
    color: var(--toolbar-text);
    font-size: 13px;
}

#search-box {
    padding: 6px 12px;
    border: 1px solid #495057;
    border-radius: 4px;
    width: 250px;
    font-size: 13px;
    background: #495057;
    color: var(--toolbar-text);
}

#search-box::placeholder {
    color: #adb5bd;
}

#sync-button, .toolbar-btn {
    background: transparent;
    border: 1px solid #6c757d;
    color: var(--toolbar-text);
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
}

#sync-button:hover, .toolbar-btn:hover {
    background: #495057;
}

.toolbar-btn-add {
    color: #28a745;
    border-color: #28a745;
}

.toolbar-btn-add:hover {
    background: rgba(40, 167, 69, 0.2);
}

.toolbar-btn-delete {
    color: #dc3545;
    border-color: #dc3545;
    font-size: 24px;
}

.toolbar-btn-delete:hover {
    background: rgba(220, 53, 69, 0.2);
}

.user-info {
    font-size: 13px;
    color: #adb5bd;
}

/* Main Content - Three-Pane Layout */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Common Pane Styles */
.collections-pane,
.items-pane,
.details-pane {
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    overflow: hidden;
}

.pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.pane-header h2 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.pane-header button {
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-primary);
}

.pane-header button:hover {
    background: var(--bg-hover);
}

/* Collections Pane (Left) */
.collections-pane {
    width: 250px;
    min-width: 200px;
    resize: horizontal;
}

.collections-tree {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.collection-item {
    display: flex;
    align-items: center;
    padding: 6px 16px;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid transparent;
}

.collection-item:hover {
    background: var(--bg-hover);
}

.collection-item.active {
    background: var(--bg-selected);
    border-left: 3px solid var(--accent-color);
    padding-left: 13px;
}

.collection-item.nested {
    padding-left: 32px;
}

.collection-item.nested-2 {
    padding-left: 48px;
}

.collection-icon {
    margin-right: 8px;
    font-size: 14px;
}

.collection-name {
    flex: 1;
    font-size: 13px;
}

.collection-count {
    font-size: 12px;
    color: var(--text-secondary);
}

.collection-item .expand-icon {
    margin-right: 4px;
    font-size: 10px;
    transition: transform 0.2s;
}

.collection-item.expanded .expand-icon {
    transform: rotate(90deg);
}

/* Items Pane (Middle) */
.items-pane {
    flex: 1;
    min-width: 400px;
}

.view-options {
    display: flex;
    gap: 4px;
}

.view-options button {
    padding: 4px 8px;
}

.view-options button.active {
    background: var(--bg-selected);
}

.items-list-container {
    flex: 1;
    overflow-y: auto;
}

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

.items-table thead {
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 10;
}

.items-table th {
    text-align: left;
    padding: 8px 12px;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    user-select: none;
}

.items-table th.attachment-col {
    text-align: center;
    width: 40px;
    cursor: default;
}

.items-table th.sortable:hover {
    background: var(--bg-hover);
}

.sort-indicator {
    font-size: 10px;
    margin-left: 4px;
    opacity: 0.5;
}

.items-table th.sorted .sort-indicator {
    opacity: 1;
}

.items-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
}

.items-table tbody tr:hover {
    background: var(--bg-hover);
}

.items-table tbody tr.selected {
    background: var(--bg-selected);
}

.items-table td {
    padding: 8px 12px;
    font-size: 13px;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.items-table td.attachment-cell {
    text-align: center;
    max-width: 40px;
    font-size: 16px;
}

.no-items td {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Item Type Icons */
.item-type-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 6px;
}

/* Details Pane (Right) */
.details-pane {
    width: 350px;
    min-width: 300px;
    resize: horizontal;
}

#close-details-btn {
    font-size: 24px;
    line-height: 1;
    padding: 0 8px;
}

.details-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.no-selection {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    font-style: italic;
}

/* Item Details Layout */
.item-metadata {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.metadata-section {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
}

.metadata-section:last-child {
    border-bottom: none;
}

.metadata-section h3 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.metadata-field {
    display: flex;
    margin-bottom: 8px;
    font-size: 13px;
}

.field-label {
    font-weight: 600;
    width: 120px;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.field-value {
    flex: 1;
    word-wrap: break-word;
}

.field-value a {
    color: var(--accent-color);
    text-decoration: none;
}

.field-value a:hover {
    text-decoration: underline;
}

.creators-list {
    list-style: none;
}

.creators-list li {
    margin-bottom: 4px;
}

.attachment-item {
    display: flex;
    align-items: center;
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    margin-bottom: 8px;
}

.attachment-icon {
    margin-right: 8px;
    font-size: 16px;
}

.attachment-name {
    flex: 1;
    font-size: 13px;
}

.attachment-actions {
    display: flex;
    gap: 4px;
}

.attachment-actions button {
    background: transparent;
    border: none;
    color: var(--accent-color);
    cursor: pointer;
    font-size: 12px;
    padding: 4px;
}

.attachment-actions button:hover {
    text-decoration: underline;
}

/* Status Bar */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
    padding: 4px 16px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-secondary);
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: #adb5bd;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #6c757d;
}

/* Loading States */
.loading {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
}

.loading::after {
    content: '...';
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* PDF Modal */
.pdf-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pdf-modal-content {
    background: white;
    width: 90%;
    height: 90%;
    max-width: 1200px;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.pdf-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.pdf-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

.pdf-close-btn {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.pdf-close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.pdf-iframe {
    flex: 1;
    border: none;
    width: 100%;
    background: white;
}

/* Library selector buttons */
.library-selector {
    display: flex;
    gap: 8px;
    align-items: center;
}

.library-selector button {
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.library-selector button:hover {
    background: var(--bg-secondary);
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 180px;
}

.context-menu-item {
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
}

.context-menu-item:hover {
    background: var(--bg-secondary);
}

/* Dialog Overlay */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.dialog-content {
    background: white;
    padding: 24px;
    border-radius: 8px;
    min-width: 300px;
    max-width: 500px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.dialog-content h3 {
    margin: 0 0 16px 0;
    font-size: 18px;
}

.dialog-content input[type="text"],
.dialog-content select {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 16px;
}

.dialog-content select {
    min-height: 200px;
}

.dialog-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.primary-btn {
    padding: 8px 16px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.primary-btn:hover {
    background: #0056b3;
}

.secondary-btn {
    padding: 8px 16px;
    background: white;
    color: #333;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.secondary-btn:hover {
    background: var(--bg-secondary);
}

/* Item row right-click highlight */
.items-table tr.context-active {
    background: #e3f2fd !important;
}

/* ========================================
   Chat Components
   ======================================== */

/* Chat button with label in toolbar */
.chat-btn-with-label {
    background: transparent;
    border: 1px solid #6c757d;
    color: var(--toolbar-text);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

.chat-btn-with-label:hover {
    background: #495057;
    border-color: #28a745;
}

.chat-btn-label {
    font-weight: 500;
}

/* Mini chat icons in collections and items */
.chat-icon-mini,
.chat-icon-placeholder {
    display: inline-block;
    width: 22px;
    background: transparent;
    border: none;
    font-size: 14px;
    padding: 0;
    margin-right: 4px;
    text-align: center;
}

.chat-icon-mini {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.chat-icon-mini:hover {
    opacity: 1;
}

.chat-icon-placeholder {
    visibility: hidden;
}

/* Chat Modal */
.chat-modal-content {
    background: white;
    width: 600px;
    max-width: 90%;
    height: 70vh;
    max-height: 700px;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-close-btn {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.chat-close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fa;
}

.chat-message {
    margin-bottom: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    max-width: 80%;
    word-wrap: break-word;
}

.chat-user {
    background: #007bff;
    color: white;
    margin-left: auto;
    text-align: right;
}

.chat-assistant {
    background: white;
    border: 1px solid #dee2e6;
    margin-right: auto;
}

.chat-error {
    background: #f8d7da;
    border: 1px solid #f5c2c7;
    color: #842029;
    margin-right: auto;
}

.chat-info {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 20px;
}

.chat-sources {
    margin-top: 12px;
    padding: 12px;
    background: #e7f3ff;
    border-radius: 6px;
    border-left: 3px solid #007bff;
}

.sources-header {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 13px;
    color: #0056b3;
}

.source-item {
    font-size: 12px;
    margin-bottom: 4px;
    padding: 4px 0;
    color: #333;
}

.chat-input-area {
    display: flex;
    gap: 8px;
    padding: 16px;
    background: white;
    border-top: 1px solid var(--border-color);
}

.chat-input-area input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

.chat-input-area button {
    padding: 10px 20px;
}

/* ========================================
   Document Ingestion Modal
   ======================================== */

/* Ingestion Modal Content */
.ingest-modal-content {
    background: white;
    width: 600px;
    max-width: 90%;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.ingest-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.ingest-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.ingest-close-btn {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.ingest-close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

/* Tab Switcher */
.tab-switcher {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.tab-btn {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.tab-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.tab-btn.active {
    border-bottom-color: var(--accent-color);
    color: var(--accent-color);
    background: white;
}

/* Ingestion Content Area */
.ingest-content {
    padding: 20px;
    min-height: 300px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Ingestion Form */
.ingest-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ingest-form label {
    font-weight: 500;
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.ingest-form input[type="text"],
.ingest-form input[type="file"] {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

.ingest-form input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

.help-text {
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: -8px;
}

/* Progress Indicator */
.ingest-progress {
    margin-top: 16px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #0056b3);
    animation: progressAnimation 1.5s ease-in-out infinite;
}

@keyframes progressAnimation {
    0% {
        width: 0%;
    }
    50% {
        width: 100%;
    }
    100% {
        width: 0%;
    }
}

.progress-message {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
}

/* Status Messages */
.ingest-status {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 4px;
    font-size: 13px;
    display: none;
}

.ingest-status:not(:empty) {
    display: block;
}

.ingest-status.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.ingest-status.error {
    background: #f8d7da;
    border: 1px solid #f5c2c7;
    color: #842029;
}

/* Action Buttons */
.ingest-actions {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    justify-content: flex-end;
}

.ingest-actions button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   Phase 1 Document Ingestion Styles
   ======================================== */

/* Method Tabs */
.method-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.method-tab {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.method-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.method-tab.active {
    border-bottom-color: var(--accent-color);
    color: var(--accent-color);
    background: white;
}

/* Method Content */
.method-content {
    display: none;
    padding: 20px;
    min-height: 300px;
}

.method-content.active {
    display: block;
}

.coming-soon {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-style: italic;
}

/* File Upload Area */
.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-secondary);
}

.file-upload-label:hover {
    border-color: var(--accent-color);
    background: #f0f7ff;
}

.file-upload-label svg {
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.file-upload-label span {
    display: block;
    color: var(--text-primary);
    font-size: 14px;
}

.file-types {
    font-size: 12px !important;
    color: var(--text-secondary) !important;
    margin-top: 4px;
}

.selected-file {
    margin-top: 12px;
    padding: 8px 12px;
    background: #e7f3ff;
    border-radius: 4px;
    font-size: 13px;
    color: #0056b3;
}

/* Metadata Form */
.metadata-form {
    max-height: 400px;
    overflow-y: auto;
}

.metadata-form h4 {
    margin-bottom: 16px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 500;
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

/* Authors List */
#authors-list {
    margin-bottom: 8px;
}

.author-entry {
    display: grid;
    grid-template-columns: 1fr 1fr 100px 32px;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

.author-entry input,
.author-entry select {
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 13px;
}

.remove-author-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: background 0.2s;
}

.remove-author-btn:hover {
    background: #c82333;
}

.secondary-btn.small {
    padding: 6px 12px;
    font-size: 13px;
}

/* ========== Attach PDF Modal ========== */

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

.modal-content {
    background-color: var(--bg-primary);
    margin: 5% auto;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary);
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.attach-pdf-info {
    margin-bottom: 20px;
}

.attach-pdf-info p {
    margin: 8px 0;
}

.info-text {
    color: var(--text-secondary);
    font-size: 13px;
}

.file-upload-section {
    margin: 20px 0;
}

#attach-pdf-file-input {
    display: none;
}

.file-upload-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: 2px dashed var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-secondary);
}

.file-upload-label:hover {
    border-color: var(--accent-color);
    background: #e7f1ff;
}

.file-upload-icon {
    font-size: 24px;
}

#attach-pdf-file-name {
    flex: 1;
    color: var(--text-secondary);
}

.attach-options {
    margin: 15px 0;
}

.attach-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.attach-progress {
    margin: 20px 0;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 6px;
}

.progress-message {
    margin-bottom: 10px;
    color: var(--text-primary);
    font-weight: 500;
}

.progress-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent-color);
    width: 100%;
    animation: progressAnimation 1.5s ease-in-out infinite;
}

@keyframes progressAnimation {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

.attach-result {
    margin: 20px 0;
}

.success-message {
    padding: 16px;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
    color: #155724;
}

.success-message h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
}

.success-message p {
    margin: 8px 0;
}

.metadata-updates {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #c3e6cb;
}

.metadata-updates ul {
    margin: 8px 0 0 20px;
    padding: 0;
}

.metadata-updates li {
    margin: 4px 0;
}

.error-message {
    padding: 16px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    color: #721c24;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

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

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

.btn-primary:hover:not(:disabled) {
    background: #0b5ed7;
}

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

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

.no-attachment {
    text-align: center;
    padding: 20px;
}

.no-attachment .btn {
    margin-top: 12px;
}
/* Full Text Finder Styles - Add to library.css */

/* ============================================================================
   Checkbox Column and Selection
   ============================================================================ */

.checkbox-col {
    width: 40px;
    text-align: center;
    padding: 8px 4px !important;
}

.checkbox-col input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.item-checkbox {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

/* ============================================================================
   Bulk Actions Toolbar
   ============================================================================ */

.bulk-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-bottom: 12px;
}

.selected-count {
    font-weight: 500;
    color: #495057;
}

.bulk-actions-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
}

.auto-process-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 14px;
    cursor: pointer;
}

.auto-process-label input[type="checkbox"] {
    cursor: pointer;
}

/* ============================================================================
   Full Text Finder Modal
   ============================================================================ */

.full-text-modal-content {
    width: 700px;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.full-text-modal-content .modal-body {
    overflow-y: auto;
    max-height: calc(80vh - 120px);
}

/* Progress Summary */
.progress-summary {
    margin-bottom: 20px;
}

.progress-summary p {
    margin: 0 0 8px 0;
    font-weight: 500;
    color: #212529;
}

#modal-progress-bar {
    width: 100%;
    height: 24px;
    border-radius: 4px;
}

#modal-progress-bar::-webkit-progress-bar {
    background-color: #e9ecef;
    border-radius: 4px;
}

#modal-progress-bar::-webkit-progress-value {
    background-color: #0d6efd;
    border-radius: 4px;
    transition: width 0.3s ease;
}

#modal-progress-bar::-moz-progress-bar {
    background-color: #0d6efd;
    border-radius: 4px;
}

/* Items Progress List */
.items-progress-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: white;
}

.item-progress-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #f1f3f5;
}

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

.item-progress-row:hover {
    background-color: #f8f9fa;
}

.item-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 16px;
    font-size: 14px;
}

/* Status Badges */
.item-status {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    padding: 4px 8px;
    border-radius: 4px;
}

.item-status.pending {
    color: #6c757d;
    background: #f8f9fa;
}

.item-status.processing {
    color: #0d6efd;
    background: #e7f1ff;
    animation: pulse 1.5s ease-in-out infinite;
}

.item-status.success {
    color: #198754;
    background: #d1e7dd;
}

.item-status.failed {
    color: #dc3545;
    background: #f8d7da;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Tooltip for error messages */
.item-status[title] {
    cursor: help;
}

/* Success Summary */
.success-summary {
    margin-top: 20px;
    padding: 16px;
    background: #d1e7dd;
    border: 2px solid #0f5132;
    border-radius: 6px;
}

.success-header {
    font-weight: 600;
    font-size: 15px;
    color: #0f5132;
    margin-bottom: 10px;
}

.success-item {
    padding: 6px 0;
    color: #0a3622;
    font-size: 13px;
}

.source-badge {
    color: #0f5132;
    font-weight: 500;
    font-size: 12px;
}

/* ============================================================================
   PDF Badge (for items with attachments)
   ============================================================================ */

.pdf-badge {
    display: inline-block;
    margin-left: 6px;
    font-size: 14px;
    opacity: 0.7;
}

/* ============================================================================
   Responsive Adjustments
   ============================================================================ */

@media (max-width: 768px) {
    .full-text-modal-content {
        width: 95vw;
    }

    .bulk-actions-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .bulk-actions-buttons {
        width: 100%;
        justify-content: flex-start;
    }

    .item-progress-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .item-title {
        white-space: normal;
        margin-right: 0;
    }
}

/* Recently Updated Badge */
.recently-updated-badge {
    display: inline-block;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 8px;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 1px 3px rgba(16, 185, 129, 0.3);
    animation: pulse-glow 2s ease-in-out infinite;
}

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