/**
 * ChangoPaperQuery PRISMA面板样式
 * 版本: 20260121_v1 - 添加拖动功能支持
 */

/* ==================== PRISMA侧边栏 ==================== */
.prisma-sidebar {
    position: fixed;
    /* left/top 由 JS 动态设置，支持拖动和位置记忆 */
    width: 220px;
    max-height: 70vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    transition: all 0.3s ease;
    overflow: hidden;
}

/* 拖动中状态 */
.prisma-sidebar.dragging {
    cursor: grabbing !important;
    user-select: none;
    transition: none; /* 拖动时禁用过渡动画 */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.prisma-sidebar.dragging * {
    cursor: grabbing !important;
}

.prisma-sidebar.collapsed {
    width: 50px;
    height: 50px;
    border-radius: 50%;
}

.prisma-sidebar.collapsed .prisma-panel-body,
.prisma-sidebar.collapsed .prisma-panel-header span {
    display: none;
}

/* 面板头部 - 作为拖动手柄 */
.prisma-panel-header {
    padding: 10px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.prisma-panel-header:active {
    cursor: grabbing;
}

.prisma-panel-header i {
    font-size: 1.1rem;
}

.prisma-panel-header span {
    font-size: 0.85rem;
    font-weight: 600;
}

.prisma-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.prisma-help-icon {
    font-size: 0.9rem;
    opacity: 0.8;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.prisma-help-icon:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* 面板内容 */
.prisma-panel-body {
    padding: 12px;
    max-height: calc(70vh - 50px);
    overflow-y: auto;
}

/* ==================== 统计行样式 ==================== */
.prisma-stats {
    font-size: 0.8rem;
}

.prisma-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.prisma-stat-row:last-child {
    border-bottom: none;
}

.prisma-stat-label {
    color: #555;
    display: flex;
    align-items: center;
    gap: 6px;
}

.prisma-stat-label i {
    width: 16px;
    text-align: center;
}

.prisma-stat-value {
    font-weight: 600;
    font-family: 'Monaco', 'Consolas', monospace;
}

.prisma-stat-highlight {
    background: linear-gradient(135deg, rgba(80, 227, 194, 0.1) 0%, rgba(126, 211, 33, 0.1) 100%);
    margin: 4px -12px;
    padding: 8px 12px;
    border-radius: 6px;
}

/* 子项缩进样式 */
.prisma-stat-sub {
    padding-left: 20px;
}

.prisma-stat-sub .prisma-stat-label {
    font-size: 0.75rem;
}

/* Pending独立样式 */
.prisma-stat-pending {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed rgba(0, 0, 0, 0.1);
}

/* ==================== 决策按钮样式 ==================== */
.prisma-decision-buttons {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.prisma-decision-buttons.prisma-decision-buttons-inline {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    margin-left: auto;
}

.prisma-decision-buttons.prisma-decision-buttons-inline .prisma-decision-btn {
    flex: 0 0 auto;
    padding: 6px 8px;
    flex-direction: row;
    gap: 6px;
    border-radius: 10px;
}

.prisma-decision-buttons.prisma-decision-buttons-inline .prisma-decision-btn kbd {
    margin-left: 6px;
}

.prisma-decision-buttons.prisma-decision-buttons-inline .prisma-decision-btn span {
    font-size: 0.75rem;
}

.prisma-decision-btn {
    flex: 1;
    padding: 8px 4px;
    border: none;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.prisma-decision-btn i {
    font-size: 1rem;
}

.prisma-decision-btn.include {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.prisma-decision-btn.exclude {
    background: linear-gradient(135deg, #dc3545 0%, #e83e8c 100%);
    color: white;
}

.prisma-decision-btn.skip {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

/* 激活状态样式 */
.prisma-decision-btn.active.include {
    background: #198754;
    color: white;
    border-color: #198754;
    box-shadow: 0 0 0 3px rgba(25, 135, 84, 0.25);
}

.prisma-decision-btn.active.exclude {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.25);
}

.prisma-decision-btn.active.skip {
    background: #6c757d;
    color: white;
    border-color: #6c757d;
    box-shadow: 0 0 0 3px rgba(108, 117, 125, 0.25);
}

.prisma-decision-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.prisma-decision-btn.active:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25), 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.prisma-decision-btn kbd {
    font-size: 0.6rem;
    padding: 1px 4px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

/* ==================== 排除原因模态框 ==================== */
#prismaExcludeReasonModal .modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

#prismaExcludeReasonModal .modal-header {
    background: linear-gradient(135deg, #dc3545 0%, #e83e8c 100%);
    color: white;
    border-radius: 12px 12px 0 0;
    border: none;
}

#prismaExcludeReasonOptions .form-check {
    padding: 8px 12px;
    margin: 4px 0;
    border-radius: 8px;
    transition: background 0.2s ease;
}

#prismaExcludeReasonOptions .form-check:hover {
    background: #f8f9fa;
}

#prismaExcludeReasonOptions .form-check-input:checked + .form-check-label {
    font-weight: 600;
}

#prismaExcludeReasonOptions .badge {
    font-size: 0.65rem;
    font-weight: 400;
}

/* ==================== 批量操作栏 ==================== */
.prisma-batch-bar {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.prisma-batch-bar .btn {
    font-size: 0.75rem;
    padding: 4px 10px;
}

.prisma-batch-bar .batch-count {
    font-size: 0.8rem;
    color: #667eea;
    font-weight: 600;
}

/* ==================== 进度指示器 ==================== */
.prisma-progress {
    margin-top: 10px;
}

.prisma-progress-bar {
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
}

.prisma-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
}

.prisma-progress-text {
    font-size: 0.7rem;
    color: #6c757d;
    text-align: center;
    margin-top: 4px;
}

/* ==================== 快捷键提示 ==================== */
.prisma-shortcuts {
    font-size: 0.7rem;
    color: #6c757d;
    padding: 8px 0;
    border-top: 1px dashed rgba(0, 0, 0, 0.1);
    margin-top: 8px;
}

.prisma-shortcuts kbd {
    font-size: 0.65rem;
    padding: 2px 5px;
    background: #e9ecef;
    border-radius: 3px;
    margin-right: 2px;
}

/* ==================== 暗色模式支持 ==================== */
@media (prefers-color-scheme: dark) {
    .prisma-sidebar {
        background: rgba(30, 30, 30, 0.95);
        color: #e0e0e0;
    }
    
    .prisma-stat-label {
        color: #aaa;
    }
    
    .prisma-decision-btn.skip {
        background: #2d2d2d;
        color: #aaa;
        border-color: #444;
    }
    
    #prismaExcludeReasonOptions .form-check:hover {
        background: #2d2d2d;
    }
}

/* ==================== Methods Pack模态框样式 ==================== */
.prisma-methods-pack-content {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    font-size: 0.9rem;
    max-height: 70vh;
    overflow-y: auto;
}

.prisma-methods-pack-content h3 {
    color: #667eea;
}

.prisma-methods-pack-content h4 {
    color: #764ba2;
}

.prisma-methods-pack-content pre {
    white-space: pre-wrap;
    word-break: break-word;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
}

.prisma-methods-pack-content ul {
    padding-left: 1.5rem;
}

.prisma-markdown-content p {
    margin-bottom: 0.5rem;
}

#prismaMethodsPackModal .modal-header {
    border-radius: 0.5rem 0.5rem 0 0;
}

/* ==================== 帮助模态框样式 ==================== */
.prisma-help-content h6 {
    border-bottom: 2px solid #667eea;
    padding-bottom: 8px;
}

.prisma-help-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.prisma-help-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.prisma-help-step:hover {
    background: #e9ecef;
}

.prisma-help-step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    font-weight: bold;
    font-size: 0.85rem;
    flex-shrink: 0;
}

