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

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

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

/* Header */
.app-header { display: none; }

/* Main content */
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: none; /* Remove width constraint */
    margin: 0 auto;
    width: 100%;
}

/* Upload section */
.upload-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

.upload-area {
    border: 3px dashed #cbd5e0;
    border-radius: 12px;
    padding: 3rem;
    text-align: center;
    background: white;
    transition: all 0.3s ease;
    cursor: pointer;
    min-width: 400px;
}

.upload-area:hover {
    border-color: #2563eb;
    background: #f7fafc;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.upload-area h3 {
    color: #4a5568;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.upload-area p {
    color: #718096;
    margin-bottom: 1.5rem;
}

.upload-btn {
    background: #2563eb;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* Workspace */
.workspace {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    min-height: calc(100vh - 200px);
    height: auto;
    align-items: flex-start; /* Align grid items to top */
}

/* PDF viewer */
.pdf-viewer-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    overflow: visible; /* Allow content to be fully visible */
    display: flex;
    flex-direction: column;
    height: auto; /* Let content determine height */
    min-height: 0; /* Remove minimum height constraints */
}

.pdf-controls {
    padding: 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.page-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 14px;
}

.page-input-group input {
    width: 60px;
    padding: 4px 8px;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
}

.page-input-group button {
    background: #4a5568;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.pdf-controls button {
    background: #4a5568;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.pdf-controls button:hover:not(:disabled) {
    background: #2d3748;
}

.pdf-controls button:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.zoom-controls button {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pdf-viewer {
    flex: 1 1 auto; /* Allow growing and shrinking */
    overflow: auto; /* Allow both horizontal and vertical scrolling */
    padding: 1rem;
    background: #f8f9fa;
    position: relative;
    width: 100%; /* Use full available width */
    min-height: 400px; /* Minimum viewing height */
    max-height: none; /* Remove any height constraints */
}

.pdf-container {
    position: relative;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center; /* Center pages horizontally */
    gap: 20px;
    width: 100%; /* Use full container width */
    overflow: visible; /* Ensure content isn't clipped */
    min-width: fit-content; /* Ensure container grows with content */
}

#pdfCanvas {
    display: block;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.text-layer {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    opacity: 1;
    line-height: 1.0;
    z-index: 10;
    pointer-events: auto;
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

.text-layer > span {
    color: rgba(0, 0, 0, 0.01);
    position: absolute;
    white-space: pre;
    cursor: text;
    transform-origin: 0% 0%;
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

.text-layer > div {
    color: rgba(0, 0, 0, 0.01);
    cursor: text;
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    background: rgba(255, 0, 0, 0.05);
}

.text-layer .highlight {
    margin: -1px;
    padding: 1px;
    background-color: rgba(180, 0, 170, 0.2);
    border-radius: 4px;
}

.text-layer ::selection {
    background: rgba(0, 0, 255, 0.3);
}

.loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Data panel */
.data-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: sticky;
    top: 2rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    align-self: flex-start; /* Stick to top of grid cell */
    z-index: 10; /* Ensure it stays above other content */
}

.metadata-panel, .selection-inputs, .data-list {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.metadata-panel {
    border-left: 4px solid #2563eb; /* Blue accent */
    animation: fadeInSlide 0.5s ease-out;
}

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

.metadata-inputs {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.metadata-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.metadata-actions button {
    flex: 1;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

#updateMetadata {
    background: #48bb78;
    color: white;
}

#updateMetadata:hover {
    background: #38a169;
}

#resetMetadata {
    background: #e2e8f0;
    color: #4a5568;
}

#resetMetadata:hover {
    background: #cbd5e0;
}

.data-list {
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.saved-data-container {
    flex: 1; /* Take up available space */
    overflow-y: auto;
    min-height: 100px; /* Minimum height to see some content */
    margin-bottom: 1rem;
}

.selection-inputs h3, .data-list h3 {
    color: #2d3748;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.input-group {
    margin-bottom: 1rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #4a5568;
    font-weight: 500;
}

.input-group textarea {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    resize: vertical;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    transition: border-color 0.3s ease;
}

.input-group textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.action-buttons button {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#saveData {
    background: #48bb78;
    color: white;
}

#saveData:hover:not(:disabled) {
    background: #38a169;
}

#saveData:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
}

#clearData {
    background: #4b5563;
    color: white;
}

#clearData:hover {
    background: #dd6b20;
}

/* Data list */
.data-count {
    color: #718096;
    margin-bottom: 1rem;
    font-size: 14px;
}


.data-item {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 8px;
    position: relative;
}

.data-item-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 8px;
}

.data-item-id {
    font-size: 12px;
    color: #718096;
    font-weight: 500;
}

.delete-btn {
    background: #f56565;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
}

