/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3B82F6;     /* blue-500 */
    --primary-dark:  #1D4ED8;     /* blue-700 */
    --primary-light: #60A5FA;     /* blue-400 */

    --secondary-color:#6B7280;    /* gray-500 */
    --success-color:  #16A34A;
    --error-color:    #DC2626;
    --warning-color:  #D97706;

    --bg-color:       #FAFAFA;
    --bg-secondary:   #FFFFFF;

    --text-primary:   #111827;    /* gray-900 */
    --text-secondary: #4B5563;    /* gray-600 */

    --border-color:   #E5E7EB;    /* gray-200 */

    --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 10px 20px rgba(0,0,0,.10);
    --shadow-lg: 0 25px 50px rgba(0,0,0,.12);

    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

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

/* Header */
.app-header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    box-shadow: var(--shadow-sm);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Screen Management */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* Login Screen */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
}

.login-card {
    background: var(--bg-secondary);
    padding: 3rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}

.login-card h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    text-align: center;
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    margin-top: 2rem;
    text-align: center;
}

.login-logo{
  display: flex;
  justify-content: center; /* keep the whole group centered */
  align-items: flex-end;   /* bottom aligned */
  gap: 0.75rem;
  margin-bottom: 1.5rem;   /* keep your spacing */
  text-align: left;        /* text-align center no longer needed */
}

.login-logo img{
  max-width: 40px;         /* or keep 200px if you want it big */
  height: auto;
  display: block;
}

.login-logo-text{
  line-height: 1;
  font-size: 1.8rem;
  font-weight: 600;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control,
input[type="text"],
input[type="password"],
select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: all 0.2s;
    background-color: rgb(245, 245, 245); /*var(--bg-secondary);*/
}

.form-control:focus,
input:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

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

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-secondary:hover {
    background-color: #475569;
}

.btn-nocolor {
    background-color: var(--bg-color);
    color: darkgray;
    border-color: lightgray;
    border-width: thin;
}

.btn-nocolor:hover {
    background-color: rgb(240, 240, 240);
}

.btn-block {
    width: 100%;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

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

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

/* Workflow Steps */
.workflow-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.workflow-step {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

.step-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.step-number {
    width: 40px;
    height: 40px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
}

.step-header h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 3rem;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--primary-color);
    background-color: rgba(79, 70, 229, 0.05);
}

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

