/**
 * Workspace Context Panel Styles
 * 워크스페이스 컨텍스트 패널 스타일
 */

/* Panel Container */
.context-panel {
    position: fixed;
    right: 0;
    top: 60px;
    bottom: 0;
    width: 550px;  /* Increased by 30% from 420px */
    min-width: 550px;  /* Ensure minimum width */
    background: white;
    border-left: 1px solid #dee2e6;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.context-panel.hidden {
    transform: translateX(100%);
}

/* Floating layer mode */
.context-panel--floating {
    top: 80px;
    left: auto;
    bottom: auto;
    right: auto;
    width: 500px;
    height: 640px;
    min-width: 380px;
    max-width: 90vw;
    max-height: 88vh;
    resize: both;
    overflow: hidden;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
}

.context-panel--floating .context-panel-header {
    cursor: move;
}

/* Floating mode: hide via display:none (no slide-from-right) */
.context-panel--floating.hidden {
    transform: none;
    display: none;
}

/* Panel Header */
.context-panel-header {
    padding: 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Filter Bar */
.context-filter-bar {
    padding: 7px 15px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 10px;
}

.filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.filter-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 5px 10px;
    border-radius: 6px;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.filter-label:hover {
    background: #f8f9fa;
    border-color: #e9ecef;
}

.filter-label input[type="checkbox"] {
    cursor: pointer;
    margin: 0;
}

.filter-label input[type="checkbox"]:checked + span {
    font-weight: 600;
    color: #0d6efd;
}

.context-panel-header h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #495057;
}

.context-panel-controls {
    display: flex;
    gap: 5px;
}

.context-panel-controls button {
    padding: 0.25rem 0.5rem;
    border: none;
}

/* Panel Body */
.context-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

/* Context Sections */
.context-section {
    margin-bottom: 15px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: visible;
    background: white;
}

.context-section-header {
    padding: 10px 15px;
    background: #f8f9fa;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background 0.2s;
    border-radius: 8px 8px 0 0;
    position: relative;
}

.context-section-header:hover {
    background: #e9ecef;
}

.context-section-header i {
    transition: transform 0.2s;
}

.context-section-header[aria-expanded="false"] i {
    transform: rotate(-90deg);
}

.context-section-content {
    padding: 10px;
    max-height: 400px;
    overflow-y: auto;
}

/* Match Items */
.context-match-item {
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.context-match-item:hover {
    border-color: #0d6efd;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.1);
}

/* TM Matches */
.tm-match {
    position: relative;
}

.tm-match .match-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    gap: 8px;
    flex-wrap: wrap;
}

.match-score {
    font-weight: bold;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    white-space: nowrap;
    display: inline-block;
}

.match-score.perfect-match {
    background: #198754;
    color: white;
}

.match-score.high-match {
    background: #28a745;
    color: white;
}

.match-score.good-match {
    background: #ffc107;
    color: #000;
}

.match-score.fuzzy-match {
    background: #fd7e14;
    color: white;
}

.match-score.low-match {
    background: #6c757d;
    color: white;
}

.match-type {
    font-size: 0.85rem;
    color: #6c757d;
}

.apply-btn {
    margin-left: auto;
    padding: 3px 10px;
    font-size: 0.85rem;
    border-radius: 4px;
}

.match-content {
    font-size: 0.9rem;
    margin-top: 8px;
}

.source-text {
    padding: 8px 10px;
    background: #f8f9fa;
    border-left: 3px solid #6c757d;
    margin-bottom: 8px;
    border-radius: 0 4px 4px 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    box-sizing: border-box;
    line-height: 1.4;
}

.target-text {
    padding: 8px 10px;
    background: #e7f3ff;
    border-left: 3px solid #0d6efd;
    border-radius: 0 4px 4px 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    box-sizing: border-box;
    line-height: 1.4;
}

.match-context {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #dee2e6;
    font-size: 0.85rem;
    color: #6c757d;
}

.context-before,
.context-after {
    padding: 3px 0;
}

/* Termbase Items */
.termbase-item {
    background: #f0f8ff;
}

.term-pair {
    display: flex;
    align-items: center;
    font-size: 0.95rem;
}

.source-term {
    font-weight: 600;
    color: #495057;
}

.target-term {
    font-weight: 600;
    color: #0d6efd;
}

.apply-term-btn {
    margin-left: auto;
    padding: 2px 8px;
}

.term-definition {
    margin-top: 5px;
    padding: 5px;
    background: white;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #6c757d;
}

.term-notes {
    margin-top: 5px;
    padding: 5px;
    background: #fff3cd;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #856404;
}

/* Style Violations */
.style-violation {
    background: #fff3cd;
}

.style-violation.error {
    background: #f8d7da;
    border-color: #dc3545;
}