/* 帮助步骤横向布局 */
.prisma-help-steps-horizontal {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.prisma-help-step-compact {
    text-align: center;
    padding: 10px 8px;
    background: #f8f9fa;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.prisma-help-step-compact:hover {
    background: #e9ecef;
}

.prisma-help-step-compact .step-num {
    display: inline-flex;
    width: 24px;
    height: 24px;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: bold;
    margin-bottom: 6px;
}

.prisma-help-step-compact .step-title {
    display: block;
    font-weight: 600;
    font-size: 0.8rem;
    margin-bottom: 4px;
}

.prisma-help-step-compact .step-desc {
    font-size: 0.7rem;
    color: #6c757d;
    line-height: 1.3;
}

/* 数据说明表格样式 */
.prisma-data-table {
    font-size: 0.8rem;
}

.prisma-data-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    font-size: 0.75rem;
    padding: 6px 8px;
}

.prisma-data-table td {
    padding: 5px 8px;
    vertical-align: middle;
}

.prisma-data-table .formula {
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.7rem;
    color: #667eea;
}

/* 快捷键紧凑样式 */
.prisma-shortcuts-compact {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.8rem;
}

.prisma-shortcut-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.prisma-shortcut-item kbd {
    min-width: 24px;
    text-align: center;
}

#prismaHelpModal .modal-header {
    border-radius: 0.5rem 0.5rem 0 0;
}

#prismaHelpModal kbd {
    background: #2d2d2d;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* ==================== 全屏模态框决策按钮 ==================== */
.prisma-fulldetail-buttons {
    position: sticky;
    bottom: 0;
    background: linear-gradient(to top, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.95) 100%);
    padding: 12px 20px;
    margin: 0 -20px -20px -20px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
    justify-content: center;
    gap: 16px;
}

.prisma-fulldetail-buttons .prisma-decision-btn {
    min-width: 100px;
    padding: 10px 16px;
}

/* ==================== 响应式调整 ==================== */
@media (max-width: 768px) {
    .prisma-sidebar {
        width: 180px;
        max-height: 50vh;
        /* left/top 由 JS 动态设置 */
    }
    
    .prisma-decision-btn {
        padding: 6px 2px;
    }
    
    .prisma-decision-btn i {
        font-size: 0.9rem;
    }
    
    .prisma-fulldetail-buttons {
        padding: 10px;
        gap: 8px;
    }
    
    .prisma-fulldetail-buttons .prisma-decision-btn {
        min-width: 80px;
        padding: 8px 12px;
    }
}

