@import url('./floating-editor.css');
/* 提高补全提示的 z-index */
.monaco-editor .suggest-widget {
    z-index: 10000 !important;
}

/* 如果还被遮挡，提高编辑器容器的 z-index */
.monaco-editor {
    position: relative;
    z-index: 1;
}

/* 确保补全提示不被父容器裁剪 */
#monacoEditor,
.code-editor-container,
.editor-wrapper {
    overflow: visible !important;
}


.inner-scratchpad {
    width: 100%;
    height: 72vh;
    overflow: visible !important;  /* ⭐ 改为 visible */
    margin-top : 30px;
}

:is(.inner-scratchpad, .floating-code-editor) {
    .code-editor-container {
        display: flex;
        flex-direction: column;
        height: 100%;
        background: #1e1e1e;
    }

/* ========== 顶部工具栏 ========== */
.editor-toolbar {
    background: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    padding: 12px 0px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: #e0e0e0;
}

.language-selector {
    padding: 6px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.language-selector:hover {
    border-color: #4CAF50;
}

.language-selector:focus {
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.1);
}

.toolbar-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    transform: none !important;
    outline: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    width: auto !important;
}

.editor-toolbar .small-btn {
    padding : 0;
}

.editor-toolbar .small-btn:hover{
    background: #F0F0F0;
}

.btn .icon {
    font-size: 18px;
    line-height: 1;
}

.btn-primary {
    background: #4CAF50;
    color: white;
    width: auto !important;
}

.btn-primary:hover {
    background: #45a049;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.3);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-secondary {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #e0e0e0;
}

.btn-secondary:hover {
    background: #eeeeee;
}

/* 按钮禁用状态样式 */
.btn:disabled,
.btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none; /* 阻止所有鼠标事件，包括 hover */
}

/* 主要按钮禁用状态 */
.btn-primary:disabled,
.btn-primary[disabled] {
    background: #9e9e9e !important;
    color: #ffffff !important;
    border-color: #9e9e9e !important;
    box-shadow: none !important;
}

/* 次要按钮禁用状态 */
.btn-secondary:disabled,
.btn-secondary[disabled] {
    background: #f5f5f5 !important;
    color: #bdbdbd !important;
    border-color: #e0e0e0 !important;
}

/* 禁用时移除 hover 效果 */
.btn:disabled:hover,
.btn[disabled]:hover {
    transform: none !important;
    box-shadow: none !important;
}
/* ========== 编辑器区域 ========== */
/* 你的原样式 + 兼容加载层 */
.editor-wrapper {
  flex: 1;
  overflow: visible !important;  /* ⭐ 改为 visible */
  position: relative;
  min-height: 0;
  border: 1px solid #333;
  border-radius: 4px;
  background: #1e1e1e; /* 建议：防止加载中出现闪白，可改成主题背景色 */
}

/* 加载中遮罩层（放在 editor-wrapper 内部） */
.editor-loading {
  position: absolute;
  inset: 0; /* 等价于 top/right/bottom/left:0 */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(30, 30, 30, 0.9); /* 半透明暗色蒙层 */
  color: #ccc;
  font-size: 14px;
  z-index: 10;
  pointer-events: none; /* 避免阻挡事件 */
}

/* 旋转加载圈 */
.editor-spinner {
  border: 3px solid #555;
  border-top: 3px solid #09f;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  animation: spin 0.8s linear infinite;
  margin-bottom: 10px;
}

/* 旋转动画 */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.monaco-editor {
    width: 100%;
    height: 100%;
}

/* ========== 底部面板 ========== */
.bottom-panel {
    background: #ffffff;
    border-top: 1px solid #e0e0e0;
    height: 300px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.panel-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 16px 0px 4px;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
}

.tab-btn {
    padding: 10px 10px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;    

    /* 关键：为所有 tab 添加透明边框，保持一致高度 */
    border-bottom: 2px solid transparent;
}

.tab-btn .icon {
    font-size: 16px;
}

.tab-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

.tab-btn.active {
    background: #ffffff;
    color: #4CAF50;
    /* 只改变颜色，不改变尺寸 */
    border-bottom: 2px solid #4CAF50;
}

.panel-content {
    flex: 1;
    overflow: auto;
    position: relative;
}

.tab-panel {
    display: none;
    height: 100%;
    padding: 10px;
}

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

/* ========== 运行结果面板 ========== */
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 4px;
    margin-bottom: 12px;
}

.result-status {
    font-weight: 600;
    color: #666;
}

.result-status.accepted {
    color: #4CAF50;
}

.result-status.error {
    color: #f44336;
}

.result-time {
    font-size: 12px;
    color: #999;
}