.style-violation.warning {
    background: #fff3cd;
    border-color: #ffc107;
}

.style-violation.suggestion {
    background: #cfe2ff;
    border-color: #0d6efd;
}

.style-violation.info {
    background: #d1ecf1;
    border-color: #0dcaf0;
}

.violation-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.severity-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
}

.severity-badge.error {
    background: #dc3545;
    color: white;
}

.severity-badge.warning {
    background: #ffc107;
    color: #000;
}

.severity-badge.suggestion {
    background: #0d6efd;
    color: white;
}

.severity-badge.info {
    background: #0dcaf0;
    color: white;
}

.rule-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.violation-description {
    font-size: 0.85rem;
    color: #495057;
    margin-bottom: 5px;
}

.violation-suggestion {
    padding: 5px;
    background: white;
    border-radius: 4px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
}

.apply-suggestion-btn {
    margin-left: auto;
    padding: 2px 8px;
}

/* No Matches */
.no-matches {
    text-align: center;
    padding: 20px;
    color: #6c757d;
    font-size: 0.9rem;
}

/* Panel Footer */
.context-panel-footer {
    padding: 15px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

/* Error Messages */
.context-error {
    margin: 10px;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.9rem;
}

/* Highlighting */
.exact-match {
    background: #d4edda;
    padding: 2px 4px;
    border-radius: 3px;
}

.fuzzy-source {
    background: #fff3cd;
    padding: 2px 4px;
    border-radius: 3px;
}

/* Responsive */
@media (max-width: 768px) {
    .context-panel {
        width: 100%;
        max-width: 100%;
    }
}

/* Animation */
@keyframes slideIn {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(100%);
    }
}

.context-panel.sliding-in {
    animation: slideIn 0.3s ease forwards;
}

.context-panel.sliding-out {
    animation: slideOut 0.3s ease forwards;
}

/* Scrollbar Styling */
.context-panel-body::-webkit-scrollbar,
.context-section-content::-webkit-scrollbar {
    width: 6px;
}

.context-panel-body::-webkit-scrollbar-track,
.context-section-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.context-panel-body::-webkit-scrollbar-thumb,
.context-section-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.context-panel-body::-webkit-scrollbar-thumb:hover,
.context-section-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* TM Matches Section Specific Styles */
#tm-section {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 15px;
}

#tm-section .section-header {
    padding: 7px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#tm-section .section-header h6 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #495057;
    display: flex;
    align-items: center;
}

#tm-section .section-header .badge {
    margin-left: 8px;
    padding: 3px 8px;
    font-size: 0.75rem;
}

.tm-matches {
    padding: 10px;
}

.tm-matches .tm-match-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    transition: all 0.2s;
}

.tm-matches .tm-match-item:hover {
    border-color: #0d6efd;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.1);
}

.tm-match-item .match-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.tm-match-item .match-score-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.tm-match-item .match-score-badge.score-102 {
    background: #0d6efd;
    color: white;
}

.tm-match-item .match-score-badge.score-101 {
    background: #198754;
    color: white;
}

.tm-match-item .match-score-badge.score-100 {
    background: #28a745;
    color: white;
}

.tm-match-item .match-score-badge.score-fuzzy {
    background: #ffc107;
    color: #000;
}

.tm-match-item .source-text,
.tm-match-item .target-text {
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    line-height: 1.5;
    font-size: 0.9rem;
}

.tm-match-item .source-text {
    background: #f8f9fa;
    border-left: 3px solid #6c757d;
    position: relative;
}

.tm-match-item .target-text {
    background: #e8f4fd;
    border-left: 3px solid #0d6efd;
    position: relative;
}

.tm-match-item .text-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    margin-bottom: 4px;
    display: block;
}

.tm-match-item .apply-btn {
    padding: 4px 12px;
    font-size: 0.85rem;
    border-radius: 4px;
    margin-left: auto;
}

/* Keyboard Shortcut Styles */
.tm-match-item .shortcut-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bs-primary, #0d6efd);
    color: white;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    margin-right: 8px;
    vertical-align: middle;
}

.tm-match-item.has-shortcut {
    position: relative;
}

.tm-match-item.has-shortcut .match-header {
    display: flex;
    align-items: center;
}

.tm-match-item .shortcut-hint {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    padding: 2px 6px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    font-size: 11px;
    font-family: 'Courier New', monospace;
    color: #6c757d;
    white-space: nowrap;
}

/* Highlight active shortcut on keypress */
.tm-match-item.shortcut-active {
    border-color: var(--bs-primary, #0d6efd);
    background: rgba(13, 110, 253, 0.05);
    transform: scale(1.01);
    transition: all 0.15s ease;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.2);
}

