

/* 3D表单样式 - 用于节点增删改抽屉 */

/* 抽屉样式 */
.drawer {
    position: fixed;
    right: 0;
    top: 0;
    width: 384px; /* w-96 = 384px */
    height: 100vh;
    height: -webkit-fill-available; /* iOS Safari 修复 */
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(10px);
    border-left: 1px solid rgba(75, 85, 99, 0.5);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid rgba(75, 85, 99, 0.5);
}

.drawer-header h2 {
    font-size: 18px;
    font-weight: bold;
    color: #60a5fa;
    margin: 0;
}

/* 抽屉折叠按钮 */
.drawer-collapse-btn {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drawer-collapse-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

/* 抽屉展开按钮 */
.drawer-expand-btn {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(31, 41, 55, 0.9);
    border: 1px solid rgba(75, 85, 99, 0.5);
    border-right: none;
    border-radius: 8px 0 0 8px;
    color: #60a5fa;
    padding: 12px 8px;
    cursor: pointer;
    z-index: 999;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.5);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drawer-expand-btn:hover {
    background: rgba(55, 65, 81, 0.9);
    color: #93c5fd;
    padding-right: 12px;
}

.drawer-expand-btn.hidden {
    display: none !important;
}

.drawer-close {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.drawer-close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.drawer-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch; /* iOS 流畅滚动 */
}

.drawer-content section {
    margin-bottom: 20px;
}

.drawer-label {
    display: block;
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.drawer-input {
    width: 99%;
    max-width: 100%;
    box-sizing: border-box;
    background: rgba(31, 41, 55, 0.8);
    border: 1px solid rgba(75, 85, 99, 0.7);
    border-radius: 4px;
    padding: 10px 12px;
    color: #d1d5db;
    font-size: 14px;
    font-family: monospace;
    transition: all 0.2s;
    /* 确保输入框不会超出父容器 */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.drawer-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.drawer-input::placeholder {
    color: #6b7280;
}

.drawer-select {
    width: 100%;
    background: rgba(31, 41, 55, 0.8);
    border: 1px solid rgba(75, 85, 99, 0.7);
    border-radius: 4px;
    padding: 10px 12px;
    color: #d1d5db;
    font-size: 14px;
    font-family: monospace;
    transition: all 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

.drawer-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.drawer-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.drawer-hint {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: #6b7280;
    pointer-events: none;
}

.drawer-tip {
    font-size: 9px;
    color: #6b7280;
    margin-top: 4px;
    line-height: 1.3;
}

.drawer-textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    height: 120px;
    background: rgba(31, 41, 55, 0.8);
    border: 1px solid rgba(75, 85, 99, 0.7);
    border-radius: 4px;
    padding: 10px 12px;
    color: #d1d5db;
    font-size: 14px;
    font-family: monospace;
    resize: vertical;
    transition: all 0.2s;
    /* 确保文本区域不会超出父容器 */
    overflow: auto;
}

.drawer-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* 权重显示 */
.weight-container {
    display: flex;
    align-items: center;
    gap: 16px;
}

.weight-bar-bg {
    flex: 1;
    height: 6px;
    background: rgba(75, 85, 99, 0.5);
    border-radius: 3px;
    overflow: hidden;
}

.weight-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.weight-value {
    font-size: 12px;
    color: #9ca3af;
    font-family: monospace;
    min-width: 80px;
}

/* 图片上传 */
.image-upload-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.image-upload-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.image-file-input {
    flex: 1;
    font-size: 12px;
    color: #9ca3af;
}

.image-file-input::file-selector-button {
    margin-right: 8px;
    padding: 6px 12px;
    border-radius: 4px;
    border: 0;
    background: #3b82f6;
    color: white;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.image-file-input::file-selector-button:hover {
    background: #2563eb;
}

.image-upload-btn {
    padding: 6px 12px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.image-upload-btn:hover {
    background: #2563eb;
}

.image-preview {
    display: none;
    margin-top: 8px;
}

.image-preview:not(.hidden) {
    display: block;
}

.preview-image {
    max-height: 128px;
    border-radius: 4px;
    border: 1px solid rgba(75, 85, 99, 0.7);
    cursor: pointer;
    transition: opacity 0.2s;
}

.preview-image:hover {
    opacity: 0.8;
}

/* 按钮组 */
.drawer-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding-top: 24px;
    border-top: 1px solid rgba(75, 85, 99, 0.5);
}

.btn-save {
    padding: 10px;
    background: #059669;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-save:hover {
    background: #047857;
}

.btn-delete {
    padding: 10px;
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-delete:hover {
    background: #b91c1c;
}

.drawer-derive {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding-top: 12px;
    padding-bottom: 24px;
    border-top: 1px solid rgba(75, 85, 99, 0.5);
    margin-top: 12px;
    position: relative;
    z-index: 1;
}

.btn-derive {
    padding: 10px;
    background: rgba(31, 41, 55, 0.8);
    color: #d1d5db;
    border: 1px solid rgba(75, 85, 99, 0.7);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-derive:hover {
    background: rgba(55, 65, 81, 0.8);
    border-color: #6b7280;
}

/* 模态框样式 */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 1;
    transition: opacity 0.3s;
}

.modal-hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: rgba(17, 24, 39, 0.95);
    border: 1px solid rgba(75, 85, 99, 0.5);
    border-radius: 8px;
    padding: 24px;
    width: 384px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.modal-content h3 {
    font-size: 18px;
    font-weight: bold;
    color: #60a5fa;
    margin: 0 0 20px 0;
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 12px;
    color: #9ca3af;
}

.modal-input {
    width: 100%;
    box-sizing: border-box; /* 确保宽度包含padding和border */
    background: rgba(31, 41, 55, 0.8);
    border: 1px solid rgba(75, 85, 99, 0.7);
    border-radius: 4px;
    padding: 10px 12px;
    color: #d1d5db;
    font-size: 14px;
    font-family: monospace;
}

.modal-textarea {
    width: 100%;
    box-sizing: border-box; /* 确保宽度包含padding和border */
    height: 96px;
    background: rgba(31, 41, 55, 0.8);
    border: 1px solid rgba(75, 85, 99, 0.7);
    border-radius: 4px;
    padding: 10px 12px;
    color: #d1d5db;
    font-size: 14px;
    font-family: monospace;
    resize: vertical;
}

.modal-file-input {
    width: 100%;
    font-size: 12px;
    color: #9ca3af;
}

.modal-file-input::file-selector-button {
    margin-right: 8px;
    padding: 6px 12px;
    border-radius: 4px;
    border: 0;
    background: #3b82f6;
    color: white;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.modal-image-preview {
    display: none;
    margin-top: 8px;
}

.modal-image-preview:not(.hidden) {
    display: block;
}

.modal-preview-image {
    max-height: 96px;
    border-radius: 4px;
    border: 1px solid rgba(75, 85, 99, 0.7);
}

.modal-select {
    width: 100%;
    box-sizing: border-box; /* 确保宽度包含padding和border */
    background: rgba(31, 41, 55, 0.8);
    border: 1px solid rgba(75, 85, 99, 0.7);
    border-radius: 4px;
    padding: 10px 12px;
    color: #d1d5db;
    font-size: 14px;
    font-family: monospace;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(75, 85, 99, 0.5);
}

.btn-cancel {
    padding: 8px 16px;
    background: rgba(55, 65, 81, 0.8);
    color: #d1d5db;
    border: 1px solid rgba(75, 85, 99, 0.7);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.btn-submit {
    padding: 8px 16px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

/* 图片全屏模态框 */
.modal-image-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.image-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
}

.full-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.image-caption {
    position: absolute;
    bottom: -30px;
    left: 0;
    right: 0;
    text-align: center;
    color: #9ca3af;
    font-size: 12px;
}

/* 提示信息 */
.hint {
    position: fixed;
    top: 64px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 58, 138, 0.9);
    border: 1px solid rgba(59, 130, 246, 0.7);
    border-radius: 8px;
    padding: 12px 16px;
    z-index: 3000;
    max-width: 400px;
    backdrop-filter: blur(10px);
}

.hint.hidden {
    display: none;
}

.hint-content {
    font-size: 12px;
    color: #bfdbfe;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 事件叙述放大模态框 */
.event-tuple-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2500;
    opacity: 1;
    transition: opacity 0.3s;
    backdrop-filter: blur(4px);
}

.event-tuple-modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.event-tuple-modal-content {
    background: rgba(17, 24, 39, 0.95);
    border: 1px solid rgba(75, 85, 99, 0.5);
    border-radius: 8px;
    width: 80vw;
    height: 80vh;
    max-width: 1200px;
    max-height: 900px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    overflow: hidden;
}

.event-tuple-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid rgba(75, 85, 99, 0.5);
    background: rgba(31, 41, 55, 0.8);
}

.event-tuple-modal-header h3 {
    margin: 0;
    color: #60a5fa;
    font-size: 18px;
    font-weight: bold;
}

.event-tuple-modal-buttons {
    display: flex;
    gap: 12px;
}

.event-tuple-modal-button {
    background: rgba(55, 65, 81, 0.8);
    border: 1px solid rgba(75, 85, 99, 0.7);
    border-radius: 4px;
    color: #d1d5db;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.event-tuple-modal-button:hover {
    background: rgba(75, 85, 99, 0.9);
    color: #ffffff;
}

.event-tuple-modal-button.copy-button:hover {
    border-color: #10b981;
    color: #10b981;
}

.event-tuple-modal-button.close-button:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.event-tuple-modal-icon {
    width: 20px;
    height: 20px;
}

.event-tuple-modal-body {
    flex: 1;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: transparent;
}

.event-tuple-editor-textarea {
    flex: 1;
    width: 100%;
    border: none;
    resize: none;
}

.drawer-derive {
        display: grid !important; visibility: visible !important; opacity: 1 !important;
    }

    .event-tuple-modal-footer {
    padding: 12px 24px;
    background: rgba(31, 41, 55, 0.8);
    border-top: 1px solid rgba(75, 85, 99, 0.5);
    color: #9ca3af;
    font-size: 12px;
    text-align: center;
}

/* 覆盖 EasyMDE 样式以适应深色模态框 */
.event-tuple-modal-body .EasyMDEContainer {
    display: flex;
    flex-direction: column;
    height: 100%;
    border: none !important;
}

.event-tuple-modal-body .CodeMirror {
    flex: 1;
    border: none !important;
    border-radius: 0 !important;
    font-family: monospace;
    font-size: 14px;
    background: transparent !important;
    color: #d1d5db !important;
}

.event-tuple-modal-body .editor-toolbar {
    border: none !important;
    border-bottom: 1px solid rgba(75, 85, 99, 0.5) !important;
    border-radius: 0 !important;
    background: transparent !important;
    opacity: 1;
}

.event-tuple-modal-body .editor-toolbar > button {
    color: #d1d5db !important;
}

.event-tuple-modal-body .editor-toolbar > button:hover,
.event-tuple-modal-body .editor-toolbar > button.active {
    background: rgba(75, 85, 99, 0.5) !important;
    border-color: transparent !important;
}

.event-tuple-modal-body .editor-statusbar {
    padding: 8px 12px;
}

/* 放大按钮样式 */
.expand-btn {
    position: absolute;
    bottom: 8px;
    right: 8px; /* 放到右下角 */
    width: 28px;
    height: 28px;
    background: rgba(31, 41, 55, 0.9); /* 深色背景 */
    border: 1px solid rgba(75, 85, 99, 0.5); /* 边框 */
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #9ca3af; /* 浅灰色文字/图标 */
    font-size: 16px;
    transition: all 0.2s;
    z-index: 10;
    padding: 0;
}

.expand-btn:hover {
    background: rgba(55, 65, 81, 0.9);
    color: #60a5fa; /* hover时变蓝 */
    border-color: #60a5fa;
}

/* 工具类 */
.hidden {
    display: none !important;
}

.relative {
    position: relative;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .drawer {
        width: 100%;
        max-width: 100%;
        right: 0;
        left: 0;
    }
    
    .drawer-content {
        flex: 1;
        padding: 16px;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }
    
    .modal-content {
        width: 90%;
        padding: 16px;
    }

    /* 事件叙述模态框移动端适配 */
    .event-tuple-modal-content {
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }

    .event-tuple-modal-header {
        padding: 8px 12px;
        flex-direction: row;
        align-items: center;
    }

    .event-tuple-modal-header h3 {
        font-size: 14px;
        margin: 0;
    }

    .event-tuple-modal-buttons {
        gap: 8px;
    }

    .event-tuple-modal-button {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .drawer-derive {
        display: grid !important;
        visibility: visible !important;
        opacity: 1 !important;
        padding-bottom: 32px; /* 移动端底部留出安全区域 */
    }

    .event-tuple-modal-footer {
        display: none; /* 移动端隐藏底部提示以节省空间 */
    }

    /* EasyMDE 移动端适配 */
    .event-tuple-modal-body .editor-toolbar {
        padding: 4px;
        overflow-x: auto;
        white-space: nowrap;
        display: flex;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .event-tuple-modal-body .editor-toolbar button {
        flex-shrink: 0;
        width: 30px;
        height: 30px;
        padding: 0;
        margin: 0 2px;
    }

    .event-tuple-modal-body .editor-toolbar::before,
    .event-tuple-modal-body .editor-toolbar::after {
        display: none;
    }
}
