﻿:root {
    --sat: env(safe-area-inset-top);
    --sar: env(safe-area-inset-right);
    --sab: env(safe-area-inset-bottom);
    --sal: env(safe-area-inset-left);
    --sandbox-host-bar-height: 56px;
    --sandbox-bg: #eef2f6;
    --sandbox-panel-muted: #d9dee5;
    --sandbox-border: #d3d9e2;
    --sandbox-text: #111827;
    --sandbox-muted: #64748b;
    --sandbox-blue: #2563eb;
    --sandbox-green: #16a34a;
    --sandbox-red: #dc2626;
    --sandbox-launch-bg: #1b2028;
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #111827;
    color: #e5e7eb;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#sandbox-root {
    width: 100%;
    height: 100%;
}

#sandbox-host-bar {
    position: relative;
    z-index: 2147483647;
    box-sizing: border-box;
    height: var(--sandbox-host-bar-height);
    padding: 0 18px;
    padding-top: var(--sat);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    background: #151922;
    border-bottom: 1px solid #2a3342;
    color: #f8fafc;
    pointer-events: auto;
}

.sandbox-host-focused .sandbox-host-title span {
    display: none;
}

.sandbox-host-title {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.sandbox-host-title img {
    width: 25px;
    height: auto;
    display: block;
    flex: 0 0 auto;
}

.sandbox-host-title strong {
    font-size: 15px;
    font-weight: 700;
}

.sandbox-host-title span {
    overflow: hidden;
    text-overflow: ellipsis;
    color: #aab4c5;
    font-size: 13px;
}

.sandbox-host-actions {
    position: absolute;
    left: 50%;
    top: calc(50% + (var(--sat) / 2));
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.sandbox-user-menu {
    margin-left: auto;
    min-width: 0;
    max-width: min(24vw, 280px);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.sandbox-user-menu span {
    min-width: 0;
    overflow: hidden;
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sandbox-host-actions[hidden] {
    display: none;
}

#sandbox-instance-id {
    box-sizing: border-box;
    min-width: 0;
    max-width: min(34vw, 520px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #93c5fd;
    font-size: 13px;
    font-weight: 700;
    text-align: left;
}

#sandbox-instance-id[hidden] {
    display: none;
}

.sandbox-icon-button {
    position: relative;
    z-index: 1;
    appearance: none;
    display: inline-grid;
    place-items: center;
    border: 1px solid #344256;
    border-radius: 6px;
    background: #202938;
    color: white;
    height: 34px;
    width: 38px;
    padding: 0;
    cursor: pointer;
}

.sandbox-icon-button:hover {
    background: #2a3547;
    border-color: #475569;
}

.sandbox-icon-button:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}

.sandbox-icon-button:disabled {
    opacity: 0.45;
    cursor: default;
}

.sandbox-icon-button svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2.25;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.sandbox-icon-button-green {
    border-color: #22c55e;
    background: #16a34a;
}

.sandbox-icon-button-green:hover {
    background: #15803d;
    border-color: #4ade80;
}

.sandbox-icon-button-red {
    border-color: #ef4444;
    background: #dc2626;
}

.sandbox-icon-button-red:hover {
    background: #b91c1c;
    border-color: #f87171;
}

.sandbox-icon-button-primary {
    border-color: #2563eb;
    background: #2563eb;
    color: white;
}

.sandbox-icon-button-primary:hover {
    border-color: #60a5fa;
    background: #1d4ed8;
}

.sandbox-host-screen {
    position: relative;
    z-index: 1;
    box-sizing: border-box;
    width: 100%;
    height: calc(100vh - var(--sandbox-host-bar-height) - var(--sat));
    overflow: auto;
    background: var(--sandbox-bg);
    color: var(--sandbox-text);
}

.sandbox-host-screen[hidden] {
    display: none;
}

#sandbox-host-placeholder {
    background: var(--sandbox-launch-bg);
    color: #f8fafc;
}

.sandbox-placeholder-panel {
    min-height: 100%;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 12px;
    text-align: center;
    padding: 40px 20px;
    box-sizing: border-box;
}

.sandbox-placeholder-mark {
    color: rgba(255, 255, 255, 0.42);
    font-size: 76px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: 0;
    text-shadow: 0 1px 16px rgba(15, 23, 42, 0.18);
}

.sandbox-placeholder-panel h1,
.sandbox-overview-header h1 {
    margin: 0;
    font-size: 24px;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: 0;
}

.sandbox-placeholder-panel p,
.sandbox-overview-header p {
    margin: 0;
    color: var(--sandbox-muted);
    font-size: 14px;
}

.sandbox-placeholder-panel p {
    color: #aab4c5;
}

#sandbox-overview {
    padding: 24px 28px;
}