.data-item-content {
    font-size: 13px;
    line-height: 1.4;
}

.target-text {
    color: #2d3748;
    margin-bottom: 4px;
}

.source-info {
    color: #4a5568;
    font-style: italic;
}

.export-controls {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
#exportMain {
    flex: 1;
    padding: 8px 16px;
    background: #4299e1;
    color: white;
    border: none;
    border-radius: 4px 0 0 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}
#exportMain:hover { background: #3182ce; }
.export-split {
    position: relative;
}
.export-dropdown-btn {
    padding: 8px 10px;
    background: #3182ce;
    color: white;
    border: none;
    border-left: 1px solid rgba(255,255,255,0.3);
    border-radius: 0 4px 4px 0;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.3s ease;
    height: 100%;
}
.export-dropdown-btn:hover { background: #2b6cb0; }
.export-dropdown-menu {
    display: none;
    position: absolute;
    bottom: calc(100% + 4px);
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    list-style: none;
    padding: 4px 0;
    margin: 0;
    min-width: 220px;
    z-index: 100;
}
.export-dropdown-menu li {
    padding: 9px 16px;
    font-size: 13px;
    color: #2d3748;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}
.export-dropdown-menu li:hover:not(.disabled):not(.export-divider) {
    background: #ebf8ff;
    color: #2b6cb0;
}
.export-dropdown-menu li.disabled {
    color: #a0aec0;
    cursor: not-allowed;
}
.export-divider {
    height: 1px;
    background: #e2e8f0;
    padding: 0 !important;
    margin: 4px 0;
}
.export-split:hover .export-dropdown-menu,
.export-dropdown-menu:hover {
    display: block;
}
.data-list h3 {
    margin-top: 0;
}
    background: #3182ce;
}

/* Status bar */
.status-bar {
    background: #2d3748;
    color: white;
    padding: 8px 2rem;
    font-size: 14px;
    text-align: center;
}

/* Text selection highlighting */
.selected-text {
    background: rgba(102, 126, 234, 0.3) !important;
    border-radius: 2px;
}

/* Responsive design */
@media (max-width: 1024px) {
    .workspace {
        grid-template-columns: 1fr;
        grid-template-rows: 60vh auto;
    }
    
    .data-panel {
        position: static; /* Remove sticky behavior on mobile */
        max-height: none;
        overflow-y: visible;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .app-header {
        padding: 1.5rem;
    }
    
    .app-header h1 {
        font-size: 2rem;
    }
}

@media (max-width: 640px) {
    .upload-area {
        padding: 2rem 1rem;
        min-width: auto;
    }
    
    .pdf-controls {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .export-controls {
        flex-direction: column;
    }
}

/* Loading state */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #718096;
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 2px solid #cbd5e0;
    border-top: 2px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Continuous PDF view styles */
.page-wrapper {
    background: white;
    border-radius: 8px;
    overflow: visible; /* Allow content to be fully visible */
    width: auto; /* Let content determine width */
    max-width: none; /* Remove width constraint */
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    display: inline-block; /* Fit content size */
}

.page-header {
    background: #f8f9fa;
    padding: 8px 16px;
    border-bottom: 1px solid #e9ecef;
    font-size: 14px;
    font-weight: 600;
    color: #6c757d;
}

.page-content {
    position: relative;
    background: white;
    overflow: visible; /* Ensure content isn't clipped */
    width: auto; /* Let content determine width */
    height: auto; /* Let content determine height */
}

.page-content canvas {
    display: block;
    width: auto; /* Use natural canvas width */
    height: auto; /* Use natural canvas height */
    max-width: none; /* Remove any width constraints */
    max-height: none; /* Remove any height constraints */
}

.zoom-controls select {
    padding: 4px 8px;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    background: white;
    font-size: 14px;
}

.loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Citation Integration Styles */
.citation-controls {
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.find-sources-btn {
    background: #2563eb;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.3);
}

.find-sources-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.4);
}

.find-sources-btn:disabled {
    background: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-icon {
    font-size: 1rem;
}

.citation-status {
    font-size: 0.85rem;
    color: #666;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.citation-status.loading {
    color: #2196F3;
}

.citation-status.success {
    color: #2563eb;
}

.citation-status.error {
    color: #f44336;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
}

.modal-container.small {
    max-width: 500px;
}

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

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8f9fa;
}

.modal-header h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.3rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6c757d;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #e9ecef;
    color: #495057;
}

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

.modal-footer {
    padding: 1rem 2rem;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    background: #f8f9fa;
}

.btn-primary, .btn-secondary {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #1e40af);
    color: white;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
}

.btn-secondary:hover {
    background: #e9ecef;
}

/* Citation Query Display */
.citation-query {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border-left: 4px solid #2563eb;
}

.citation-query strong {
    color: #2c3e50;
}

/* Source Type Tabs */
.source-type-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

.tab-btn {
    background: none;
    border: none;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: #6c757d;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: #495057;
    background: #f8f9fa;
}

.tab-btn.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
    font-weight: 500;
}

