@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;700&display=swap');

:root {
    /* Color theme */
    --bg-color: #000;
    --header-bg: #121212;
    --text-color: #e0e0e0;
    --green: #00ae6b;
    --yellow: #ffc200;
    --red: #f2283c;
    --blue: #277dff;
    --purple: #875afb;
    --orange: #ff7a00;
    --pink: #d72e82;
    --border-color: #333;
    --muted-text: #888;
    --active-item: #1a3a5a;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: "Fira Code", monospace;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html,
body {
    font-size: 13px;
    height: 100%;
    overflow: hidden;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    height: 100%;
}

header {
    background-color: var(--header-bg);
    padding: 4px 8px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

h1 {
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.system-stats {
    display: flex;
    gap: 16px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-label {
    color: var(--muted-text);
}

.key-help {
    color: var(--blue);
    font-size: 0.8rem;
}

main {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.dashboard-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.vm-list {
    flex: 1;
    overflow-y: auto;
    border-right: 1px solid var(--border-color);
}

/* VM Row Structure: Column with header and inline editor */
.vm-row {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid rgba(51, 51, 51, 0.5);
    cursor: pointer;
}

/* Highlight the header of a selected row */
.vm-row.selected .vm-row-header {
    background-color: var(--active-item);
}

.vm-row-header {
    display: flex;
    align-items: center;
    padding: 4px 8px;
}

.vm-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--green);
    margin-right: 6px;
    flex-shrink: 0;
}

.vm-name {
    min-width: 100px;
    max-width: 150px;
    color: var(--yellow);
    white-space: nowrap;
    flex-shrink: 0;
    margin-right: 8px;
}

.vm-info {
    display: flex;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--muted-text);
    flex-shrink: 1;
}

.execution-bar-container {
    flex: 1;
    height: 10px;
    background-color: rgba(255, 255, 255, 0.05);
    margin: 0 4px;
    position: relative;
    border-radius: 2px;
    overflow: hidden;
}

.execution-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(to right, var(--green), var(--yellow), var(--red));
    transition: width 0.3s ease-out;
}

.execution-time {
    width: 60px;
    text-align: right;
    font-size: 0.8rem;
    min-width: 60px;
    flex-shrink: 0;
    margin-right: 8px;
}

.vm-actions {
    display: flex;
    gap: 6px;
    opacity: 0.7;
    margin-left: 4px;
    flex-shrink: 0;
}

.action-button {
    cursor: pointer;
    font-size: 0.8rem;
    padding: 2px 4px;
}

.action-button.delete {
    color: var(--red);
}

/* Memory Panel */
.memory-panel {
    width: 200px;
    min-width: 300px;
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 8px;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
}

.memory-panel h3 {
    color: var(--purple);
    font-size: 0.9rem;
    margin-bottom: 12px;
    text-align: center;
}

.memory-stats-section {
    margin-bottom: 24px;
}

.memory-stat {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.memory-stat-name {
    color: var(--muted-text);
}

/* Build Info */
.build-info-section {
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

.build-info-section h3 {
    color: var(--blue);
    font-size: 0.9rem;
    margin-bottom: 8px;
    text-align: center;
}

.build-info-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.75rem;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.build-info-name {
    color: var(--muted-text);
}

.build-info-value {
    color: var(--text-color);
    white-space: nowrap;
}

.build-features {
    margin-top: 8px;
    font-size: 0.75rem;
}

.feature-tag {
    display: inline-block;
    background-color: rgba(39, 125, 255, 0.2);
    color: var(--blue);
    padding: 2px 4px;
    border-radius: 3px;
    margin: 2px;
    font-size: 0.7rem;
}

/* Terminal Panel */
.terminal-panel {
    height: 250px;
    min-height: 150px;
    max-height: 40%;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.terminal-header {
    display: flex;
    justify-content: space-between;
    padding: 4px 8px;
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
}

.terminal-header-title {
    color: var(--orange);
    font-size: 0.85rem;
}

.terminal-stats {
    color: var(--muted-text);
    font-size: 0.8rem;
}

.terminal-history {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    font-size: 0.85rem;
    white-space: pre-wrap;
}

.execution {
    margin-bottom: 4px;
    padding-bottom: 4px;
    border-bottom: 1px dashed rgba(51, 51, 51, 0.7);
}

.execution-code {
    color: var(--blue);
    margin-bottom: 2px;
}

.execution-result {
    color: var(--green);
}

.execution-error {
    color: var(--red);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--header-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 16px;
    width: 300px;
}

.modal-header {
    margin-bottom: 16px;
    color: var(--text-color);
    font-size: 1rem;
}

.modal-body {
    margin-bottom: 16px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.modal-input {
    width: 100%;
    padding: 6px 8px;
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 3px;
    font-size: 0.9rem;
}

.modal-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.85rem;
}

.modal-btn-primary {
    background-color: var(--blue);
    color: white;
}

.modal-btn-cancel {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--muted-text);
}

/* High DPI */
@media (min-resolution: 2dppx) {

    input,
    button,
    .execution-bar-container {
        border-width: 0.5px;
    }
}

/* Responsive Small Screens */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 8px;
        padding: 8px;
    }

    .system-stats {
        width: 100%;
        justify-content: space-between;
    }

    .key-help {
        width: 100%;
        text-align: center;
        padding-top: 4px;
    }
}

.vm-editor-container {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
}

.vm-editor-container.open {
    max-height: 200px;
    opacity: 1;
    padding: 8px;
}

.vm-editor {
    width: 100%;
    resize: vertical;
    background-color: var(--header-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.85rem;
    padding: 4px 8px;
}