/* DMP Evaluation Tool - Custom Styles */

:root {
    --primary-color: #0d6efd;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --border-radius: 8px;
}

body {
    background-color: #f8f9fa;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Upload Zones */
.upload-zone {
    border: 3px dashed #dee2e6;
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    background-color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-zone:hover {
    border-color: var(--primary-color);
    background-color: #f8f9fa;
}

.upload-zone.drag-over {
    border-color: var(--primary-color);
    background-color: #e7f3ff;
    transform: scale(1.02);
}

.upload-zone i {
    transition: transform 0.3s ease;
}

.upload-zone:hover i {
    transform: scale(1.1);
}

/* Cards */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.card-header {
    background-color: #fff;
    border-bottom: 2px solid #f0f0f0;
    font-weight: 600;
    padding: 1rem 1.25rem;
}

/* Progress Bar */
.progress {
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    font-weight: bold;
    font-size: 1rem;
    transition: width 0.6s ease;
}

/* Score Status Badges */
.score-badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
}

.score-excellent {
    background-color: #d1f4e0;
    color: #0a6638;
}

.score-good {
    background-color: #d4edda;
    color: #155724;
}

.score-pass {
    background-color: #fff3cd;
    color: #856404;
}

.score-insufficient {
    background-color: #f8d7da;
    color: #721c24;
}

/* Narrative Feedback Sections */
.feedback-section {
    background-color: #fff;
    border-left: 4px solid var(--primary-color);
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.feedback-section h6 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.feedback-section.excellent {
    border-left-color: var(--success-color);
}

.feedback-section.excellent h6 {
    color: var(--success-color);
}

.feedback-section.good {
    border-left-color: #28a745;
}

.feedback-section.good h6 {
    color: #28a745;
}

.feedback-section.pass {
    border-left-color: var(--warning-color);
}

.feedback-section.pass h6 {
    color: #d39e00;
}

.feedback-section.insufficient {
    border-left-color: var(--danger-color);
}

.feedback-section.insufficient h6 {
    color: var(--danger-color);
}

/* Tables */
.table {
    margin-bottom: 0;
}

.table thead th {
    border-bottom: 2px solid #dee2e6;
    text-transform: uppercase;
    font-size: 0.875rem;
    font-weight: 600;
    color: #6c757d;
}

.table tbody tr {
    transition: background-color 0.2s ease;
}

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

/* Buttons */
.btn {
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

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

.btn-group .btn {
    transition: none;
}

.btn-group .btn:hover {
    transform: none;
}

/* Status Animations */
.spinner-border-sm {
    width: 1.5rem;
    height: 1.5rem;
}

/* File Info Alert */
.alert {
    border-radius: 6px;
    display: flex;
    align-items: center;
}

.alert .btn-close {
    margin-left: auto;
}

/* Responsive Adjustments */
@media (max-width: 991px) {
    .col-lg-5, .col-lg-7 {
        margin-bottom: 2rem;
    }
}

/* Header */
header {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

header h1 {
    color: #212529;
}

/* Score Cell */
.score-cell {
    font-weight: 600;
    font-size: 1.1rem;
}

/* Category Labels */
.category-label {
    font-weight: 600;
    color: #495057;
}

/* Criterion ID Column */
.criterion-id {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-weight: 600;
    text-align: center;
    color: #0d6efd;
    font-size: 0.9rem;
    background-color: #f8f9fa;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: var(--border-radius);
}

/* Fade-in Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

/* Small text improvements */
small, .small {
    font-size: 0.875rem;
}

/* Input focus states */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

/* Custom scrollbar for narrative sections */
#narrativeFeedback {
    max-height: 600px;
    overflow-y: auto;
}

#narrativeFeedback::-webkit-scrollbar {
    width: 8px;
}

#narrativeFeedback::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

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

#narrativeFeedback::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* API Configuration Modal */
.code-preview-container {
    background-color: #1e1e1e;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #dee2e6;
}

.code-preview {
    background-color: #1e1e1e;
    color: #d4d4d4;
    padding: 1rem;
    margin: 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
}

.code-preview::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.code-preview::-webkit-scrollbar-track {
    background: #2d2d2d;
}

.code-preview::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.code-preview::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* API Config Modal sizing */
#apiConfigModal .modal-dialog {
    max-width: 800px;
}

/* Additional header input rows */
#additionalHeadersContainer .input-group {
    margin-bottom: 0.5rem;
}