.result-output {
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 12px;
    height: calc(100% - 60px);
    overflow: auto;
}

.result-output pre {
    margin: 0!important;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace!important;
    font-size: 13px!important;
    line-height: 1.6!important;
    color: #333!important;
    white-space: pre-wrap!important;
    word-wrap: break-word!important;
    background: transparent!important;
    border-radius: 0% !important;
    box-shadow: none !important;
}

/* ========== 自测面板 ========== */
.test-case-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.test-case {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
}

.test-case-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
}


.test-case-header {
    padding: 6px 10px;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
}

/* 容纳多个 tab 的容器 */
.testcase-tabs {
    display: flex;
    gap: 8px;          /* tab 之间保留一点点间隙 */
}

/* 单个 tab */
.testcase-tab {
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: #fff;
    font-size: 13px;
    cursor: pointer;
    gap: 6px;
    display: inline-flex;      /* 或者 flex，看你布局需求 */
    align-items: center;
}
.testcase-tab:hover {
    background: #f0f8ff;
    border-color: #a0cfff;
    color: #409eff;
}

.testcase-tab.active {
    border-color: #409eff;
    background: #e6f2ff;
    color: #409eff;
}

.testcase-tab .dot {
    display: none;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    flex-shrink: 0; 
}
.testcase-tab .dot.accepted {
    display: inline-block;
    background-color: #4CAF50;
}
.testcase-tab .dot.error {
    display: inline-block;
    background-color: #f44336;
}



/* 不同用例的 body 默认隐藏，只显示 active 对应的 */
.test-case-body {
    padding: 16px;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 10px 12px;
    display: none;
}
.test-case-body.active {
    display: block;
}


.test-input-rows {
    display: flex;
    flex-direction: column;
    gap: 4px; /* 每个参数行之间一点点间距 */
}
.test-param-row {
    display: flex;
    flex-direction: column;   /* 上下排 */
    align-items: flex-start;  /* 靠左对齐 */
    gap: 4px;                /* 名字和文本框之间留一点距离 */
    margin-bottom: 8px;      /* 每个参数块之间留一点间距 */
}

.test-param-name {
    white-space: nowrap;
    color: #555;
    font-size: 13px;
}

.test-param-textarea {
    width: 100%;
    min-height: 36px;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    box-sizing: border-box;
    overflow: hidden;      /* 不出现滚动条 */
    resize: none;          /* 禁止用户用鼠标拖拽改变大小（可选） */
}
.test-param-textarea.readonly{
    background-color: #f0f0f0;  /* 浅灰 */
    color: #333;               /* 字体颜色稍深，保持可读性 */
}



.test-case-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.test-case-status.pending {
    background: #e0e0e0;
    color: #666;
}

.test-case-status.passed {
    background: #c8e6c9;
    color: #2e7d32;
}

.test-case-status.failed {
    background: #ffcdd2;
    color: #c62828;
}

.test-input label,
.test-output label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    margin-bottom: 8px;
}

.test-textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
}

.test-textarea:focus {
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.1);
}

.add-test-btn {
    width: 100%;
    justify-content: center;
    padding: 12px;
}

/* ========== 控制台面板 ========== */
.console-content {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 12px;
    border-radius: 4px;
    height: 100%;
    overflow: auto;
}

.console-content pre {
    margin: 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* ========== 响应式设计 ========== */
@media (max-width: 768px) {
    .editor-toolbar {
        flex-direction: column;
        height: auto;
        gap: 12px;
        padding: 12px;
    }

    .toolbar-left,
    .toolbar-right {
        width: 100%;
        justify-content: space-between;
    }

    .test-case-body {
        grid-template-columns: 1fr;
    }

    .bottom-panel {
        height: 250px;
    }
}

/* ========== 滚动条样式 ========== */
.result-output::-webkit-scrollbar,
.console-content::-webkit-scrollbar,
.panel-content::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.result-output::-webkit-scrollbar-track,
.console-content::-webkit-scrollbar-track,
.panel-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.result-output::-webkit-scrollbar-thumb,
.console-content::-webkit-scrollbar-thumb,
.panel-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.result-output::-webkit-scrollbar-thumb:hover,
.console-content::-webkit-scrollbar-thumb:hover,
.panel-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}



/* 单题模式链接样式 */
.single-mode-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 6px;
    font-size: 14px;
    color: #666;
    text-decoration: none;
    border: 1px dashed #d0d0d0;
    border-radius: 4px;
    background: transparent;
    transition: all 0.2s;
    font-weight: 400;
}

.single-mode-link .icon {
    font-size: 14px;
    line-height: 1;
}

.single-mode-link:hover {
    color: #4CAF50;
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.05);
}