.sandbox-overview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.sandbox-overview-header .sandbox-icon-button {
    background: #ffffff;
    color: #334155;
    border-color: var(--sandbox-border);
}

.sandbox-overview-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.sandbox-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
}

.sandbox-vm-card {
    position: relative;
    min-width: 0;
    appearance: none;
    border: 0;
    background: transparent;
    color: inherit;
    padding: 0;
    text-align: left;
    cursor: pointer;
}

.sandbox-vm-card-in-use {
    cursor: not-allowed;
}

.sandbox-vm-card:focus-visible {
    outline: 2px solid var(--sandbox-blue);
    outline-offset: 4px;
    border-radius: 8px;
}

.sandbox-vm-preview {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 7px;
    overflow: hidden;
    background:
        radial-gradient(circle at 22% 24%, rgba(20, 184, 166, 0.72), transparent 28%),
        radial-gradient(circle at 76% 34%, rgba(37, 99, 235, 0.55), transparent 32%),
        radial-gradient(circle at 88% 70%, rgba(190, 24, 93, 0.58), transparent 38%),
        #1f2937;
    border: 1px solid #c5ced9;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.sandbox-vm-card-stopped .sandbox-vm-preview {
    background: var(--sandbox-panel-muted);
}

.sandbox-vm-card-in-use .sandbox-vm-preview {
    filter: saturate(0.78);
}

.sandbox-vm-card-in-use .sandbox-vm-preview::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.44);
}

.sandbox-vm-preview::before {
    content: "";
    position: absolute;
    inset: 20% 26%;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.72);
}

.sandbox-vm-card-stopped .sandbox-vm-preview::before {
    content: "X1";
    inset: auto;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: transparent;
    color: rgba(255, 255, 255, 0.64);
    font-size: 42px;
    font-weight: 800;
    letter-spacing: 0;
}

.sandbox-vm-status {
    position: absolute;
    left: 10px;
    top: 10px;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: var(--sandbox-green);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85);
}

.sandbox-vm-card-stopped .sandbox-vm-status {
    background: #94a3b8;
}

.sandbox-vm-card-in-use .sandbox-vm-status {
    background: var(--sandbox-red);
}

.sandbox-vm-badge {
    position: absolute;
    z-index: 2;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 74px;
    height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.88);
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.24);
}

.sandbox-vm-remove,
.sandbox-vm-edit {
    position: absolute;
    z-index: 3;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #334155;
    cursor: pointer;
}

.sandbox-vm-remove {
    right: 8px;
    top: 8px;
}

.sandbox-vm-edit {
    right: 8px;
    bottom: 8px;
}

.sandbox-remove-flyout {
    position: fixed;
    z-index: 2147483647;
    box-sizing: border-box;
    width: 210px;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 18px 38px rgba(15, 23, 42, 0.22);
}

.sandbox-remove-flyout::before {
    content: "";
    position: absolute;
    right: 16px;
    top: -6px;
    width: 10px;
    height: 10px;
    transform: rotate(45deg);
    border-left: 1px solid #cbd5e1;
    border-top: 1px solid #cbd5e1;
    background: #ffffff;
}

.sandbox-remove-flyout p {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
}

