:root {
    --bg-app: #121212;
    --bg-panel: #1e1e1e;
    --bg-header: #252526;
    --bg-input: #2d2d2d;
    --bg-hover: #2a2d3e;

    --border-color: #333333;
    --border-focus: #e535ab;

    --text-primary: #e0e0e0;
    --text-secondary: #9e9e9e;

    --brand-pink: #e535ab;
    --brand-pink-hover: #c22d91;
    --brand-pink-alpha: rgba(229, 53, 171, 0.1);

    --code-key: #9cdcfe;
    --code-string: #ce9178;
    --code-number: #b5cea8;
    --code-boolean: #569cd6;

    --font-ui: 'Inter', system-ui, sans-serif;
    --font-mono: 'Fira Code', 'JetBrains Mono', monospace;
}

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

body {
    font-family: var(--font-ui);
    background-color: var(--bg-app);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

/* Layout */
.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
    padding: 0 1.5rem;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--brand-pink);
}

.brand h1 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.endpoint-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 400px;
}

#endpoint-url {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}

#endpoint-url:focus {
    border-color: var(--border-focus);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    font-family: var(--font-ui);
    transition: all 0.2s;
}

.btn-primary {
    background: var(--brand-pink);
    color: white;
}

.btn-primary:hover {
    background: var(--brand-pink-hover);
}

.btn-outline {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem;
}

.btn-outline:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

/* Workspace Panels */
.workspace {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.panel {
    display: flex;
    flex-direction: column;
    background: var(--bg-panel);
    border-right: 1px solid var(--border-color);
}

.schema-panel {
    width: 300px;
    flex-shrink: 0;
}

.editor-panel {
    flex: 1;
    min-width: 400px;
    display: flex;
    flex-direction: column;
}

.response-panel {
    width: 35%;
    flex-shrink: 0;
    border-right: none;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
}

.panel-header h2 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    font-weight: 600;
}

.action-header {
    padding: 0.5rem 1rem;
}

.badge {
    font-size: 0.7rem;
    background: var(--bg-input);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    color: var(--text-secondary);
}

.badge.success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.badge.error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.time-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.panel-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.scrollable {
    overflow-y: auto;
    padding: 1rem;
}

/* Editor Specific */
.editor-section {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid var(--border-color);
}

.flex-fill {
    flex: 1;
}

.variables-section {
    height: 30%;
    border-bottom: none;
}

.code-editor {
    flex: 1;
    background: var(--bg-app);
    color: #d4d4d4;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.5;
    padding: 1rem;
    border: none;
    resize: none;
    outline: none;
}

/* JSON Viewer */
.json-viewer {
    flex: 1;
    background: var(--bg-app);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.5;
    padding: 1rem;
    margin: 0;
    overflow: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.json-viewer .key {
    color: var(--code-key);
}

.json-viewer .string {
    color: var(--code-string);
}

.json-viewer .number {
    color: var(--code-number);
}

.json-viewer .boolean {
    color: var(--code-boolean);
}

.json-viewer .null {
    color: var(--text-secondary);
}

/* Schema Explorer Tree */
.schema-tree ul {
    list-style: none;
    padding-left: 1rem;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    margin-left: 0.5rem;
}

.schema-tree>ul {
    padding-left: 0;
    border-left: none;
    margin-left: 0;
}

.tree-node {
    margin: 2px 0;
}

.tree-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.tree-item:hover {
    background: var(--bg-hover);
}

.tree-item .expander {
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: transform 0.2s;
}

.tree-node.expanded>.tree-item .expander {
    transform: rotate(90deg);
}

.tree-item .checkbox {
    width: 14px;
    height: 14px;
    border: 1px solid var(--text-secondary);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tree-item .checkbox.checked {
    background: var(--brand-pink);
    border-color: var(--brand-pink);
}

.tree-item .checkbox.checked::after {
    content: '';
    width: 8px;
    height: 8px;
    background: white;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

.tree-item .field-name {
    color: #9cdcfe;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.tree-item .field-type {
    color: #4ec9b0;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    margin-left: auto;
}

.tree-children {
    display: none;
}

.tree-node.expanded>.tree-children {
    display: block;
}