:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --bg-color: #f8fafc;
    --panel-bg: #ffffff;
    --border-color: #e2e8f0;
    --text-color: #1e293b;
    --highlight-bg: #fef08a;
    --support-bg: #dcfce7;
    --unsupport-text: #ef4444;
    --modal-bg: rgba(30, 41, 59, 0.95);
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

#title-bar {
    background-color: #1e293b;
    color: #ffffff;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.status-indicator.status-busy::before {
    content: "";
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #ffffff;
    animation: spin 0.8s linear infinite;
}

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

.method-badge {
    display: none;
    padding: 2px 8px;
    border-radius: 999px;
    background-color: rgba(37, 99, 235, 0.2);
    color: #dbeafe;
    font-size: 0.75rem;
    font-weight: 600;
}

.method-badge.visible {
    display: inline-block;
}

#main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

#left-panel {
    width: 50%;
    display: flex;
    flex-direction: column;
    background-color: var(--panel-bg);
}

#right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--panel-bg);
}

#resizer {
    width: 8px;
    background-color: var(--border-color);
    cursor: col-resize;
    transition: background-color 0.2s;
}

#resizer:hover {
    background-color: var(--primary-color);
}

#file-content {
    padding: 0;
    overflow: hidden;
}

.pdf-viewer {
    width: 100%;
    height: 100%;
    border: none;
}


.panel-header {
    background-color: #f1f5f9;
    padding: 0.5rem 1rem;
    font-weight: bold;
    border-bottom: 1px solid var(--border-color);
}

.content-area {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    white-space: pre-wrap;
    line-height: 1.5;
}

#interaction-bar {
    height: 300px;
    background-color: #ffffff;
    border-top: 1px solid var(--border-color);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.interaction-step {
    display: none;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.interaction-step.active {
    display: flex;
}

.step-label {
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.loading-inline {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.loading-inline p {
    margin: 0;
}

.loading-inline:not(.is-loading) .inline-spinner {
    display: none;
}

.inline-loading {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--secondary-color);
}

.inline-spinner {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(37, 99, 235, 0.2);
    border-top-color: var(--primary-color);
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

.context-display, .result-text {
    flex: 1;
    background-color: #f8fafc;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    overflow-y: auto;
    font-size: 0.9rem;
}

.interpretations-container {
    display: flex;
    gap: 1rem;
    height: 100%;
}

.interpretation-card {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    background-color: #f8fafc;
    display: flex;
    flex-direction: column;
}

.interpretation-card h3 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.interpretation-card p {
    flex: 1;
    font-size: 0.9rem;
    overflow-y: auto;
    margin-bottom: 0.5rem;
}

.reasoning-input-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

textarea {
    flex: 1;
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    resize: none;
    font-family: inherit;
}

button {
    padding: 0.5rem 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

button:disabled {
    background-color: var(--secondary-color);
    cursor: not-allowed;
    opacity: 0.5;
}

.hint-text {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 10px;
    display: flex;
    gap: 15px;
    align-items: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.box-green {
    display: inline-block;
    width: 12px;
    height: 12px;
    background-color: #dcfce7;
    border: 1px solid #22c55e;
}

.text-red {
    color: #ef4444;
    font-weight: bold;
    text-decoration: underline;
}

.loading-spinner {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
    text-align: center;
    padding: 10px;
}

.loading-spinner::before {
    content: "";
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(37, 99, 235, 0.2);
    border-top-color: var(--primary-color);
    animation: spin 0.8s linear infinite;
}

.error-text {
    color: #ef4444;
    font-weight: bold;
}

.highlighted-text {
    padding: 15px;
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    min-height: 50px;
    margin-bottom: 15px;
    line-height: 1.6;
}

.keyword-highlight {
    background-color: var(--highlight-bg);
}

.supported-text {
    background-color: #dcfce7;
    border-bottom: 2px solid #22c55e;
    padding: 2px 0;
}

.unsupported-text {
    color: #ef4444;
    background-color: #fee2e2;
    text-decoration: underline wavy #ef4444;
    font-weight: bold;
    padding: 2px 0;
}

.file-link {
    color: var(--primary-color);
    text-decoration: underline;
    cursor: pointer;
}

.message {
    margin-bottom: 1rem;
    padding: 0.5rem;
    border-radius: 4px;
}

.message-A {
    background-color: #f1f5f9;
    border-left: 4px solid var(--primary-color);
}

.message-B {
    background-color: #f0fdf4;
    border-left: 4px solid #22c55e;
}

.message-file {
    background-color: #fef9c3;
    border-left: 4px solid #eab308;
    font-style: italic;
}

.sender-name {
    font-weight: bold;
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.8rem;
    color: var(--secondary-color);
}

/* Setup Overlay */
.setup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--modal-bg);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.setup-modal {
    background-color: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    width: 400px;
}

.setup-modal h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    text-align: center;
    color: #1e293b;
}

.setup-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.setup-form label {
    font-weight: bold;
    font-size: 0.9rem;
}

.setup-form input[type="text"] {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
}

.setup-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

#btn-setup-start {
    padding: 1rem;
    font-size: 1rem;
    background-color: var(--primary-color);
    margin-top: 1rem;
}

/* Final Step Styling */
.final-selection-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem;
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.final-selection-container p {
    margin: 0 0 0.35rem;
}

.manual-reasoning-container {
    display: none;
    width: 100%;
}

.manual-reasoning-container.active {
    display: block;
}

#manual-reasoning-input {
    min-height: 72px;
    max-height: 120px;
}

.radio-group {
    display: flex;
    gap: 2rem;
    margin-top: 0.25rem;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.score-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
    flex-wrap: wrap;
}

.btn-score {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: white;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 0;
    font-weight: bold;
}

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

.label-instruction {
    display: block;
    font-size: 0.75rem;
    color: var(--primary-color);
    font-style: italic;
    margin-bottom: 0.5rem;
    background-color: #eff6ff;
    padding: 4px 8px;
    border-radius: 4px;
}

.assist-only {
    display: none;
}

body.mode-assist .assist-only {
    display: block;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}