.sandbox-remove-flyout span {
    display: block;
    min-width: 0;
    margin-top: 4px;
    overflow: hidden;
    color: var(--sandbox-muted);
    font-size: 12px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sandbox-remove-flyout-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

.sandbox-remove-flyout-actions button {
    appearance: none;
    min-width: 68px;
    height: 30px;
    padding: 0 10px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.sandbox-remove-flyout-actions button:focus-visible,
.sandbox-display-name-actions button:focus-visible,
.sandbox-display-name-panel input:focus-visible {
    outline: 2px solid var(--sandbox-blue);
    outline-offset: 2px;
}

.sandbox-remove-flyout-confirm {
    border-color: var(--sandbox-red) !important;
    background: var(--sandbox-red) !important;
    color: #ffffff !important;
}

.sandbox-vm-remove:hover {
    background: #fee2e2;
    color: var(--sandbox-red);
}

.sandbox-vm-edit:hover {
    background: #dbeafe;
    color: var(--sandbox-blue);
}

.sandbox-vm-remove svg,
.sandbox-vm-edit svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.sandbox-vm-title {
    margin-top: 8px;
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sandbox-display-name-modal {
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    display: grid;
    place-items: center;
    padding: 24px;
    box-sizing: border-box;
    background: rgba(15, 23, 42, 0.38);
}

.sandbox-display-name-panel {
    box-sizing: border-box;
    width: min(420px, 100%);
    padding: 22px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
}

.sandbox-display-name-panel h2 {
    margin: 0;
    font-size: 20px;
    line-height: 1.25;
    font-weight: 800;
}

.sandbox-display-name-panel p {
    margin: 6px 0 16px;
    overflow: hidden;
    color: var(--sandbox-muted);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sandbox-display-name-panel input {
    box-sizing: border-box;
    width: 100%;
    height: 40px;
    padding: 0 11px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #ffffff;
    color: #0f172a;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
}

.sandbox-display-name-panel input::placeholder {
    color: #94a3b8;
}

.sandbox-display-name-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 18px;
}

.sandbox-display-name-actions button {
    appearance: none;
    min-width: 72px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #ffffff;
    color: #334155;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.sandbox-display-name-clear {
    margin-right: auto;
}

.sandbox-display-name-save {
    border-color: var(--sandbox-blue) !important;
    background: var(--sandbox-blue) !important;
    color: #ffffff !important;
}

.sandbox-vm-subtitle {
    margin-top: 2px;
    font-size: 12px;
    color: var(--sandbox-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sandbox-overview-empty {
    margin: 40px 0 0;
    color: var(--sandbox-muted);
    font-size: 14px;
}

.sandbox-auth-screen {
    box-sizing: border-box;
    width: 100%;
    min-height: 100%;
    display: grid;
    place-items: center;
    padding: max(28px, var(--sat)) max(18px, var(--sar)) max(28px, var(--sab)) max(18px, var(--sal));
    background:
        linear-gradient(135deg, rgba(18, 24, 33, 0.94), rgba(11, 15, 23, 0.98)),
        radial-gradient(circle at 22% 18%, rgba(37, 99, 235, 0.22), transparent 34%),
        #111827;
    color: #f8fafc;
}

.sandbox-auth-panel {
    box-sizing: border-box;
    width: min(460px, 100%);
    padding: 34px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.78);
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.34);
}

.sandbox-auth-panel-compact {
    text-align: center;
}

.sandbox-auth-mark {
    width: 42px;
    height: 42px;
    display: block;
    margin-bottom: 22px;
}

.sandbox-auth-panel-compact .sandbox-auth-mark {
    margin-inline: auto;
}

.sandbox-auth-eyebrow {
    margin: 0 0 8px;
    color: #93c5fd;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.sandbox-auth-panel h1 {
    margin: 0;
    max-width: 12ch;
    color: #ffffff;
    font-size: 30px;
    line-height: 1.08;
    font-weight: 850;
    letter-spacing: 0;
}

.sandbox-auth-panel-compact h1 {
    max-width: none;
}

.sandbox-auth-copy {
    margin: 14px 0 0;
    color: #cbd5e1;
    font-size: 14px;
    line-height: 1.55;
}

.sandbox-auth-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.sandbox-auth-primary,
.sandbox-auth-secondary {
    appearance: none;
    box-sizing: border-box;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    padding: 0 15px;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.sandbox-auth-primary {
    border: 1px solid #60a5fa;
    background: #2563eb;
    color: #ffffff;
}

.sandbox-auth-primary:hover {
    background: #1d4ed8;
}

.sandbox-auth-secondary {
    border: 1px solid rgba(148, 163, 184, 0.34);
    background: transparent;
    color: #dbeafe;
}

.sandbox-auth-secondary:hover {
    border-color: rgba(191, 219, 254, 0.58);
    color: #ffffff;
}

.sandbox-auth-note {
    margin: 18px 0 0;
    color: #94a3b8;
    font-size: 12px;
}

#out {
    position: relative;
    z-index: 1;
    width: 100%;
    height: calc(100vh - var(--sandbox-host-bar-height) - var(--sat));
    overflow: hidden;
    background: var(--sandbox-launch-bg);
}

#out[hidden] {
    display: none;
}

@media (max-width: 760px) {
    #sandbox-host-bar {
        height: 72px;
        align-items: flex-start;
        flex-direction: column;
        justify-content: center;
        padding: 8px 12px;
        padding-top: calc(8px + var(--sat));
    }

    .sandbox-host-title,
    .sandbox-host-actions {
        width: 100%;
        justify-content: space-between;
    }

    .sandbox-host-actions {
        position: static;
        transform: none;
        order: 3;
    }

    .sandbox-host-title span {
        display: none;
    }

    .sandbox-user-menu {
        position: absolute;
        right: 12px;
        top: calc(8px + var(--sat));
        max-width: 38vw;
    }

    .sandbox-user-menu span {
        display: none;
    }

    #sandbox-instance-id {
        max-width: none;
        order: 2;
        width: 100%;
        text-align: left;
    }

    #out {
        height: calc(100vh - 72px - var(--sat));
    }

    .sandbox-host-screen {
        height: calc(100vh - 72px - var(--sat));
    }

    #sandbox-overview {
        padding: 16px 14px;
    }

    .sandbox-overview-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 14px;
    }

    .sandbox-auth-panel {
        padding: 26px;
    }

    .sandbox-auth-panel h1 {
        font-size: 26px;
    }
}