.single-mode-link:active {
    transform: translateY(1px);
}

/* 响应式：小屏幕时的调整 */
@media (max-width: 768px) {
    .panel-actions {
        flex-wrap: wrap;
    }
    
    .single-mode-link {
        width: 100%;
        justify-content: center;
    }
}
.result-loading-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 8px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    vertical-align: middle;
}

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

.result-status.running {
    color: #ff9800;
}

.locked {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none; /* 阻止所有点击事件 */
}

.tab-btn.locked {
    background-color: #f0f0f0;
}


/* 在 .testcase-tabs 后添加 */
.testcase-tabs-wrapper {
    display: flex;
    align-items: center;  /* 改成 center，垂直居中 */
    gap: 8px;            /* 添加间距，让按钮和 tabs 之间有点空隙 */
    /* 删除 justify-content: space-between; */
    /* 删除 width: 100%; */
}

.reset-testcase-btn {
    padding: 4px 8px;
    border: none;
    background: transparent;
    color: #999;
    font-size: 16px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    line-height: 1;
    flex-shrink: 0;  /* 添加这一行，防止按钮被压缩 */
}

.reset-testcase-btn:hover {
    background: #f0f0f0;
    color: #666;
}

.reset-testcase-btn .icon {
    display: inline-block;
}


/* ========== 拖动条样式 ========== */
.editor-resizer {
    height: 4px;
    background: #e0e0e0;
    cursor: ns-resize;
    position: relative;
    flex-shrink: 0;
    transition: background 0.2s;
}

.editor-resizer:hover {
    background: #4CAF50;
}

.editor-resizer::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 8px;
    background: inherit;
    border-radius: 4px;
}

/* 拖动时的样式 */
.editor-resizer.resizing {
    background: #4CAF50;
}

.code-editor-container.resizing {
    user-select: none;
}

.code-editor-container.resizing * {
    cursor: ns-resize !important;
}

/* ========== 问问AI面板样式 ========== */
.ai-panel-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* 分隔线 - 浅色样式 */
.ai-divider {
    text-align: center;
    position: relative;
    color: #999;
    font-size: 13px;
    flex-shrink: 0;
}

.ai-divider::before {
    content: '';
    position: absolute;
    left: 16px;
    right: 16px;
    top: 50%;
    height: 1px;
    background: linear-gradient(to right, transparent, #e0e0e0 20%, #e0e0e0 80%, transparent);
}

.ai-divider span {
    background: white;
    padding: 0 12px;
    position: relative;
    z-index: 1;
}

/* 提交记录列表 */
.ai-submissions-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 12px;
}

.ai-submissions-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    gap: 8px;
}

.ai-submissions-empty .icon {
    font-size: 48px;
    opacity: 0.5;
}

.ai-submissions-empty .hint {
    font-size: 12px;
    color: #bbb;
}

/* 提交记录项 */
.ai-submission-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 10px;
    margin-bottom: 5px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}

.ai-submission-item:hover {
    border-color: #4CAF50;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.15);
    transform: translateY(-1px);
}

.ai-submission-left {
    display: flex;
    align-items: center;
    gap: 0;
}

.ai-submission-score {
    font-size: 18px;
    font-weight: 600;
    min-width: 50px;
}

.ai-submission-score.accepted {
    color: #4CAF50;
}

.ai-submission-score.partial {
    color: #ff9800;
}

.ai-submission-score.error {
    color: #f44336;
}

.ai-submission-status {
    font-size: 15px;
    font-weight: 600;
}

.ai-submission-status.accepted {
    color: #4CAF50;
}

.ai-submission-status.partial {
    color: #ff9800;
}

.ai-submission-status.error {
    color: #f44336;
}

.ai-submission-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 已提问标记 */
.ai-asked-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #4CAF50;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
}

.ai-submission-lang {
    padding: 3px 10px;
    background: #e3f2fd;
    color: #1976d2;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.ai-submission-time {
    font-size: 12px;
    color: #999;
    min-width: 80px;
    text-align: right;
}

/* 滚动条 */
.ai-submissions-list::-webkit-scrollbar {
    width: 6px;
}

.ai-submissions-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.ai-submissions-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.ai-submissions-list::-webkit-scrollbar-thumb:hover {
    background: #999;
}

}

/* IDE 加载状态 */
.ide-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 16px;
    color: #666;
    font-size: 14px;
}

.ide-loading .loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* IDE 错误状态 */
.ide-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 16px;
    color: #e74c3c;
    font-size: 14px;
}

.ide-error .error-icon {
    font-size: 48px;
}

.ide-error button {
    padding: 8px 16px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.ide-error button:hover {
    background: #2980b9;
}

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


