/* ============================================================
   Command Pane — Editor, toolbar, textarea, macros
   ============================================================ */

/* ── Resize Handle ─────────────────────────────────────────── */

.command-pane-resize-handle {
    height: 4px;
    cursor: row-resize;
    background: var(--border);
    flex-shrink: 0;
    transition: background 0.15s;
    position: relative;
    z-index: 5;
}

.command-pane-resize-handle::before {
    content: '';
    position: absolute;
    top: -6px;
    bottom: -6px;
    left: 0;
    right: 0;
    cursor: row-resize;
}

.command-pane-resize-handle:hover,
.command-pane-resize-handle.dragging {
    background: var(--accent);
}

/* ── Command Pane ──────────────────────────────────────────── */

.command-pane {
    display: flex;
    flex-direction: column;
    height: 300px;
    min-height: 80px;
    max-height: 60vh;
    min-width: 0;
    background: var(--bg-secondary);
    flex-shrink: 0;
    overflow: visible;
    container-type: inline-size;
    container-name: command-pane;
}

.command-pane-toolbar {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
    min-width: 0;
    overflow: visible;
    flex-wrap: wrap;
    position: relative;
    z-index: 20;
}

.toolbar-divider {
    width: 1px;
    height: 20px;
    background: var(--border);
    flex-shrink: 0;
}

.toolbar-spacer {
    flex: 1;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.command-pane-body {
    flex: 1;
    min-height: 0;
    display: flex;
    gap: 10px;
    padding: 8px 20px 12px;
    overflow: visible;
}

.command-editor {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    position: relative;
}

.command-pane textarea {
    flex: 1;
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font-mono);
    outline: none;
    transition: border-color 0.15s;
    resize: none;
    min-height: 0;
    line-height: 1.5;
}

.command-pane textarea:focus {
    border-color: var(--accent);
}

/* ── Collapse mode buttons to icons when pane is narrow ────── */

@container command-pane (max-width: 850px) {
    .btn-mode .btn-label {
        display: none;
    }
}

/* ── Macro Buttons ─────────────────────────────────────────── */

.macro-btn-wrap {
    position: relative;
    display: inline-flex;
}

.macro-delete-btn {
    display: none;
    position: absolute;
    top: -6px;
    right: -6px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.macro-btn-wrap:hover .macro-delete-btn {
    display: inline-flex;
}

.macro-delete-btn:hover {
    background: rgba(248, 81, 73, 0.2);
    border-color: var(--error);
    color: var(--error);
}

.btn-add-macro {
    font-size: 16px;
    font-weight: 400;
    color: var(--text-muted);
    border-style: dashed;
    min-width: 28px;
}

.btn-add-macro:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(31, 111, 235, 0.1);
}

/* ── Command Hint ──────────────────────────────────────────── */

.command-hint {
    font-size: 11px;
    color: var(--text-muted);
    padding: 4px 0 0;
    text-align: right;
}

.command-hint kbd {
    display: inline-block;
    padding: 1px 5px;
    font-size: 10px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 3px;
    box-shadow: 0 1px 0 var(--border);
}

/* ── File @mention Dropdown ───────────────────────────────── */

.file-mention-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    max-height: 240px;
    overflow-y: auto;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    z-index: 100;
    margin-bottom: 4px;
}

.file-mention-item {
    padding: 6px 12px;
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-mention-item:hover,
.file-mention-item.selected {
    background: var(--accent);
    color: #fff;
}

.file-mention-item strong {
    color: inherit;
    font-weight: 700;
}