/* Candidates Container */
.candidates-container {
    min-height: 300px;
    position: relative;
}

.loading-candidates {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1rem;
    padding: 3rem;
    color: #6c757d;
}

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

.no-candidates {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

.no-results-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.no-candidates h3 {
    margin-bottom: 0.5rem;
    color: #495057;
}

/* Passage Candidate Cards */
.candidate-card {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 1.5rem;
    background: white;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.candidate-card:hover {
    border-color: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.candidate-card.selected {
    border-color: #2563eb;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
}

.candidate-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.source-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.source-type-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.source-type-badge.bible {
    background: #e8f5e8;
    color: #2e7d32;
}

.source-type-badge.literature {
    background: #fff3e0;
    color: #f57c00;
}

.source-title {
    font-weight: 600;
    color: #2c3e50;
    font-size: 1rem;
}

.confidence-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.confidence-score {
    font-weight: 600;
    font-size: 0.9rem;
}

.confidence-score.high {
    color: #2563eb;
}

.confidence-score.medium {
    color: #ff9800;
}

.confidence-score.low {
    color: #f44336;
}

.confidence-bar {
    width: 60px;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    transition: width 0.3s ease;
}

.confidence-fill.high {
    background: #2563eb;
}

.confidence-fill.medium {
    background: linear-gradient(90deg, #ff9800, #FFB74D);
}

.confidence-fill.low {
    background: linear-gradient(90deg, #f44336, #EF5350);
}

.passage-preview {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    border-left: 4px solid #e9ecef;
    font-style: italic;
    line-height: 1.5;
}

.passage-text {
    color: #495057;
    margin-bottom: 0.5rem;
}

.passage-citation {
    font-size: 0.85rem;
    color: #6c757d;
    font-style: normal;
}

.candidate-metadata {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

.metadata-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.metadata-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metadata-value {
    color: #495057;
    font-size: 0.9rem;
}

.select-candidate-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #2563eb;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    opacity: 0;
    transition: all 0.2s ease;
}

.candidate-card:hover .select-candidate-btn {
    opacity: 1;
}

.select-candidate-btn:hover {
    background: #5a6fd8;
}

/* Selection Summary */
.selection-summary {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.summary-section h4 {
    margin-bottom: 0.75rem;
    color: #2c3e50;
    font-size: 1rem;
    font-weight: 600;
}

.source-preview, .target-preview {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid #2563eb;
    font-style: italic;
    line-height: 1.5;
    color: #495057;
}

/* Responsive Design */
@media (max-width: 768px) {
    .modal-container {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }

    .modal-header, .modal-content, .modal-footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .candidate-metadata {
        grid-template-columns: 1fr;
    }

    .source-type-tabs {
        flex-wrap: wrap;
    }
}


/* ========== AUTO-FILL TOGGLE & INDICATOR ========== */

/* Selection Header */
.selection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.selection-header h3 {
    margin: 0;
}

.auto-fill-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toggle-label {
    font-size: 0.85rem;
    color: #666;
    user-select: none;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 22px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #2563eb;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

/* Current Target Indicator */
.current-target-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    background: #2563eb;
    color: white;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
    animation: subtle-pulse 2s ease-in-out infinite;
}

.current-target-indicator.disabled {
    background: #9e9e9e;
    animation: none;
}

.indicator-icon {
    font-size: 1rem;
    animation: point-right 1s ease-in-out infinite;
}

.indicator-text strong {
    text-decoration: underline;
}

/* Input Group Highlighting */
#targetTextGroup.next-target,
#sourceInfoGroup.next-target {
    background: rgba(102, 126, 234, 0.08);
    border-radius: 8px;
    box-shadow: inset 0 0 0 2px #2563eb;
}

#targetTextGroup.next-target textarea,
#sourceInfoGroup.next-target textarea {
    border-color: #2563eb;
}

#targetTextGroup.completed,
#sourceInfoGroup.completed {
    background: rgba(72, 187, 120, 0.08);
    border-radius: 8px;
    box-shadow: inset 0 0 0 2px #48bb78;
}

#targetTextGroup.completed textarea,
#sourceInfoGroup.completed textarea {
    border-color: #48bb78;
}

#targetTextGroup.completed label::after,
#sourceInfoGroup.completed label::after {
    content: " ✓";
    color: #48bb78;
    font-weight: bold;
}

/* Animations */
@keyframes subtle-pulse {
    0%, 100% { box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3); }
    50% { box-shadow: 0 3px 10px rgba(102, 126, 234, 0.5); }
}

@keyframes point-right {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(2px); }
}