#additionalHeadersContainer .input-group input:first-child {
    flex: 0 0 40%;
}

#additionalHeadersContainer .input-group input:last-of-type {
    flex: 0 0 50%;
}

#additionalHeadersContainer .input-group button {
    flex: 0 0 10%;
}

/* API Config button styling - unified for both buttons */
#openAPIConfigBtn,
#editPromptBtn {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
}

/* Upload section action buttons - unified styling */
#criteriaButtons,
#dmpButtons {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

#criteriaButtons .btn,
#dmpButtons .btn {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
    flex: 1 1 0;
}

/* Custom profile name group */
#customProfileNameGroup {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

/* Accordion styling in modal */
#apiConfigModal .accordion-button {
    font-weight: 500;
    font-size: 0.95rem;
}

#apiConfigModal .accordion-button:not(.collapsed) {
    background-color: #e7f3ff;
    color: var(--primary-color);
}

/* Delete profile button */
#deleteProfileBtn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Paste Text Modals */
#pasteCriteriaModal .modal-dialog,
#pasteDmpModal .modal-dialog {
    max-width: 900px;
}

#criteriaTextArea,
#dmpTextArea {
    font-size: 0.9rem;
    line-height: 1.6;
    resize: vertical;
    min-height: 400px;
}

/* Alert styling in paste modals */
#pasteCriteriaModal .alert,
#pasteDmpModal .alert {
    border-radius: 6px;
    font-size: 0.9rem;
}

/* Checkbox for default criteria */
#useDefaultCriteria {
    cursor: pointer;
}

.form-check-label {
    cursor: pointer;
    user-select: none;
}

/* Monospace font for textareas */
.font-monospace {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

/* Scrollable Columns */
.scrollable-column {
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    padding-right: 15px;
    padding-left: 15px;
}

.scrollable-column::-webkit-scrollbar {
    width: 10px;
}

.scrollable-column::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 5px;
}

.scrollable-column::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

.scrollable-column::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* File warning tooltip */
#criteriaFileName[title],
#dmpFileName[title] {
    cursor: help;
    border-bottom: 1px dotted #17a2b8;
    color: #0c5460;
}

/* Processing indicator */
.processing-doc {
    animation: pulse 2s infinite;
}

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

/* Compact alert styling */
.alert {
    font-size: 0.95rem;
}

.alert-success {
    padding: 0.5rem 1rem;
}

/* ======================================
   STREAMING OUTPUT DISPLAY
   ====================================== */

/* Streaming container */
#streamingOutputContainer {
    margin-top: 1rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    max-height: 500px;
    overflow-y: auto;
}

/* Section headers */
.streaming-section-header {
    color: #495057;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    padding: 0.25rem 0;
}

/* Content areas */
.streaming-content {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    padding: 0.75rem;
    border-radius: 4px;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    min-height: 50px;
    position: relative;
}

/* Reasoning content (thinking) */
.reasoning-content {
    background-color: #fff9e6;
    border-color: #ffd966;
    color: #856404;
}

/* Response content */
.response-content {
    background-color: #f0f8ff;
    border-color: #b8d4e8;
    color: #0c5460;
}

/* Streaming cursor animation */
.streaming-content::after {
    content: '▊';
    animation: blink 1s infinite;
    margin-left: 2px;
    color: #0d6efd;
}

.streaming-content.stream-complete::after {
    content: '';
    animation: none;
}

@keyframes blink {
    0%, 49% {
        opacity: 1;
    }
    50%, 100% {
        opacity: 0;
    }
}

/* Custom scrollbar for streaming container */
#streamingOutputContainer::-webkit-scrollbar {
    width: 8px;
}

