/* ── Editor styles ─────────────────────────────────────────────────────── */

.pyvis-editor-wrap {
    border: 2px solid #3b82f6;
    border-radius: 10px;
    overflow: hidden;
    font-family: monospace;
}

.pyvis-editor-header {
    background: #1e40af;
    color: #fff;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.pyvis-editor-snake { font-size: 16px; }

.pyvis-editor-body { background: #0f172a; }

.pyvis-editor-textarea {
    font-family: 'Courier New', Courier, monospace !important;
    font-size: 13px !important;
    line-height: 1.65 !important;
    min-height: 160px !important;
    background: #0f172a !important;
    color: #e2e8f0 !important;
    padding: 12px 16px !important;
    border: none !important;
    outline: none !important;
    width: 100% !important;
    box-sizing: border-box !important;
    resize: vertical !important;
    tab-size: 4 !important;
}

.pyvis-editor-footer {
    background: #172554;
    color: #93c5fd;
    font-size: 11px;
    padding: 5px 14px;
}

/* ── Frontend container ─────────────────────────────────────────────────── */

.pyvis-wrap { margin: 28px 0; }

.pyvis-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* ── Toolbar ────────────────────────────────────────────────────────────── */

.pyvis-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: #0f172a;
    border-bottom: 1px solid #1e293b;
}

.pyvis-title {
    color: #94a3b8;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.4px;
}

.pyvis-run-btn {
    background: #22c55e;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 18px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}
.pyvis-run-btn:hover  { background: #16a34a; }
.pyvis-run-btn:active { transform: scale(0.97); }
.pyvis-run-btn:disabled { background: #475569; cursor: not-allowed; }

/* ── Body: code + state ─────────────────────────────────────────────────── */

.pyvis-body {
    display: flex;
    min-height: 220px;
}

/* Code panel */
.pyvis-code-panel {
    flex: 0 0 56%;
    background: #1e1e2e;
    border-right: 1px solid #2d3748;
    display: flex;
    flex-direction: column;
}

.pyvis-panel-header {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 5px 14px;
    background: #0f172a;
    color: #475569;
    flex-shrink: 0;
}

.pyvis-code-lines {
    overflow-y: auto;
    max-height: 340px;
    padding: 8px 0;
}

.pyvis-line {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 2px 14px;
    transition: background 0.12s;
    cursor: default;
}

.pyvis-line-active {
    background: #1d4ed8 !important;
}

.pyvis-lnum {
    flex-shrink: 0;
    min-width: 22px;
    text-align: right;
    font-size: 11px;
    font-family: monospace;
    color: #334155;
    user-select: none;
}

.pyvis-ltext {
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    color: #cdd6f4;
    white-space: pre;
    tab-size: 4;
}

.pyvis-line-active .pyvis-lnum  { color: #93c5fd; }
.pyvis-line-active .pyvis-ltext { color: #fff; }

/* State panel */
.pyvis-state-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    min-width: 0;
}

.pyvis-vars-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid #e2e8f0;
    overflow: hidden;
}

.pyvis-vars-body {
    padding: 10px 14px;
    font-size: 13px;
    overflow-y: auto;
    flex: 1;
}

.pyvis-output-section {
    flex-shrink: 0;
}

.pyvis-output-body {
    margin: 0;
    padding: 8px 14px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    white-space: pre-wrap;
    color: #1e293b;
    min-height: 36px;
    max-height: 80px;
    overflow-y: auto;
    background: #f1f5f9;
}

/* Variables table */
.pyvis-vars-table {
    width: 100%;
    border-collapse: collapse;
}

.pyvis-vars-table tr + tr td {
    border-top: 1px solid #e2e8f0;
}

.pyvis-vname {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: 700;
    color: #6366f1;
    padding: 5px 10px 5px 0;
    white-space: nowrap;
    vertical-align: top;
}

.pyvis-vval {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #0f172a;
    padding: 5px 0;
    word-break: break-all;
    vertical-align: top;
}

.pyvis-hint {
    color: #94a3b8;
    font-style: italic;
    font-size: 12px;
}

/* ── Controls ───────────────────────────────────────────────────────────── */

.pyvis-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #f1f5f9;
    border-top: 1px solid #e2e8f0;
}

.pyvis-hidden { display: none !important; }

.pyvis-prev-btn,
.pyvis-next-btn,
.pyvis-reset-btn {
    border: none;
    border-radius: 6px;
    padding: 5px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.pyvis-prev-btn,
.pyvis-next-btn {
    background: #3b82f6;
    color: #fff;
}
.pyvis-prev-btn:hover, .pyvis-next-btn:hover { background: #2563eb; }
.pyvis-prev-btn:disabled, .pyvis-next-btn:disabled {
    background: #cbd5e1;
    color: #94a3b8;
    cursor: not-allowed;
}

.pyvis-reset-btn {
    background: #e2e8f0;
    color: #475569;
    margin-left: auto;
}
.pyvis-reset-btn:hover { background: #cbd5e1; }

.pyvis-step-info {
    flex: 1;
    text-align: center;
    font-size: 13px;
    color: #64748b;
    font-weight: 600;
}

/* ── Status bar ─────────────────────────────────────────────────────────── */

.pyvis-status {
    min-height: 26px;
    padding: 4px 16px;
    font-size: 12px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    color: #64748b;
}

.pyvis-error {
    color: #dc2626;
    font-family: monospace;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .pyvis-body       { flex-direction: column; }
    .pyvis-code-panel { flex: none; border-right: none; border-bottom: 1px solid #2d3748; }
    .pyvis-code-lines { max-height: 200px; }
}