.upload-text {
    font-size: 1.125rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.upload-subtext {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* File List */
.file-list {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background-color: var(--bg-color);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.file-icon {
    font-size: 1.5rem;
}

.file-details {
    display: flex;
    flex-direction: column;
}

.file-name {
    font-weight: 500;
    color: var(--text-primary);
}

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

.file-remove {
    background: none;
    border: none;
    color: var(--error-color);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.5rem;
}

/* Template Selection */
.template-description {
    margin-top: 1rem;
    padding: 1rem;
    background-color: var(--bg-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

/* Progress Area */
.progress-area {
    margin-top: 1.5rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--bg-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.progress-fill {
    height: 100%;
    background-color: var(--primary-color);
    width: 0%;
    transition: width 0.3s;
}

/* Indeterminate progress bar (for unknown duration tasks) */
.progress-fill.indeterminate {
    width: 100%;
    background: linear-gradient(
        90deg,
        var(--primary-color) 25%,
        var(--primary-dark) 50%,
        var(--primary-color) 75%
    );
    background-size: 200% 100%;
    animation: progressIndeterminate 1.5s linear infinite;
    transition: none;
}

@keyframes progressIndeterminate {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.progress-text {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
    margin-bottom: -2px;
}

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

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-pane {
    display: none;
}

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

/* Content Box */
.content-box {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    max-height: 600px;
    overflow-y: auto;
}

.content-box pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.9375rem;
    line-height: 1.6;
}

#transcriptSection .content-box {
    min-height: 65vh;
    max-height: 70vh;
}

/* Audio Players */
.audio-players {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.audio-player-item {
    background-color: var(--bg-color);
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.audio-player-item h4 {
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.audio-player-item audio {
    width: 100%;
}

/* Report Actions */
.report-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

/* Error Message */
.error-message {
    color: var(--error-color);
    font-size: 0.9375rem;
    margin-top: 0.5rem;
    display: none;
}

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

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: var(--text-primary);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    transform: translateY(200%);
    transition: transform 0.3s;
    z-index: 1000;
    max-width: 400px;
}

.toast.show {
    transform: translateY(0);
}

.toast.success {
    background-color: var(--success-color);
}

.toast.error {
    background-color: var(--error-color);
}

/* Footer */
.app-footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }

    .workflow-step {
        padding: 1.5rem;
    }

    .login-card {
        padding: 2rem;
    }

    .app-header {
        padding: 1rem;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .tabs {
        flex-wrap: wrap;
    }

    .tab-btn {
        padding: 0.75rem 1rem;
        font-size: 0.9375rem;
    }

    .report-actions {
        flex-direction: column;
    }

    .report-actions .btn {
        width: 100%;
    }
}

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

.workflow-step {
    animation: fadeIn 0.3s ease-out;
}

/* Loading Spinner */
.spinner {
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

/* Additional styles for improved UI/UX */

/* Transcript & Audio Side-by-Side Layout */
/* .transcript-audio-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 1rem;
} */

.transcript-audio-container {
    display: flex;
    flex-direction: column;  /* ← stacked */
    gap: 1.5rem;
}

.audio-section,
.transcript-section {
    background: #f9fafb;
    border-radius: 8px;
    padding: 1.5rem;
}

.audio-section h4,
.transcript-section h4 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.audio-players {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.audio-player-item {
    background: white;
    padding: 1rem;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.audio-player-item h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    color: #374151;
}

.audio-player-item audio {
    width: 100%;
}

.transcript-section .content-box {
    max-height: 400px;
    overflow-y: auto;
    background: white;
    padding: 1rem;
    border-radius: 6px;
    scroll-behavior: smooth;
}

.transcript-section .content-box pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.95rem;
    line-height: 1.8;
}

/* Reports List */
.reports-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.report-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f3f4f6;
}

.report-header h4 {
    margin: 0;
    color: var(--primary-color);
}

.report-timestamp {
    font-size: 0.85rem;
    color: #6b7280;
}

.report-content {
    margin-bottom: 1rem;
    line-height: 1.6;
    color: #374151;
}

.report-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

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

/* Responsive Design */
@media (max-width: 1024px) {
    .transcript-audio-container {
        grid-template-columns: 1fr;
    }
}

/* Audio loading state */
.audio-loading {
    padding: 1rem;
    text-align: center;
    color: #6b7280;
    font-size: 0.875rem;
    font-style: italic;
}

/* Interactive Transcript Styling */
.transcript-file-header {
    font-weight: 600;
    color: var(--primary-color);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.transcript-file-header:first-child {
    margin-top: 0;
}

/* Speaker Turn Container - Each speaker's segment */
.speaker-turn {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #F9FAFB;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.speaker-turn:last-child {
    margin-bottom: 0;
}

/* Speaker Heading - Bold heading above text */
.speaker-heading {
    font-weight: 700;
    font-size: 1rem;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #E0E7FF;
}

/* Speaker Text Container */
.speaker-text {
    line-height: 1.8;
    color: var(--text-primary);
}

.transcript-file {
    line-height: 1.8;
    user-select: text;
}

.transcript-word {
    cursor: pointer;
    transition: color 0.3s ease, font-weight 0.3s ease;
    padding: 0.1rem 0;
    display: inline;
    /* Default: unspoken words are light gray (not yet reached) */
    color: #898f96;  /* Gray-300 - very light, clearly "not yet read" */
}

.transcript-word:hover {
    background-color: #fef3c7;
    color: #92400e;
    border-radius: 2px;
}

/* Spoken words - dark color for "already read" effect */
.transcript-word.spoken {
    color: #1f2937;  /* Gray-800 - dark, easy to read */
    font-weight: 500;  /* Slightly bolder for emphasis */
}

/* Formatting tokens - line breaks and paragraphs */
.transcript-file .line-break {
    display: block;
    height: 0;
    margin-bottom: 0.4rem;  /* Extra spacing after <nl> - adjust as needed */
}

.transcript-file .paragraph-break {
    display: block;
    height: 0;
    margin-bottom: 1.2rem;  /* Even more spacing for <np> */
}

/* Delete Button Styling */
.btn-delete {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    opacity: 0.6;
}

.btn-delete:hover {
    background-color: #fee2e2;
    opacity: 1;
    transform: scale(1.1);
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.report-header > div {
    flex: 1;
}

/* Hide sections by default */
#transcriptSection,
#templateSection,
#generateSection,
#resultsSection {
    display: none;
}

/* When sections are visible, add smooth transitions */
.workflow-step {
    opacity: 0;
    animation: fadeIn 0.5s forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* Ensure sections stay hidden until explicitly shown */
.workflow-step[style*="display: none"] {
    animation: none;
    opacity: 0;
}

/* Better progress area styling */
.progress-area {
    margin-top: 1rem;
}

.progress-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.3s ease;
    border-radius: 4px;
}

.progress-text {
    text-align: center;
    font-size: 0.9rem;
    color: #6b7280;
    margin: 0;
}

/* Indeterminate progress bar (for unknown duration tasks) */
.progress-fill.indeterminate {
    width: 100% !important;
    background: linear-gradient(
        90deg,
        var(--primary-color) 25%,
        var(--primary-dark) 50%,
        var(--primary-color) 75%
    );
    background-size: 200% 100%;
    animation: progressIndeterminate 1.5s linear infinite;
    transition: none;
}

@keyframes progressIndeterminate {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Custom Confirmation Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeInModal 0.2s ease-out;
}

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

.modal-container {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 450px;
    width: 90%;
    animation: slideInModal 0.3s ease-out;
}

.modal-header {
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

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

.modal-body {
    padding: 1.5rem;
}

.modal-body p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

.modal-footer {
    padding: 1rem 1.5rem;
    background-color: var(--bg-color);
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.modal-footer .btn {
    min-width: 100px;
}

.btn-danger {
    background-color: var(--error-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger:hover {
    background-color: #DC2626;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

@keyframes fadeInModal {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Make step header clickable */
.step-header {
    cursor: pointer;
    user-select: none;
}

.step-header:hover {
    opacity: 0.85;
}

/* Toggle chevron - sits at the right */
.step-toggle {
    margin-left: auto;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

/* Rotate chevron when collapsed */
.workflow-step.collapsed .step-toggle {
    transform: rotate(-90deg);
}

/* Hide content when collapsed */
.workflow-step.collapsed .step-content {
    display: none;
}

/* Reduce padding on header when collapsed so it looks compact */
.workflow-step.collapsed {
    padding-bottom: 0;
}

/* ── Task Checkboxes (Step 4) ───────────────────────────────────────────── */

.task-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.task-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.task-option:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
}

.task-option input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--primary-color);
    cursor: pointer;
    flex-shrink: 0;
}

.task-option:has(input:checked) {
    background: color-mix(in srgb, var(--primary-color) 8%, white);
    border-color: var(--primary-color);
}

.task-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.task-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.task-info strong {
    font-size: 0.9375rem;
    color: var(--text-color);
}

.task-info small {
    font-size: 0.8125rem;
    color: var(--text-muted, #6b7280);
}

/* ── Task Result Cards (Step 5 - Results) ───────────────────────────────── */

.task-result {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    overflow: hidden;
}

.task-result:last-child {
    margin-bottom: 0;
}

.task-result--error {
    border-color: #fca5a5;
    background: #fef2f2;
}

.task-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 1rem;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.9375rem;
}

.task-result--error .task-result-header {
    background: #fee2e2;
    border-bottom-color: #fca5a5;
}

.task-result-actions {
    display: flex;
    gap: 0.375rem;
}

.task-result-status.error {
    color: #dc2626;
    font-weight: 500;
    font-size: 0.8125rem;
}

.task-error-msg {
    padding: 0.75rem 1rem;
    color: #dc2626;
    font-size: 0.875rem;
    margin: 0;
}

.task-result .report-content {
    padding: 1rem;
    border: none;
    border-radius: 0;
}

/* Report JSON tabs (Preview/JSON) */
.report-json-tabs {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin: 0.5rem 0 1rem 0;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.report-json-tabs .tab-like {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0.5rem 0.75rem;
  font-weight: 600;
}

.report-json-tabs .tab-like:hover {
  color: var(--text-primary);
}

.report-json-tabs .tab-like.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

/* Nicer details/summary */
.report-content details summary {
  cursor: pointer;
  user-select: none;
  font-weight: 600;
}

.report-content details {
  margin-top: 0.75rem;
}

.report-content details > div {
  margin-top: 0.5rem;
}

/* ── JSON review cards: tri-state + edit ───────────────────────────── */

.json-card {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px;
  margin-top: 10px;
  background: #fff;
  transition: background 0.15s, border-color 0.15s;
}

.json-card--ok {
  background: #ecfdf5;        /* light green */
  border-color: #86efac;
}

.json-card--no {
  background: #fef2f2;        /* light red */
  border-color: #fca5a5;
}

.json-card__top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.json-card__top-right {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.json-card__title {
  font-weight: 800;
  color: #111827;
}

.json-card__subtitle {
  color: #6b7280;
  font-size: 0.9rem;
  margin-top: 2px;
}

.json-card__grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 170px 1fr;
  row-gap: 6px;
  column-gap: 10px;
  font-size: 0.95rem;
}

.json-card__label {
  color: #6b7280;
}

.json-card__details {
  margin-top: 10px;
}

.json-card__details summary {
  cursor: pointer;
  color: #374151;
}

.json-card__evidence {
  margin-top: 6px;
  color: #111827;
  white-space: pre-wrap;
}

.json-badge {
  font-size: 0.85rem;
  color: #374151;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  padding: 2px 10px;
  background: #f9fafb;
  display: inline-block;
}

.json-pill {
  font-size: 0.85rem;
  border-radius: 999px;
  padding: 2px 10px;
  display: inline-block;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #374151;
}

.json-pill--warn {
  border-color: #fcd34d;
  background: #fffbeb;
  color: #92400e;
}

.json-missing {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Edit area */
.json-edit-area {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #e5e7eb;
}

.json-edit-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  row-gap: 8px;
  column-gap: 10px;
  font-size: 0.95rem;
}

.json-edit-label {
  color: #6b7280;
  padding-top: 6px;
}

.json-edit-grid input,
.json-edit-grid textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
}

.json-edit-grid textarea {
  min-height: 90px;
  resize: vertical;
}

.json-edit-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 10px;
}

/* Prescription warnings box */
.json-warnings {
  border: 1px solid #fecaca;
  background: #fff1f2;
  border-radius: 10px;
  padding: 12px;
  margin: 10px 0 14px 0;
}

.json-warnings__title {
  font-weight: 700;
  color: #9f1239;
  margin-bottom: 6px;
}

.json-warnings__list {
  margin: 0;
  padding-left: 18px;
  color: #111827;
}

/* ── Collapsible task results ─────────────────────────────────────────────── */

.task-result-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.task-result-header:hover {
    background-color: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
}

.task-result-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.task-result-toggle {
    font-size: 0.75rem;
    color: #9ca3af;
    flex-shrink: 0;
    transition: color 0.15s ease;
}

.task-result-header:hover .task-result-toggle {
    color: #6b7280;
}

/* Collapsed state: tighten the card */
.task-result.collapsed {
    padding-bottom: 0;
}

.task-result.collapsed .task-result-header {
    border-bottom: none;
    margin-bottom: 0;
}

/* ── Medical report formatting ───────────────────────────────────────────── */

.report-content h3.report-heading,
.report-content h3 {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #374151;
    text-transform: uppercase;
    margin: 1.5rem 0 0.4rem 0;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid #e5e7eb;
}

.report-content h3:first-child {
    margin-top: 0;
}

.report-content ul {
    margin: 0.4rem 0 0.4rem 1.2rem;
    padding: 0;
}

.report-content li {
    margin-bottom: 0.2rem;
    line-height: 1.5;
}

.report-content p,
.report-content .report-para {
    margin: 0.4rem 0;
    line-height: 1.6;
}

/* [nejasno] — amber warning badge */
.report-unclear {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
    border-radius: 3px;
    padding: 0 5px;
    font-size: 0.78rem;
    font-weight: 600;
    vertical-align: middle;
}

/* [ni omenjeno] — gray muted badge */
.report-missing {
    display: inline-block;
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #d1d5db;
    border-radius: 3px;
    padding: 0 5px;
    font-size: 0.78rem;
    font-weight: 500;
    vertical-align: middle;
}

/* ── Report plain-text edit area ─────────────────────────────────────────── */

.report-edit-textarea {
    width: 100%;
    min-height: 420px;
    padding: 0.75rem;
    font-family: inherit;
    font-size: 0.875rem;
    line-height: 1.6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    resize: vertical;
    box-sizing: border-box;
    background: #fafafa;
    color: #1f2937;
}

.report-edit-textarea:focus {
    outline: none;
    border-color: #6366f1;
    background: #fff;
}

.report-edit-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

/* ── In-progress step indication ─────────────────────────────────────────── */

.workflow-step.step-in-progress .step-header {
    border-left: 3px solid #f59e0b;
    padding-left: calc(var(--spacing-md, 1rem) - 3px); /* compensate for border width */
}

.workflow-step.step-in-progress .step-number {
    background: #f59e0b;
    color: #fff;
    position: relative;
}

/* Pulsing ring around the step number */
.workflow-step.step-in-progress .step-number::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid #f59e0b;
    animation: step-pulse 1.4s ease-out infinite;
}

@keyframes step-pulse {
    0%   { opacity: 0.8; transform: scale(1);    }
    70%  { opacity: 0;   transform: scale(1.55); }
    100% { opacity: 0;   transform: scale(1.55); }
}

/* When expanded, keep the border but tone it down slightly */
.workflow-step.step-in-progress:not(.collapsed) .step-header {
    border-left-color: #f59e0b;
}

