/* ═══════════════════════════════════════════════════════════
   PINE EDITOR PANEL + EDITOR + DROPDOWN
   TITLEBAR + ACTIONBAR + LIGHT THEME
   ═══════════════════════════════════════════════════════════ */

/* PINE EDITOR PANEL  (slides up from bottom) */
.pe-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 320px;
    background: var(--ui-panel, #1e222d);
    border-top: 1px solid var(--ui-border, rgba(255,255,255,.08));
    z-index: 500;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -6px 24px rgba(0,0,0,.35);
    transition: height 0.18s ease;
    resize: vertical;
    overflow: hidden;
}
.pe-panel.hidden { display: none !important; }

/* â”€â”€ Header â”€â”€ */
.pe-header {
    display: flex;
    align-items: center;
    height: 38px;
    min-height: 38px;
    padding: 0 8px 0 12px;
    border-bottom: 1px solid var(--ui-border, rgba(255,255,255,.08));
    gap: 6px;
    flex-shrink: 0;
}
.pe-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--ui-fg, #d1d4dc);
    white-space: nowrap;
    margin-right: 8px;
}
.pe-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}
.pe-spacer { flex: 1; }

/* â”€â”€ Script name button â”€â”€ */
.pe-script-wrap { position: relative; }
.pe-script-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 28px;
    padding: 0 8px;
    border: 1px solid var(--ui-border, rgba(255,255,255,.08));
    border-radius: 5px;
    background: transparent;
    color: var(--ui-fg, #d1d4dc);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s, border-color 0.12s;
}
.pe-script-btn:hover {
    background: rgba(120,120,140,.14);
    border-color: rgba(120,120,140,.3);
}