/* HTML styles for the splash screen */

.center {
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
    align-items: center;
    height: 100%;
}

#avalonia-splash {
    position: relative;
    height: 100%;
    width: 100%;
    color: #e5e7eb;
    background: var(--sandbox-launch-bg);
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    justify-content: center;
    align-items: center;
}

.x1-splash-title {
    margin: 0;
    color: rgba(255, 255, 255, 0.72);
    font-size: 76px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: 0;
}

.x1-splash-subtitle {
    margin: 0;
    color: #aab4c5;
    font-size: 14px;
}

.x1-splash-progress {
    position: relative;
    width: min(220px, 42vw);
    height: 5px;
    margin-top: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.22);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.x1-splash-progress > div {
    position: absolute;
    inset: 0 auto 0 0;
    width: 42%;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(229, 231, 235, 0.62), rgba(255, 255, 255, 0.92));
    animation: x1-splash-progress 1.45s ease-in-out infinite;
}

.splash-close {
    animation: fadeout 0.25s linear forwards;
}

@keyframes x1-splash-progress {
    0% {
        transform: translateX(-115%);
    }

    52% {
        transform: translateX(88%);
    }

    100% {
        transform: translateX(250%);
    }
}

@keyframes fadeout {
    0% {
        opacity: 100%;
    }

    100% {
        opacity: 0;
        visibility: collapse;
    }
}