/* ==================== 暗色模式 - 全屏模态框 ==================== */
@media (prefers-color-scheme: dark) {
    .prisma-fulldetail-buttons {
        background: linear-gradient(to top, rgba(30, 30, 30, 0.98) 0%, rgba(30, 30, 30, 0.95) 100%);
        border-top-color: rgba(255, 255, 255, 0.1);
    }
}

/* ==================== Full-Text Assessment 样式 ==================== */

/* FT入口可点击样式 */
.prisma-ft-entry {
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
    padding: 4px 8px !important;
    margin: 0 -8px;
}

.prisma-ft-entry:hover {
    background: rgba(40, 167, 69, 0.15);
}

.prisma-ft-entry:hover .fa-arrow-right {
    color: #28a745 !important;
    transform: translateX(2px);
    transition: transform 0.2s ease;
}

/* FT模态框摘要 */
.prisma-ft-summary {
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

/* FT文献项 */
.prisma-ft-doc-item {
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    transition: background 0.15s ease;
}

.prisma-ft-doc-item:hover {
    background: #f8f9fa;
}

.prisma-ft-doc-item.assessed {
    opacity: 0.7;
    background: #f0f0f0;
}

/* FT决策按钮 */
.prisma-ft-actions {
    display: flex;
    gap: 8px;
}

.prisma-ft-actions .btn {
    flex: 1;
    max-width: 120px;
}

/* FT模态框响应式 */
@media (max-width: 576px) {
    .prisma-ft-doc-item {
        padding: 10px 12px;
    }
    
    .prisma-ft-actions {
        flex-direction: column;
    }
    
    .prisma-ft-actions .btn {
        max-width: none;
    }
}

/* 暗色模式 - FT样式 */
@media (prefers-color-scheme: dark) {
    .prisma-ft-entry:hover {
        background: rgba(40, 167, 69, 0.25);
    }
    
    .prisma-ft-summary {
        background: #2d2d2d;
    }
    
    .prisma-ft-doc-item {
        border-bottom-color: #3d3d3d;
    }
    
    .prisma-ft-doc-item:hover {
        background: #3d3d3d;
    }
    
    .prisma-ft-doc-item.assessed {
        background: #2a2a2a;
    }
}

/* ==================== SVG编辑器样式 ==================== */

#prismaSvgEditorModal .modal-fullscreen {
    max-width: 100vw;
    max-height: 100vh;
}

#svgEditorPreview {
    background: linear-gradient(45deg, #f0f0f0 25%, transparent 25%),
                linear-gradient(-45deg, #f0f0f0 25%, transparent 25%),
                linear-gradient(45deg, transparent 75%, #f0f0f0 75%),
                linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

#svgContainer {
    padding: 20px;
    border-radius: 8px;
}

#svgContainer svg {
    display: block;
}

#svgContainer svg rect[data-editable="true"] {
    cursor: move;
    transition: outline 0.15s ease;
}

#svgContainer svg rect[data-editable="true"]:hover {
    outline: 2px dashed rgba(0, 123, 255, 0.5);
}

#svgContainer svg text[data-editable="true"] {
    cursor: pointer;
}

#svgContainer svg text[data-editable="true"]:hover {
    filter: brightness(1.2);
}

#svgEditorPanel {
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
}

#svgEditorPanel .card {
    border-radius: 8px;
    overflow: hidden;
}

#svgEditorPanel .card-header {
    font-size: 0.85rem;
    padding: 8px 12px;
}

#svgEditorPanel .card-body {
    padding: 12px;
}

#svgEditorPanel .form-label {
    font-weight: 500;
    color: #555;
}

#svgEditorPanel .form-control-color {
    width: 100%;
    height: 32px;
    padding: 2px;
}

#svgBoxList .list-group-item {
    font-size: 0.8rem;
    padding: 6px 10px;
}

#svgBoxList .badge {
    border-radius: 3px;
}

/* 暗色模式 - SVG编辑器 */
@media (prefers-color-scheme: dark) {
    #svgEditorPreview {
        background: linear-gradient(45deg, #2a2a2a 25%, transparent 25%),
                    linear-gradient(-45deg, #2a2a2a 25%, transparent 25%),
                    linear-gradient(45deg, transparent 75%, #2a2a2a 75%),
                    linear-gradient(-45deg, transparent 75%, #2a2a2a 75%);
        background-size: 20px 20px;
        background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
        background-color: #1a1a1a;
    }
    
    #svgContainer {
        background: #2d2d2d;
    }
    
    #svgEditorPanel {
        background: #1e1e1e;
        border-left-color: #333;
    }
    
    #svgEditorPanel .card {
        background: #2d2d2d;
        border-color: #444;
    }
    
    #svgEditorPanel .form-label {
        color: #aaa;
    }
    
    #svgBoxList .list-group-item {
        background: #2d2d2d;
        border-color: #444;
        color: #ddd;
    }
    
    #svgBoxList .list-group-item:hover {
        background: #3d3d3d;
    }
}