/* â”€â”€ Tool buttons â”€â”€ */
.pe-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: var(--ui-fg-muted, #787b86);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}
.pe-tool-btn:hover {
    background: rgba(120,120,140,.14);
    color: var(--ui-fg, #d1d4dc);
}

/* â”€â”€ Publish button â”€â”€ */
.pe-publish-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 12px;
    border: 1px solid var(--ui-border, rgba(255,255,255,.08));
    border-radius: 5px;
    background: transparent;
    color: var(--ui-fg, #d1d4dc);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s, border-color 0.12s;
}
.pe-publish-btn:hover {
    background: rgba(120,120,140,.14);
    border-color: rgba(120,120,140,.3);
}

/* â”€â”€ Close button â”€â”€ */
.pe-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--ui-fg-muted, #787b86);
    cursor: pointer;
    margin-left: 4px;
    transition: background 0.12s, color 0.12s;
}
.pe-close-btn:hover {
    background: rgba(120,120,140,.14);
    color: var(--ui-fg, #d1d4dc);
}

/* â”€â”€ Editor area â”€â”€ */
.pe-editor-wrap {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: var(--ui-panel, #1e222d);
}
.pe-line-nums {
    width: 44px;
    padding: 10px 8px 10px 0;
    text-align: right;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: var(--ui-fg-muted, #787b86);
    background: rgba(0,0,0,.12);
    border-right: 1px solid var(--ui-border, rgba(255,255,255,.06));
    overflow: hidden;
    user-select: none;
    flex-shrink: 0;
}
.pe-editor {
    flex: 1;
    padding: 10px 12px;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: var(--ui-fg, #d1d4dc);
    overflow-y: auto;
    overflow-x: auto;
    tab-size: 4;
    white-space: pre;
}
.pe-editor::selection {
    background: rgba(41,98,255,.35);
}

/* â”€â”€ Status bar â”€â”€ */
.pe-statusbar {
    display: flex;
    align-items: center;
    height: 26px;
    min-height: 26px;
    padding: 0 8px;
    border-top: 1px solid var(--ui-border, rgba(255,255,255,.06));
    background: rgba(0,0,0,.12);
    gap: 6px;
    flex-shrink: 0;
}
.pe-terminal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 3px;
    background: transparent;
    color: var(--ui-fg-muted, #787b86);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}
.pe-terminal-btn:hover {
    background: rgba(120,120,140,.14);
    color: var(--ui-fg, #d1d4dc);
}
.pe-error-msg {
    font-size: 11px;
    color: #ef5350;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pe-status-spacer { flex: 1; }
.pe-cursor-pos {
    font-size: 11px;
    color: var(--ui-fg-muted, #787b86);
    white-space: nowrap;
}
.pe-lang-tag {
    font-size: 11px;
    color: var(--ui-fg-muted, #787b86);
    white-space: nowrap;
    padding-left: 8px;
    border-left: 1px solid var(--ui-border, rgba(255,255,255,.08));
}

/* â”€â”€ Script name dropdown â”€â”€ */
.pe-dropdown {
    position: fixed;
    background: var(--ui-panel, #1e222d);
    border: 1px solid var(--ui-border, rgba(255,255,255,.1));
    border-radius: 8px;
    padding: 6px 0;
    z-index: 99999;
    box-shadow: 0 8px 32px rgba(0,0,0,.45);
    min-width: 200px;
}
.pe-dropdown.hidden { display: none; }
.pe-dd-item {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 34px;
    padding: 0 14px;
    cursor: pointer;
    color: var(--ui-fg, #d1d4dc);
    font-size: 13px;
    transition: background 0.1s;
}
.pe-dd-item:hover { background: rgba(120,120,140,.14); }
.pe-dd-sep {
    height: 1px;
    background: var(--ui-border, rgba(255,255,255,.08));
    margin: 4px 0;
}

/* â”€â”€ Title bar (Row 1) â”€â”€ */
.pe-titlebar {
    display: flex;
    align-items: center;
    height: 36px;
    min-height: 36px;
    padding: 0 8px 0 12px;
    border-bottom: 1px solid var(--ui-border, rgba(255,255,255,.08));
    flex-shrink: 0;
}
.pe-titlebar .pe-title {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: var(--ui-fg, #d1d4dc);
    margin-right: 0;
}
.pe-titlebar-right {
    display: flex;
    align-items: center;
    gap: 2px;
}

/* â”€â”€ Icon button (popout + close in titlebar) â”€â”€ */
.pe-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--ui-fg-muted, #787b86);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    flex-shrink: 0;
}
.pe-icon-btn:hover {
    background: rgba(120,120,140,.14);
    color: var(--ui-fg, #d1d4dc);
}

/* â”€â”€ Action bar (Row 2) â”€â”€ */
.pe-actionbar {
    display: flex;
    align-items: center;
    height: 38px;
    min-height: 38px;
    padding: 0 8px 0 10px;
    border-bottom: 1px solid var(--ui-border, rgba(255,255,255,.08));
    gap: 4px;
    flex-shrink: 0;
}
.pe-actionbar-divider {
    width: 1px;
    height: 20px;
    background: var(--ui-border, rgba(255,255,255,.1));
    margin: 0 4px;
    flex-shrink: 0;
}

/* â”€â”€ Action buttons: Add to chart / Save â”€â”€ */
.pe-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 10px;
    border: none;
    border-radius: 5px;
    background: rgba(120,120,140,.1);
    color: var(--ui-fg, #d1d4dc);
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.12s;
}
.pe-action-btn:hover { background: rgba(120,120,140,.22); }
.pe-action-btn.pe-save-btn {
    background: var(--accent, #2962ff);
    color: #fff;
}
.pe-action-btn.pe-save-btn:hover { background: #1e4fcf; }

/* â”€â”€ More options button â”€â”€ */
.pe-more-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 28px;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: var(--ui-fg-muted, #787b86);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.12s, color 0.12s;
    margin-left: auto;
}
.pe-more-btn:hover {
    background: rgba(120,120,140,.14);
    color: var(--ui-fg, #d1d4dc);
}
.pe-more-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ef5350;
    pointer-events: none;
}

/* â”€â”€ Light theme â”€â”€ */

