/* Base Font */
body {
    font-family: "Inter", system-ui, -apple-system, sans-serif;
}

/* Monospace Font */
.font-mono,
code,
pre,
.terminal {
    font-family: "Google Sans Code", monospace !important;
}

/* Window Styles */
.window {
    position: absolute;
    background: #ffffff;
    border: 1px solid #000000;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.window-titlebar {
    background: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    padding: 8px 14px;
    user-select: none;
    cursor: grab;
    display: flex;
    align-items: center;
    gap: 12px;
}

.window-titlebar:active {
    cursor: grabbing;
}

.window-controls {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.window-title {
    color: #000;
    font-size: 13px;
    font-family: "Inter", system-ui, -apple-system, sans-serif;
    font-weight: 600;
    flex: 1;
    margin: 0;
}

.window-content {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: #1e1e1e;
}

/* Editor Styles */
.editor-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #1e1e1e;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    background: #eee;
    border-bottom: 1px solid #222222;
    color: #e5e5e5;
    font-size: 12px;
}

.editor-toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.editor-run-btn,
.editor-save-btn,
.output-clear-btn {
    border: 1px solid rgba(0, 0, 0, .25);
    background: #ffffff;
    color: #000000;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: transform 0.2s ease, border-bottom-width 0.2s ease, background-color 0.2s ease;
    border-bottom-width: 1px;
}

.editor-run-btn:disabled,
.editor-save-btn:disabled,
.output-clear-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.editor-run-btn:hover,
.editor-save-btn:hover,
.output-clear-btn:hover {
    background: #f3f4f6;
}

.editor-run-btn:active,
.editor-save-btn:active,
.output-clear-btn:active {
    transform: none;
}

.editor-run-btn:disabled:hover,
.editor-save-btn:disabled:hover,
.output-clear-btn:disabled:hover,
.editor-run-btn:disabled:active,
.editor-save-btn:disabled:active,
.output-clear-btn:disabled:active {
    transform: none;
    background: #ffffff;
}

.editor-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    color: #9ca3af;
}

.editor-status::before,
.output-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: currentColor;
    flex-shrink: 0;
}

.editor-status.status-ready,
.output-status.status-ready {
    color: #16a34a;
}

.editor-status.status-running,
.output-status.status-running {
    color: #d97706;
}

.editor-status.status-not-ready,
.output-status.status-not-ready {
    color: #dc2626;
}

/* Worker Status Styles */
.worker-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
}

.worker-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: currentColor;
    flex-shrink: 0;
}

.worker-status.status-ready {
    color: #16a34a;
    /* green-600 */
}

.worker-status.status-initializing {
    color: #d97706;
    /* amber-600 */
}

.worker-status.status-loading {
    color: #d97706;
    /* amber-600 */
}

.worker-status.status-error {
    color: #dc2626;
    /* red-600 */
}

.worker-status.status-not-initialized {
    color: #9ca3af;
    /* gray-400 */
}

.editor-host {
    flex: 1;
    min-height: 0;
}

.window-content .ace_editor {
    font-family: "Google Sans Code", monospace !important;
    font-size: 13px;
}

/* Output Styles */
.output-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #0f0f0f;
    color: #e5e5e5;
}

.output-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    background: #eee;
    border-bottom: 1px solid #222222;
    font-size: 12px;
}

.output-toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.output-title {
    font-weight: 600;
    color: #222;
}

.output-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    color: #9ca3af;
}

.output-log {
    flex: 1;
    overflow: auto;
    padding: 10px;
    font-family: "Google Sans Code", monospace;
    font-size: 12px;
    white-space: pre-wrap;
}

.output-line {
    margin-bottom: 6px;
}

.output-stderr,
.output-exception {
    color: #fca5a5;
}

.output-exit {
    color: #9ca3af;
}

.output-chunk {
    white-space: pre-wrap;
}

/* Resize Handles */
.resize-handle {
    position: absolute;
    background: transparent;
}

.resize-handle-e {
    right: 0;
    top: 0;
    width: 6px;
    height: 100%;
    cursor: ew-resize;
}

.resize-handle-s {
    bottom: 0;
    left: 0;
    width: 100%;
    height: 6px;
    cursor: ns-resize;
}

.resize-handle-se {
    right: 0;
    bottom: 0;
    width: 12px;
    height: 12px;
    cursor: nwse-resize;
}

/* Terminal Styles */
.window-content .terminal {
    height: 100%;
    --size: 1.1;
    --color: rgba(255, 255, 255, 0.8);
    cursor: text;
}

.window-content .terminal .terminal-output {
    /* padding: 8px; */
    cursor: text;
}

/* Loading Spinner */
.terminal-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #ccc;
    font-size: 14px;
}

.terminal-loading .spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(172, 237, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 12px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}