/* The Plugins page: New plugin, the Language column and editing a plugin's files (loaded after
 * `console_pages.css`, which holds the source view's base styles). */

/* New plugin: a circled plus beside the page title. */
.plugins-header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.plugin-new-button {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 40px; min-height: 40px; padding: 0; border: 0; border-radius: 50%;
    background: transparent; color: #85caff; font-size: 1.75rem; line-height: 1;
}
.plugin-new-button:hover { color: #b8e0ff; background: transparent; }
.plugin-new-button:focus-visible { outline: 2px solid #85caff; outline-offset: 2px; color: #b8e0ff; }

/* The languages' logos (Font Awesome brands). */
.plugin-language { display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.plugin-language i { font-size: 1.2rem; }
.plugin-language-python i { color: #6cb6ff; }
.plugin-language-rust i { color: #f0a070; }
.plugins-table .plugin-kind { text-align: left; }
.plugin-mobile-meta { display: flex; align-items: center; gap: 2px; }
.plugin-mobile-meta .plugin-language i { font-size: 0.95rem; }
.plugin-detail-language { display: inline-flex; align-items: center; gap: 8px; }
.plugin-source-file-kind .plugin-language i { font-size: 1rem; }
.plugin-source-toolbar .plugin-source-toolbar-language i { font-size: 1.05rem; }
.plugin-source-toolbar .plugin-source-toolbar-language + code { margin-left: -4px; }

/* The New plugin dialog. */
.plugin-new-field { margin-bottom: 16px; }
.plugin-new-label { display: block; margin-bottom: 6px; font-weight: 600; }
.plugin-new-languages .form-check-label { display: inline-flex; align-items: center; }
.plugin-new-language { display: inline-flex; align-items: center; gap: 8px; }
.plugin-new-features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; }
.plugin-new-error { margin: 8px 0 0; overflow-wrap: anywhere; }
.plugin-new-modal .modal-body { min-width: 0; }

/* Edit, Save and Cancel in a file's toolbar. */
.plugin-source-action { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; }
.plugin-source-action i { font-size: 0.9rem; }
.plugin-source-action.btn-outline-secondary { color: #dceaf6; border-color: #5b6875; }
.plugin-source-action.btn-outline-secondary:hover, .plugin-source-action.btn-outline-secondary:focus-visible {
    color: #fff; background: #213449; border-color: #85caff;
}
.plugin-source-alert:empty { display: none; }
.plugin-source-alert .alert { margin: 0 0 8px; overflow-wrap: anywhere; }

/* The editor (CodeMirror, `codemirror.bundle.js`): the code view's colors and size. */
.plugin-source-code.plugin-source-editor-code { display: flex; flex-direction: column; background: #17212b; }
.plugin-source-editor-code:focus-within { box-shadow: inset 0 0 0 1px #85caff; }
.plugin-source-editor { min-width: 0; min-height: 12rem; }
.plugin-source-editor .cm-editor { min-height: 12rem; max-height: 65vh; }
.plugin-source-editor[aria-busy="true"] { background: #17212b; }
/* Vim: pressed while Vim keybindings are on; Vim's status line matches the editor. */
.plugin-source-vim.active, .plugin-source-vim[aria-pressed="true"] { color: #fff; background: #24425f; border-color: #85caff; }
.plugin-source-editor .cm-vim-panel { padding: 2px 12px; background: #131c25; color: #dceaf6;
    font-family: var(--bs-font-monospace); font-size: 0.8rem; }
.plugin-source-editor .cm-vim-panel input { background: transparent; color: #dceaf6; border: 0; outline: none; }
.plugin-source-editor .cm-fat-cursor { background: #85caff !important; color: #17212b !important; }
/* Without the editor's script: a plain text area with the same look. */
.plugin-source-plain-editor,
.dbc_dark .plugin-source-editor-code textarea.plugin-source-plain-editor {
    display: block; width: 100%; min-height: 12rem; height: 65vh; margin: 0; padding: 12px 16px;
    border: 0; border-radius: 0; outline: none; resize: vertical;
    background-color: #17212b !important; color: #dceaf6 !important; caret-color: #85caff;
    font-family: var(--bs-font-monospace); font-size: 0.8rem; line-height: 1.5;
    white-space: pre; overflow: auto; tab-size: 4;
}
/* The tree keeps the edited file open until Save or Cancel. */
.plugin-source-browser.plugin-source-editing .plugin-source-file:not(.active) { opacity: 0.55; cursor: not-allowed; }
.plugin-source-fullscreen .plugin-source-editor-code { flex: 1 1 auto; min-height: 0; }
.plugin-source-fullscreen .plugin-source-editor { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.plugin-source-fullscreen .plugin-source-editor .cm-editor { flex: 1 1 auto; max-height: none; height: 100%; }
.plugin-source-fullscreen .plugin-source-plain-editor { flex: 1 1 auto; height: auto; }
.plugin-source-fullscreen .plugin-source-header { display: none; }

@media (max-width: 767.98px) {
    .plugin-new-button { min-width: 44px; min-height: 44px; }
    .plugin-new-features { grid-template-columns: minmax(0, 1fr); }
    .plugin-new-modal .form-check { padding-top: 6px; padding-bottom: 6px; }
    .plugin-new-modal .modal-footer .btn { min-height: 44px; }
    .plugin-source-action { min-height: 44px; min-width: 44px; justify-content: center; }
    .plugin-source-editor .cm-editor { max-height: 55vh; }
    /* With Save and Cancel, the file's path takes the first row instead of wrapping by letter. */
    .plugin-source-preview-editing .plugin-source-toolbar code { flex: 1 0 calc(100% - 3rem); }
    .plugin-source-plain-editor { height: 55vh; }
}

/* New plugin: Start from a template or Upload files (one segmented control), and the files. */
.plugin-new-mode { display: flex; flex-wrap: nowrap; width: 100%; margin: 0 0 16px; }
.plugin-new-mode .form-check { flex: 1 1 0; min-width: 0; margin: 0; padding: 0; min-height: 0; }
.plugin-new-mode .btn {
    display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;
    min-height: 40px; padding: 6px 8px; border-radius: 0; line-height: 1.2;
    color: #d4dde6; border-color: #53677a; background: transparent;
}
.plugin-new-mode .form-check + .form-check .btn { margin-left: -1px; }
.plugin-new-mode .form-check:first-child .btn { border-top-left-radius: 6px; border-bottom-left-radius: 6px; }
.plugin-new-mode .form-check:last-child .btn { border-top-right-radius: 6px; border-bottom-right-radius: 6px; }
.plugin-new-mode .btn:hover { background: #2f3a45; color: #fff; }
.plugin-new-mode .btn.active, .plugin-new-mode .btn-check:checked + .btn { background: #3a6a96; border-color: #3a6a96; color: #fff; }
.plugin-new-mode .btn-check:focus-visible + .btn { outline: 2px solid #85caff; outline-offset: 1px; }
.plugin-upload { display: block; width: 100%; cursor: pointer; }
.plugin-upload-zone {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    min-height: 72px; padding: 12px; border: 1px dashed #5b6875; border-radius: 6px;
    background: #17212b; color: #dceaf6; text-align: center;
}
.plugin-upload:hover .plugin-upload-zone, .plugin-upload:focus-within .plugin-upload-zone,
.plugin-upload-active .plugin-upload-zone { border-color: #85caff; background: #1d2a37; }
.plugin-upload-zone i { color: #85caff; }
.plugin-upload-chosen { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 767.98px) {
    .plugin-new-mode .btn { min-height: 44px; font-size: 0.9rem; }
}
