/* Terminal page layout */
.terminal-page {
    height: calc(100vh - 66px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #1e1e1e;
}

/* Toolbar */
.terminal-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: #252526;
    border-bottom: 1px solid #3c3c3c;
    flex-shrink: 0;
}
.terminal-toolbar .btn {
    padding: 4px 18px;
    font-size: 14px;
}
.terminal-toolbar .status-badge {
    font-size: 12px;
    padding: 4px 10px;
}
.terminal-toolbar .toolbar-info {
    margin-left: auto;
    font-size: 12px;
    color: #888;
}

/* Split pane */
.terminal-split {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.terminal-split .editor-pane {
    flex: 4;
    min-height: 120px;
    overflow: hidden;
}
.terminal-split .resize-handle {
    height: 5px;
    background: #3c3c3c;
    cursor: row-resize;
    flex-shrink: 0;
    transition: background 0.15s;
}
.terminal-split .resize-handle:hover,
.terminal-split .resize-handle.dragging {
    background: #0e639c;
}
.terminal-split .terminal-pane {
    flex: 1;
    min-height: 80px;
    overflow: hidden;
    position: relative;
}
.term-exit-bar {
    position: absolute;
    left: 12px;
    bottom: 6px;
    font-size: 12px;
    color: #999999;
    pointer-events: none;
    display: none;
    z-index: 5;
}
html[data-theme="light"] .term-exit-bar {
    color: #888888;
}
.terminal-split .terminal-pane .xterm {
    height: 100%;
    padding: 4px 0 0 8px;
}
.terminal-split .terminal-pane .xterm-viewport {
    scrollbar-width: thin;
    scrollbar-color: #555 #1e1e1e;
}

/* Light theme overrides */
html[data-theme="light"] .terminal-page {
    background: #ffffff;
}
html[data-theme="light"] .terminal-split .resize-handle {
    background: #e0e0e0;
}
html[data-theme="light"] .terminal-split .resize-handle:hover,
html[data-theme="light"] .terminal-split .resize-handle.dragging {
    background: #0451a5;
}
html[data-theme="light"] .terminal-split .terminal-pane .xterm-viewport {
    scrollbar-color: #ccc #ffffff;
}

/* Ensure cursor blink works (fallback for xterm.js dynamic CSS) */
.xterm .xterm-cursor.xterm-cursor-blink {
    animation: terminal-cursor-blink 1s step-end infinite !important;
}
@keyframes terminal-cursor-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Code-area custom context menu (剪切/复制/粘贴) */
.cpp-ctx-menu {
    position: fixed;
    z-index: 99999;
    min-width: 130px;
    padding: 4px 0;
    background: #252526;
    border: 1px solid #454545;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    font-size: 13px;
    line-height: 1.6;
    color: #e0e0e0;
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Segoe UI', sans-serif;
    user-select: none;
    -webkit-user-select: none;
}
.cpp-ctx-item {
    padding: 5px 16px;
    cursor: pointer;
    white-space: nowrap;
}
.cpp-ctx-item:hover {
    background: #094771;
    color: #fff;
}
.cpp-ctx-item.disabled {
    color: #6a6a6a;
    cursor: default;
}
.cpp-ctx-item.disabled:hover {
    background: transparent;
    color: #6a6a6a;
}
html[data-theme="light"] .cpp-ctx-menu {
    background: #ffffff;
    border: 1px solid #d0d0d0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    color: #333333;
}
html[data-theme="light"] .cpp-ctx-item:hover {
    background: #e8f0fe;
    color: #1a73e8;
}
html[data-theme="light"] .cpp-ctx-item.disabled,
html[data-theme="light"] .cpp-ctx-item.disabled:hover {
    color: #9a9a9a;
}
