:root {
    /* Ultra Dark Premium Cyber Aesthetic */
    --bg-deep: #030508;
    --bg-panel: #0A0D15;
    --bg-glass: rgba(10, 13, 21, 0.6);
    --bg-input: #0F131D;

    --text-high: #FFFFFF;
    --text-med: #94A3B8;
    --text-low: #475569;

    --accent-brand: #0EA5E9;
    --accent-glow: 0 0 16px rgba(14, 165, 233, 0.4);

    --neon-green: #10B981;
    --neon-green-glow: 0 0 20px rgba(16, 185, 129, 0.3);

    --neon-red: #EF4444;

    --border-subtle: rgba(255, 255, 255, 0.05);
    --border-med: rgba(255, 255, 255, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-deep);
    color: var(--text-high);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Stop scrolling, make it app-like */
}

/* SVG Grid Background */
body::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background-image: linear-gradient(var(--border-subtle) 1px, transparent 1px), linear-gradient(90deg, var(--border-subtle) 1px, transparent 1px);
    background-size: 32px 32px;
    pointer-events: none;
    z-index: 0;
    mask-image: radial-gradient(circle at top center, black 10%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse at top center, black 20%, transparent 80%);
}

/* Header */
header {
    padding: 24px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    position: relative;
    z-index: 10;
}

.logo {
    font-family: 'Outfit';
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-high);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
}

.back-link {
    color: var(--text-med);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--text-high);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.app-container {
    display: grid;
    grid-template-columns: 450px 1fr;
    flex-grow: 1;
    position: relative;
    z-index: 10;
}

/* Left Panel - Configuration */
.panel-left {
    background: rgba(10, 13, 21, 0.95);
    border-right: 1px solid var(--border-med);
    padding: 40px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    height: calc(100vh - 86px);
}

.panel-left h1 {
    font-family: 'Outfit';
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-med);
    margin-bottom: 40px;
    font-size: 1.05rem;
}

.glass-card {
    background: var(--bg-input);
    border: 1px solid var(--border-med);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 10px 20px -10px rgba(0, 0, 0, 0.5);
    transition: border-color 0.3s;
}

.glass-card:focus-within {
    border-color: var(--accent-brand);
    box-shadow: var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.step-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    color: var(--accent-brand);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-med);
}

input,
select,
textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-med);
    color: var(--text-high);
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 0.95rem;
    transition: all 0.2s;
    font-family: 'JetBrains Mono', monospace;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(14, 165, 233, 0.5);
}

textarea {
    resize: vertical;
    min-height: 200px;
    color: #A3E635;
    /* String color for JSON body */
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 18px;
    border-radius: 16px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-primary {
    background: var(--text-high);
    color: var(--bg-deep);
    margin-top: 16px;
    font-family: 'Outfit';
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -10px rgba(255, 255, 255, 0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    transform: none;
    cursor: not-allowed;
    box-shadow: none;
}

/* Right Panel - Execution Terminal */
.panel-right {
    background: transparent;
    padding: 40px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.terminal-window {
    flex-grow: 1;
    background: rgba(5, 7, 10, 0.8);
    border: 1px solid var(--border-med);
    border-radius: 24px;
    backdrop-filter: blur(20px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02), 0 30px 60px -10px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.terminal-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mac-dots {
    display: flex;
    gap: 8px;
}

.mac-dots div {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    opacity: 0.3;
}

.terminal-body {
    padding: 32px;
    flex-grow: 1;
    overflow-y: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
}

#idleState {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-low);
}

.telemetry-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 40px;
}

.t-box {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 16px;
    position: relative;
}

.t-box label {
    font-family: 'Inter';
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-med);
    margin-bottom: 8px;
    display: block;
    border: none;
}

.t-val {
    color: var(--text-high);
    word-break: break-all;
    font-size: 0.85rem;
}

/* Execution State UI */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 700;
    font-family: 'Inter';
}

.status-ok {
    background: rgba(16, 185, 129, 0.1);
    color: var(--neon-green);
    border: 1px solid rgba(16, 185, 129, 0.2);
    box-shadow: var(--neon-green-glow);
}

.status-err {
    background: rgba(239, 68, 68, 0.1);
    color: var(--neon-red);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

pre {
    margin: 0;
    color: #CBD5E1;
    white-space: pre-wrap;
    font-family: 'JetBrains Mono', monospace;
}

/* syntax highlighting */
.sy-k {
    color: #38BDF8;
}

/* key */
.sy-s {
    color: #A3E635;
}

/* string */
.sy-n {
    color: #F472B6;
}

/* number/bool */

/* Responsive Improvements */
@media (max-width: 1024px) {
    body {
        overflow: auto;
        /* Allow scrolling on mobile */
    }

    header {
        padding: 16px 20px;
    }

    .logo {
        font-size: 1.1rem;
    }

    .app-container {
        display: flex;
        flex-direction: column;
    }

    .panel-left {
        width: 100%;
        height: auto;
        padding: 30px 20px;
        border-right: none;
        border-bottom: 1px solid var(--border-med);
    }

    .panel-left h1 {
        font-size: 2rem;
    }

    .panel-right {
        padding: 24px 16px;
        height: auto;
        min-height: 500px;
    }

    .terminal-window {
        height: 600px;
        /* Fixed height for terminal on mobile to ensure usability */
    }

    .telemetry-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .panel-left h1 {
        font-size: 1.6rem;
    }

    .subtitle {
        font-size: 0.95rem;
    }

    .btn {
        padding: 14px;
        font-size: 0.9rem;
    }
}