#streamingOutputContainer::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

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

#streamingOutputContainer::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Smooth scroll behavior */
#streamingOutputContainer {
    scroll-behavior: smooth;
}

/* ======================================
   SENTENCE EVALUATION CARDS
   ====================================== */

/* Sentence Evaluation Cards */
.sentence-evaluation-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: box-shadow 0.2s;
}

.sentence-evaluation-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.sentence-text {
    font-size: 1rem;
    line-height: 1.6;
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 0.75rem;
    border-left: 4px solid #6c757d;
    background-color: #f8f9fa;
}

.sentence-text.excellent {
    border-left-color: #0a6638;
    background-color: #d1f4e0;
}

.sentence-text.good {
    border-left-color: #28a745;
    background-color: #d4edda;
}

.sentence-text.pass {
    border-left-color: #ffc107;
    background-color: #fff3cd;
}

.sentence-text.insufficient {
    border-left-color: #dc3545;
    background-color: #f8d7da;
}

.sentence-number {
    display: inline-block;
    background: #6c757d;
    color: white;
    font-size: 0.75rem;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    margin-right: 0.5rem;
    font-weight: 600;
}

.sentence-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.criteria-tags {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.criteria-tag {
    display: inline-block;
    background: #e9ecef;
    color: #495057;
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-weight: 600;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.criteria-tag:hover {
    background: #0d6efd;
    color: white;
    cursor: default;
}

.sentence-score {
    font-size: 1rem;
}

.sentence-explanation {
    font-size: 0.875rem;
    color: #6c757d;
    font-style: italic;
    padding-top: 0.5rem;
    border-top: 1px dashed #e9ecef;
    line-height: 1.5;
}

/* Feedback header */
.feedback-header h6 {
    color: #212529;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

/* Adjust narrative feedback container for sentence cards */
#narrativeFeedback {
    max-height: 800px;
    overflow-y: auto;
}

/* ======================================
   ACCORDION SENTENCE CARDS
   ====================================== */

.sentence-card-accordion {
    background: #fff;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: box-shadow 0.2s ease;
}

.sentence-card-accordion:hover {
    box-shadow: 0 3px 10px rgba(0,0,0,0.12);
}

.sentence-header {
    padding: 1rem 1.25rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid #6c757d;
    transition: background-color 0.2s ease;
    user-select: none;
}

.sentence-header.excellent {
    border-left-color: #0a6638;
    background: linear-gradient(90deg, #d1f4e0 0%, #fff 20%);
}

.sentence-header.good {
    border-left-color: #28a745;
    background: linear-gradient(90deg, #d4edda 0%, #fff 20%);
}

.sentence-header.pass {
    border-left-color: #ffc107;
    background: linear-gradient(90deg, #fff3cd 0%, #fff 20%);
}

.sentence-header.insufficient {
    border-left-color: #dc3545;
    background: linear-gradient(90deg, #f8d7da 0%, #fff 20%);
}

.sentence-header:hover {
    filter: brightness(0.98);
}

.sentence-preview {
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #333;
}

.expand-indicator {
    color: #adb5bd;
    transition: transform 0.2s ease;
    margin-left: 1rem;
}

.sentence-card-accordion.expanded .expand-indicator {
    transform: rotate(90deg);
    color: #4fb3d9;
}

.sentence-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    background-color: #fafbfc;
    border-top: 1px solid transparent;
}

.sentence-card-accordion.expanded .sentence-body {
    max-height: 500px;
    padding: 1rem 1.25rem;
    border-top-color: #e9ecef;
}

.sentence-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.score-display {
    flex-shrink: 0;
}

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

.improvement-suggestion {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(90deg, #fff8e1 0%, #fffdf5 100%);
    border-radius: 6px;
    border-left: 3px solid #ffc107;
    font-size: 0.875rem;
    color: #664d03;
}

/* Update brand colors to match elab2arc */
:root {
    --brand-primary: #4fb3d9;
    --brand-primary-hover: #3a9fc5;
}