.tm-match-item.shortcut-active .shortcut-badge {
    background: var(--bs-success, #198754);
    transform: scale(1.15);
    transition: all 0.15s ease;
}

/* Expandable TM List */
.tm-matches .expandable-list {
    position: relative;
}

.tm-matches .collapsed-matches {
    max-height: 200px;
    overflow: hidden;
    position: relative;
}

.tm-matches .expanded-matches {
    max-height: none;
}

.tm-matches .expand-btn {
    width: 100%;
    padding: 8px;
    margin-top: 10px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.tm-matches .expand-btn:hover {
    background: #e9ecef;
}

/* TM Section Filter Bar */
#tm-section .filter-bar {
    padding: 10px 15px;
    background: #fafbfc;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#tm-section .filter-options {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

#tm-section .filter-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 0.85rem;
}

#tm-section .filter-label input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

#tm-section .filter-label span {
    user-select: none;
}

/* Section Controls */
.section-controls {
    display: flex;
    gap: 8px;
}

.section-controls button {
    padding: 4px 10px;
    font-size: 0.85rem;
    border-radius: 4px;
}

/* Termbase Section Specific Styles */
#termbase-section {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 15px;
}

#termbase-section .section-header {
    padding: 7px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

#termbase-section .section-header h6 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #495057;
    display: flex;
    align-items: center;
}

#termbase-section .section-header .badge {
    margin-left: 8px;
    padding: 3px 8px;
    font-size: 0.75rem;
}

.termbase-list {
    padding: 10px;
}

.termbase-list .no-matches {
    text-align: center;
    padding: 20px;
    color: #6c757d;
    font-size: 0.9rem;
}

/* Style Guide Section Specific Styles */
#style-section {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 15px;
}

#style-section .section-header {
    padding: 7px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

#style-section .section-header h6 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #495057;
    display: flex;
    align-items: center;
}

#style-section .section-header .badge {
    margin-left: 8px;
    padding: 3px 8px;
    font-size: 0.75rem;
}

.style-violations-list {
    padding: 10px;
}

.style-violations-list .no-matches {
    text-align: center;
    padding: 20px;
    color: #6c757d;
    font-size: 0.9rem;
}

/* Icon spacing for all sections */
.section-header i {
    margin-right: 6px;
    font-size: 1rem;
}

/* Selected Cell Info */
#context-panel-placeholder {
    padding: 12px 15px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 15px;
}

.selected-cell-info {
    font-size: 0.9rem;
    color: #495057;
}

.selected-cell-info strong {
    color: #212529;
    font-weight: 600;
    display: block;
    margin-bottom: 5px;
}

.selected-cell-info small {
    color: #6c757d;
    line-height: 1.4;
    display: block;
    margin-top: 5px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Context RAG Section */
#context-rag-section {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 15px;
    padding: 12px 15px;
}

#context-rag-section h6 {
    margin: 0 0 10px 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #495057;
    display: flex;
    align-items: center;
}

#context-rag-section h6 i {
    margin-right: 6px;
    font-size: 1rem;
}

#rag-search-results {
    padding: 10px 0;
}
/* ── 4-A: Sheet RAG 유사 번역 예시 (빈 target 셀 제안) ── */
/* 2026-06-12: sheet-rag 섹션 헤더 — TM/termbase 와 동일 스타일(이전엔 누락되어 padding/배경 없음). */
#sheet-rag-section {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 15px;
}
#sheet-rag-section .section-header {
    padding: 7px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#sheet-rag-section .section-header h6 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #495057;
    display: flex;
    align-items: center;
}
#sheet-rag-section .section-header .badge {
    margin-left: 8px;
    padding: 3px 8px;
    font-size: 0.75rem;
}

.sheet-rag-suggestions { display: flex; flex-direction: column; gap: 6px; padding: 10px; }
.sheet-rag-item {
    border: 1px solid #e9ecef; border-left: 3px solid #198754; border-radius: 6px;
    padding: 7px 9px; background: #fff; transition: border-color 0.15s;
}
.sheet-rag-item:hover { border-color: #198754; }
.sheet-rag-item-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; }
.sheet-rag-sim { font-size: 0.72rem; font-weight: 600; color: #198754; background: #e8f5ee; border-radius: 4px; padding: 1px 6px; }
.sheet-rag-apply {
    border: 1px solid #198754; background: #198754; color: #fff; font-size: 0.72rem;
    border-radius: 4px; padding: 1px 10px; cursor: pointer; line-height: 1.5;
}
.sheet-rag-apply:hover { background: #157347; border-color: #157347; }
.sheet-rag-src { font-size: 0.74rem; color: #6c757d; line-height: 1.35; word-break: break-word; }
.sheet-rag-tgt { font-size: 0.82rem; color: #198754; font-weight: 500; line-height: 1.4; margin-top: 2px; word-break: break-word; }
