/**
 * CloudScale Code Block, Editor Styles v1.1.1
 */

.cs-code-editor-wrapper {
    border: 1px solid #1e1e1e;
    border-radius: 8px;
    overflow: hidden;
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', 'Consolas', monospace;
    box-sizing: border-box;
}

.cs-code-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: #1e1e1e;
    color: #9da5b4;
    font-size: 12px;
    font-weight: 500;
    user-select: none;
    width: 100%;
    box-sizing: border-box;
}

.cs-code-editor-icon {
    display: flex;
    align-items: center;
    color: #61aeee;
    flex-shrink: 0;
}

.cs-code-editor-label {
    color: #abb2bf;
    font-weight: 600;
    white-space: nowrap;
}

.cs-code-editor-lang {
    margin-left: auto;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #98c379;
    white-space: nowrap;
    flex-shrink: 0;
}

.cs-code-editor-lang-auto {
    color: #7c8493;
    font-style: italic;
    text-transform: none;
    font-weight: 400;
}

.cs-code-editor-title {
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    font-size: 11px;
    color: #d19a66;
    white-space: nowrap;
    flex-shrink: 0;
}

.cs-code-editor-textarea {
    display: block;
    width: 100% !important;
    min-height: 60px;
    padding: 16px 18px !important;
    margin: 0 !important;
    border: none !important;
    outline: none !important;
    resize: vertical;
    background: #282c34 !important;
    color: #e8eaed !important;
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', 'Consolas', monospace !important;
    font-size: 13px !important;
    line-height: 1.6 !important;
    tab-size: 4;
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
    box-sizing: border-box;
}

.cs-code-editor-textarea::placeholder {
    color: #5c6370;
    font-style: italic;
}

.cs-code-editor-textarea:focus {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

.cs-code-editor-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
}

.cs-code-editor-lang {
    margin-left: 0;
}

.cs-code-editor-btn {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    color: #abb2bf;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    line-height: 1.6;
}

.cs-code-editor-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.cs-code-editor-btn-copy:hover {
    border-color: #98c379;
    color: #98c379;
}

.cs-code-editor-btn-clear:hover {
    border-color: #e06c75;
    color: #e06c75;
}

.cs-code-editor-btn-paste:hover {
    border-color: #61aeee;
    color: #61aeee;
}

/* GitHub toolbar button + popover.
   The wrap is `position: relative` only so the Popover anchors correctly
   relative to the button when WP_Components computes its position. */
.cs-code-editor-gh-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.cs-code-editor-btn-gh {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.cs-code-editor-btn-gh svg {
    display: block;
}

.cs-code-editor-btn-gh:hover {
    border-color: #c9d1d9;
    color: #fff;
}

/* Highlighted state when a GitHub URL is already set on the block. */
.cs-code-editor-btn-gh.is-linked {
    color: #98c379;
    border-color: rgba(152, 195, 121, 0.45);
    background: rgba(152, 195, 121, 0.12);
}

.cs-code-editor-btn-gh.is-linked:hover {
    color: #b5e8a1;
    border-color: #98c379;
    background: rgba(152, 195, 121, 0.2);
}

.cs-code-editor-btn-gh-label {
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
}

/* Popover body, keeps the URL field comfortable to type into. */
.cs-code-editor-gh-popover .components-popover__content {
    width: 360px;
    max-width: calc(100vw - 32px);
}

.cs-code-editor-gh-popover-body {
    padding: 14px 16px 12px;
    color: #1f2328;
}

.cs-code-editor-gh-popover-title {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 10px;
}

.cs-code-editor-gh-popover-body .components-base-control {
    margin-bottom: 10px;
}

.cs-code-editor-gh-popover-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.cs-code-editor-gh-popover-hint {
    margin: 10px 0 0;
    font-size: 11px;
    color: #57606a;
    font-style: italic;
}

/* ── GitHub Source inspector panel ─────────────────────────────────────── */
.cs-gh-status {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.5;
}
.cs-gh-status-ok {
    background: rgba(46, 160, 67, 0.08);
    border: 1px solid rgba(46, 160, 67, 0.25);
    color: #1b6f2b;
}
.cs-gh-status-ok .cs-gh-status-line {
    font-weight: 600;
}
.cs-gh-status-ok .cs-gh-status-path {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    opacity: 0.85;
    word-break: break-all;
}
.cs-gh-status-ok .cs-gh-status-meta {
    margin-top: 4px;
    opacity: 0.75;
}
.cs-gh-status-error {
    background: rgba(207, 34, 46, 0.08);
    border: 1px solid rgba(207, 34, 46, 0.25);
    color: #8a1a23;
}
.cs-gh-phase-note {
    margin-top: 8px;
    font-size: 11px;
    color: #757575;
}
.cs-gh-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}
.cs-gh-stale-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 6px;
    border-radius: 3px;
    background: rgba(214, 124, 0, 0.15);
    color: #8a4a00;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.cs-code-editor-gh-banner {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(110, 84, 226, 0.12);
    color: #4a3a8c;
    border-bottom: 1px solid rgba(110, 84, 226, 0.2);
    font-size: 11px;
}
.cs-code-editor-gh-banner svg {
    flex-shrink: 0;
}

/* ── Mobile: wrap toolbar actions onto a second row ─────────────────── */
@media (max-width: 600px) {
    .cs-code-editor-toolbar {
        flex-wrap: wrap;
        gap: 6px 10px;
    }
    .cs-code-editor-toolbar-actions {
        width: 100%;
        margin-left: 0;
        justify-content: flex-end;
    }
}

/* ── Split editor (when block is GitHub-linked) ─────────────────────── */
.cs-gh-split {
    display: flex;
    flex-direction: column;
    background: #1e1f23;
}
.cs-gh-split-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(110, 84, 226, 0.12);
    border-bottom: 1px solid rgba(110, 84, 226, 0.25);
    color: #c9c5e2;
    font-size: 11px;
}
.cs-gh-split-header svg {
    flex-shrink: 0;
    color: #b4adda;
}
.cs-gh-split-url-input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: 1px solid transparent;
    color: #b4adda;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    padding: 3px 6px;
    border-radius: 3px;
    outline: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.cs-gh-split-url-input:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    color: #d8d4ec;
}
.cs-gh-split-url-input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(110, 84, 226, 0.6);
    color: #ffffff;
}
.cs-gh-split-url-open {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    color: #b4adda;
    border-radius: 3px;
    text-decoration: none !important;
}
.cs-gh-split-url-open:hover,
.cs-gh-split-url-open:focus {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.cs-gh-split-zone {
    padding: 8px 0 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.cs-gh-split-zone:last-child {
    border-bottom: none;
}
.cs-gh-split-label {
    padding: 0 12px 4px;
    color: #8b8da3;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.cs-gh-split textarea.cs-code-editor-textarea {
    border-radius: 0;
    border: none;
    background: transparent;
    color: #d0d0d0;
    padding: 4px 12px 8px;
    resize: vertical;
}
.cs-gh-split textarea.cs-gh-split-body {
    background: rgba(255, 255, 255, 0.025);
    color: #e8e8e8;
    cursor: not-allowed;
}
.cs-gh-split textarea.cs-gh-split-body:focus {
    outline: none;
}
.cs-gh-split-zone-body {
    background: rgba(255, 255, 255, 0.02);
}
