/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f8fafc;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}



/* Header */
header {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

header h1 {
    color: #1e293b;
    margin-bottom: 10px;
    font-size: 2rem;
}

.stats {
    display: flex;
    gap: 20px;
    color: #64748b;
    font-size: 0.9rem;
}

.stats span {
    font-weight: 600;
    color: #667eea;
}

.logout-btn {
    padding: 8px 16px;
    border: none;
    background: #ef4444;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.logout-btn:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

/* Auth form styling */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 20px 0;
}

.auth-form input {
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.auth-form input:focus {
    outline: none;
    border-color: #667eea;
}

.auth-form button {
    padding: 12px 24px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-form button:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

.auth-form button:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
}

.auth-error {
    color: #ef4444;
    background: #fef2f2;
    border: 1px solid #fecaca;
    padding: 12px;
    border-radius: 8px;
    margin-top: 16px;
    text-align: center;
}

.auth-actions {
    border-top: 1px solid #e2e8f0;
    padding-top: 20px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 12px 24px;
    border: none;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.tab-btn:hover {
    background: #f1f5f9;
    transform: translateY(-1px);
}

.tab-btn.active {
    background: #667eea;
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Tab Content */
.tab-content {
    display: none;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

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

/* Controls */
.controls {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

/* Sort Controls */
.sort-controls {
    display: flex;
    gap: 8px;
}

.sort-btn {
    padding: 8px 16px;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    color: #64748b;
}

.sort-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.sort-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}
}

.pagination {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pagination button {
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination button:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

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

#page-info {
    font-weight: 600;
    color: #374151;
    min-width: 80px;
    text-align: center;
}

.filters {
    display: flex;
    gap: 10px;
    align-items: center;
}

.filters select,
.filters input {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
}

.filters input {
    min-width: 200px;
}

/* Data Lists */
.data-list {
    padding: 20px;
}

.data-item {
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 12px;
    background: white;
    transition: all 0.2s;
    cursor: pointer;
}

.data-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.data-item h3 {
    color: #1e293b;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.data-item p {
    color: #64748b;
    margin-bottom: 8px;
    line-height: 1.5;
}

.data-item .meta {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: #6b7280;
}

.collection-badge {
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.tag-badge {
    background: #10b981;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.view-details-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    margin-top: 8px;
}

.view-details-btn:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

/* Row layout with thumbnail */
.item-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.thumb {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    background: #f1f5f9;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid #e5e7eb;
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.item-content { 
    flex: 1; 
    position: relative;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    border-radius: 12px 12px 0 0;
}

.back-to-analysis-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.back-to-analysis-btn:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

.modal-header h2 {
    color: #1e293b;
    font-size: 1.5rem;
}

.close {
    color: #6b7280;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close:hover {
    color: #374151;
}

.modal-body {
    padding: 20px;
}

/* Authentication modal specific styles */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 20px 0;
}

.auth-form input[type="password"] {
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.auth-form input[type="password"]:focus {
    outline: none;
    border-color: #667eea;
}

.auth-form button {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.auth-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.auth-error {
    color: #e53e3e;
    background: #fed7d7;
    border: 1px solid #feb2b2;
    padding: 10px;
    border-radius: 6px;
    margin-top: 10px;
    font-size: 14px;
}

/* Bookmark Details */
.bookmark-details h3 {
    color: #1e293b;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.bookmark-details .field {
    margin-bottom: 15px;
}

.bookmark-details .field label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.bookmark-details .field .value {
    padding: 12px;
    background: #f8fafc;
    border-radius: 6px;
    border-left: 4px solid #667eea;
    color: #1e293b;
    line-height: 1.5;
}

.bookmark-details .field .value a {
    color: #667eea;
    text-decoration: none;
}

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

/* AI Analysis Section */
.ai-analysis-section {
    margin-top: 20px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.ai-analysis-section.show {
    display: block;
}

.accordion-header {
    background: #f8fafc;
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    transition: background-color 0.2s;
}

.accordion-header:hover {
    background: #f1f5f9;
}

.accordion-header.active {
    background: #667eea;
    color: white;
}

.accordion-icon {
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.accordion-header.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    display: none;
    padding: 20px;
    background: white;
}

.accordion-content.show {
    display: block;
}

/* AI Analysis Content */
.ai-analysis-content {
    line-height: 1.7;
    color: #374151;
}

.ai-analysis-content strong {
    color: #1e293b;
}

.ai-analysis-content .ai-field {
    margin-bottom: 15px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 6px;
    border-left: 4px solid #10b981;
}

.ai-analysis-content .ai-field.error {
    border-left-color: #ef4444;
    background: #fef2f2;
}

.ai-analysis-content .ai-field.warning {
    border-left-color: #f59e0b;
    background: #fffbeb;
}

.ai-analysis-content .ai-field.info {
    border-left-color: #0ea5e9;
    background: #f0f9ff;
}

/* Loading States */
.loading {
    text-align: center;
    padding: 40px;
    color: #6b7280;
    font-style: italic;
}

.loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

/* Button States */
.analyze-btn {
    background: #10b981;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.analyze-btn:hover:not(:disabled) {
    background: #059669;
    transform: translateY(-1px);
}

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

.analyze-btn.loading {
    background: #6b7280;
}

.cancel-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cancel-btn:hover {
    background: #dc2626;
}

 /* Overlay panel for live analysis */
.overlay-panel {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: min(480px, calc(100% - 40px));
    max-height: 70vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1500;
}

.overlay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
}

.overlay-close {
    border: none;
    background: transparent;
    font-size: 20px;
    cursor: pointer;
    color: #6b7280;
}

.overlay-content {
    padding: 12px 16px;
    overflow-y: auto;
}

/* New Analysis UI styles */
.analysis-progress-container {
    margin-bottom: 12px;
}

.progress-bar {
    width: 100%;
    background: #e5e7eb;
    height: 10px;
    border-radius: 6px;
    overflow: hidden;
}

#analysis-progress-bar-inner {
    height: 100%;
    background: #667eea;
    transition: width 0.2s;
}

.progress-status {
    margin-top: 8px;
    color: #6b7280;
    font-size: 0.9rem;
}

.analysis-log-container {
    margin-top: 10px;
    background: #f8fafc;
    border-radius: 8px;
    padding: 12px;
    max-height: 40vh;
    overflow-y: auto;
}

.log-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.9rem;
}

.log-item {
    padding: 4px 0;
    border-bottom: 1px solid #e5e7eb;
}

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

.log-item.log-success { color: #059669; }
.log-item.log-error { color: #dc2626; }
.log-item.log-done { font-weight: bold; }

.review-prompt {
    text-align: center;
    padding: 10px 0;
}

.unprocessed-list-container {
    max-height: 45vh;
    overflow-y: auto;
    margin: 12px 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px;
}

.review-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 12px;
}

/* Error States */
.ai-analysis-error {
    background: #fef2f2;
    color: #dc2626;
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid #ef4444;
    margin-top: 10px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filters {
        flex-direction: column;
    }
    
    .filters input {
        min-width: auto;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .stats {
        flex-direction: column;
        gap: 5px;
    }
}

/* Debug Styles */
.debug-info {
    background: #f0f9ff;
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid #0ea5e9;
    margin-bottom: 12px;
    font-size: 0.85rem;
}

.debug-step {
    margin-bottom: 5px;
}

.debug-step.complete {
    color: #059669;
}

.debug-step.error {
    color: #dc2626;
}

.debug-step.pending {
    color: #6b7280;
}

/* Modern Analysis Overlay Styles */
.analysis-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.analysis-overlay-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
}

.analysis-overlay-content {
    position: relative;
    background: white;
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    width: min(90vw, 1500px);
    height: min(90vh, 800px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: overlaySlideIn 0.3s ease-out;
}

@keyframes overlaySlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px 16px 0 0;
}

.analysis-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 600;
}

.analysis-icon {
    font-size: 1.8rem;
}

.analysis-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.analysis-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.analysis-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Progress Section */
.analysis-progress-section {
    padding: 20px 24px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.progress-overview {
    display: flex;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
}

.progress-stats {
    display: flex;
    gap: 20px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stat-label {
    font-size: 0.8rem;
    color: #6b7280;
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
}

.stat-value.success {
    color: #10b981;
}

.stat-value.error {
    color: #ef4444;
}

.progress-bar-container {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #10b981 100%);
    border-radius: 8px;
    transition: width 0.3s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
    animation: progressShimmer 2s infinite;
}

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

.progress-text {
    position: absolute;
    top: -25px;
    right: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #4f46e5;
}

/* Actions Section */
.analysis-actions {
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
}

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

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

.action-group label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.mode-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.mode-btn {
    padding: 10px 16px;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    font-weight: 500;
}

.mode-btn:hover {
    border-color: #667eea;
    background: #f8fafc;
}

.mode-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.option-controls {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.option-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    cursor: pointer;
}

.option-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #667eea;
}

.batch-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.batch-controls input {
    width: 80px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
}

.action-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
}

.action-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Content Area */
.analysis-content-area {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Split Layout */
.analysis-split-layout {
    display: flex;
    gap: 20px;
    flex: 1;
    overflow: hidden;
}

.bookmarks-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.logs-section {
    width: 600px;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.logs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #667eea;
    color: white;
    font-size: 0.9rem;
}

.logs-header h4 {
    margin: 0;
    font-size: 1rem;
}

.clear-logs-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
}

.clear-logs-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.content-mode {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
}

.content-mode.active {
    display: flex;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.content-header h3 {
    color: #1e293b;
    margin: 0;
    font-size: 1.2rem;
}

.refresh-btn, .stop-btn {
    background: #6b7280;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.refresh-btn:hover {
    background: #4b5563;
}

.stop-btn {
    background: #ef4444;
}

.stop-btn:hover {
    background: #dc2626;
}

/* Unprocessed List */
.unprocessed-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
}

.unprocessed-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 8px;
    background: white;
    transition: all 0.2s;
}

.unprocessed-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.unprocessed-item .thumb {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    background: #f1f5f9;
    overflow: hidden;
    flex-shrink: 0;
}

.unprocessed-item .content {
    flex: 1;
    min-width: 0;
}

.unprocessed-item h4 {
    margin: 0 0 4px 0;
    color: #1e293b;
    font-size: 1rem;
}

.unprocessed-item .meta {
    display: flex;
    gap: 12px;
    align-items: center;
    font-size: 0.8rem;
    color: #6b7280;
}

.unprocessed-item .actions {
    display: flex;
    gap: 8px;
}

.status-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.status-indicator {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.status-indicator.processing {
    background: #fef3c7;
    color: #92400e;
}

.status-indicator.queued {
    background: #e0e7ff;
    color: #3730a3;
}

.status-indicator.completed {
    background: #d1fae5;
    color: #065f46;
}

.status-indicator.failed {
    background: #fee2e2;
    color: #991b1b;
}

.unprocessed-item.processing {
    border-color: #f59e0b;
    background: #fffbeb;
}

.unprocessed-item.queued {
    border-color: #6366f1;
    background: #f0f9ff;
}

.unprocessed-item.completed {
    border-color: #10b981;
    background: #f0fdf4;
}

.unprocessed-item.failed {
    border-color: #ef4444;
    background: #fef2f2;
}

.unprocessed-item.completed,
.unprocessed-item.processing,
.unprocessed-item.queued {
    cursor: pointer;
}

.unprocessed-item.completed:hover,
.unprocessed-item.processing:hover,
.unprocessed-item.queued:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

/* Simple Processing Status */
.simple-processing-status {
    margin-top: 16px;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.current-item-display {
    display: flex;
    align-items: center;
    gap: 12px;
}

.item-image-small {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    overflow: hidden;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.item-image-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-placeholder {
    font-size: 1rem;
    color: #6b7280;
}

.item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.item-details span {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.9rem;
}

.item-details small {
    color: #6b7280;
    font-size: 0.8rem;
}

.processing-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.stop-btn-small {
    background: #ef4444;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
}

/* Processing Log Accordion */
.processing-log-accordion {
    margin-top: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.processing-log-accordion .accordion-header {
    background: #f8fafc;
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 500;
    font-size: 0.9rem;
    color: #374151;
}

.processing-log-accordion .accordion-header:hover {
    background: #f1f5f9;
}

.processing-log-accordion .accordion-header.active {
    background: #667eea;
    color: white;
}

.processing-log-accordion .accordion-icon {
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.processing-log-accordion .accordion-header.active .accordion-icon {
    transform: rotate(180deg);
}

.processing-log-accordion .accordion-content {
    display: none;
    max-height: 200px;
    overflow-y: auto;
}

.processing-log-accordion .accordion-content.show {
    display: block;
}

/* Processing Container */
.processing-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.current-processing {
    padding: 16px 24px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.processing-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.item-info {
    flex: 1;
}

.item-info h4 {
    margin: 0 0 4px 0;
    color: #1e293b;
    font-size: 1rem;
}

.item-info p {
    margin: 0;
    color: #6b7280;
    font-size: 0.9rem;
}

.item-progress {
    display: flex;
    align-items: center;
}

.progress-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e5e7eb;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Processing Summary */
.processing-summary {
    display: flex;
    gap: 20px;
    padding: 16px 24px;
    background: white;
    border-bottom: 1px solid #e2e8f0;
    justify-content: center;
}

.summary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.summary-label {
    font-size: 0.8rem;
    color: #6b7280;
    font-weight: 500;
    margin-bottom: 4px;
}

.summary-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1e293b;
}

.summary-value.success {
    color: #10b981;
}

.summary-value.error {
    color: #ef4444;
}

/* Log Accordion */
.log-accordion {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.log-accordion .accordion-header {
    background: #f8fafc;
    padding: 12px 24px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    transition: background-color 0.2s;
    font-weight: 600;
    color: #374151;
}

.log-accordion .accordion-header:hover {
    background: #f1f5f9;
}

.log-accordion .accordion-header.active {
    background: #667eea;
    color: white;
}

.log-accordion .accordion-icon {
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.log-accordion .accordion-header.active .accordion-icon {
    transform: rotate(180deg);
}

.log-accordion .accordion-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.log-accordion .accordion-content.show {
    display: flex;
}

.log-accordion .accordion-content:not(.show) {
    display: none;
}

/* Processing Log */
.processing-log {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: white;
    font-size: 0.85rem;
    max-height: calc(100vh - 300px); /* Prevent overflow beyond modal */
}

.log-entry {
    display: flex;
    gap: 8px;
    padding: 8px 0;
    font-size: 0.85rem;
    border-bottom: 1px solid #e2e8f0;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-entry .timestamp {
    color: #6b7280;
    font-size: 0.75rem;
    min-width: 60px;
    flex-shrink: 0;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
}

.log-entry .message {
    flex: 1;
    word-break: break-word;
}

.log-item-info {
    display: flex;
    gap: 8px;
    flex: 1;
    align-items: flex-start;
}

.log-image {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    overflow: hidden;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.log-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.log-placeholder {
    font-size: 0.8rem;
    color: #6b7280;
}

.log-details {
    flex: 1;
    min-width: 0;
}

.log-title {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.8rem;
    margin-bottom: 2px;
    word-break: break-word;
}

.log-message {
    color: #6b7280;
    font-size: 0.75rem;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
}

.log-entry.success {
    color: #10b981;
}

.log-entry.error {
    color: #ef4444;
}

.log-entry.info {
    color: #3b82f6;
}

.log-entry.warning {
    color: #f59e0b;
}

/* Processing Results */
.processing-results {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 8px;
    background: white;
}

.result-item.success {
    border-color: #10b981;
    background: #f0fdf4;
}

.result-item.error {
    border-color: #ef4444;
    background: #fef2f2;
}

.result-item .status {
    font-size: 1.2rem;
}

.result-item .content {
    flex: 1;
}

.result-item h4 {
    margin: 0 0 4px 0;
    font-size: 1rem;
}

.result-item .meta {
    font-size: 0.8rem;
    color: #6b7280;
}

/* Stream Log */
.stream-log {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
    background: #f8fafc;
}

.log-entry {
    display: flex;
    gap: 8px;
    padding: 4px 0;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    font-size: 0.85rem;
    border-bottom: 1px solid #e2e8f0;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-entry .timestamp {
    color: #6b7280;
    font-size: 0.75rem;
    min-width: 60px;
}

.log-entry .level {
    font-weight: 600;
    min-width: 50px;
}

.log-entry.success {
    color: #10b981;
}

.log-entry.error {
    color: #ef4444;
}

.log-entry.info {
    color: #3b82f6;
}

.log-entry.warning {
    color: #f59e0b;
}

/* Status Bar */
.analysis-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-icon {
    font-size: 1.2rem;
}

.status-text {
    font-size: 0.9rem;
    color: #374151;
    font-weight: 500;
}

.status-actions {
    display: flex;
    gap: 8px;
}

.status-btn {
    background: #6b7280;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.status-btn:hover {
    background: #4b5563;
}

/* Loading and Empty States */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #6b7280;
}

.loading-state .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f3f4f6;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
    color: #6b7280;
}

.empty-state p {
    margin: 0;
    font-size: 1rem;
}



/* Responsive adjustments */
@media (max-width: 768px) {
    .analysis-overlay-content {
        width: 99vw;
        height: 95vh;
    }

    .progress-overview {
        flex-direction: column;
        align-items: stretch;
        gap: 20px;
    }

    .progress-stats {
        justify-content: center;
    }

    .option-controls {
        flex-direction: column;
        gap: 12px;
    }

    .batch-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .content-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
}

/* Chat Interface Styles */
.chat-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.chat-log {
  height: 400px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
  background: #f9f9f9;
}

.chat-status {
  margin-bottom: 10px;
  font-style: italic;
  color: #666;
  min-height: 20px;
}

.chat-form {
  display: flex;
  gap: 10px;
}

.chat-form input {
  flex: 1;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

.chat-form button {
  padding: 10px 20px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.chat-form button:hover {
  background: #0056b3;
}

.message {
  margin-bottom: 15px;
  padding: 10px;
  border-radius: 8px;
  max-width: 80%;
}

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

.assistant-message {
  background: #e9ecef;
  color: #333;
  margin-right: auto;
  white-space: pre-wrap;
  font-family: monospace;
  font-size: 12px;
  overflow-x: auto;
}

/* ===== EMBEDDINGS ANALYSIS CENTER STYLES ===== */

.embeddings-container {
    padding: 20px;
}

.embeddings-container h2 {
    color: #1e293b;
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.embeddings-overview {
    background: #f8fafc;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.embeddings-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.embeddings-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 8px;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-group label {
    font-weight: 600;
    color: #374151;
}

.control-group select {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    font-size: 14px;
}

.generate-btn, .search-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.generate-btn {
    background: #667eea;
    color: white;
}

.generate-btn:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

.search-btn {
    background: #10b981;
    color: white;
}

.search-btn:hover {
    background: #059669;
    transform: translateY(-1px);
}

.embeddings-preview {
    background: white;
    border-radius: 8px;
    padding: 20px;
}

.embeddings-preview h3 {
    color: #1e293b;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.embeddings-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.generate-embedding-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    background: #667eea;
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.generate-embedding-btn:hover {
    background: #5a67d8;
    transform: scale(1.05);
}

.generate-embedding-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

.generate-embedding-btn.processing {
    background: #f59e0b;
    animation: pulse 1.5s infinite;
}

.generate-embedding-btn.success {
    background: #10b981;
}

.generate-embedding-btn.error {
    background: #ef4444;
}

.processing-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 10;
}

.processing-indicator .spinner {
    width: 12px;
    height: 12px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

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

/* Embeddings overlay specific styles */
#embeddings-overlay .analysis-overlay-content {
    max-width: 1200px;
    width: 95%;
    max-height: 90vh;
}

#embeddings-overlay .progress-fill {
    background: linear-gradient(90deg, #667eea, #764ba2);
}

#embeddings-overlay .start-btn {
    background: #667eea;
}

#embeddings-overlay .start-btn:hover {
    background: #5a67d8;
}

/* Back button styles for embeddings modal */
.back-to-embeddings-btn {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #f9fafb;
    color: #374151;
    cursor: pointer;
    font-size: 12px;
    margin-right: 10px;
    transition: all 0.2s;
}

.back-to-embeddings-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}
