:root {
    --primary: #E84393;
    --primary-hover: #D63080;
    --secondary: #FD79A8;
    --accent: #00CEC9;
    --bg: #1A0A14;
    --bg-panel: #26111E;
    --bg-panel-hover: #311828;
    --text-main: #F8FAFC;
    --text-muted: #F3A0C8;
    /* Soft pink-tinted text */
    --border: #4D213F;
    --radius: 12px;
    --transition: 0.2s ease;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: rgba(38, 17, 30, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--primary);
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-main);
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* Buttons */
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-family: inherit;
}

.w-full {
    width: 100%;
}

.mt-4 {
    margin-top: 16px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #D63080);
    color: white;
    box-shadow: 0 4px 15px rgba(232, 67, 147, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(232, 67, 147, 0.4);
}

.btn-secondary {
    background-color: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: rgba(253, 121, 168, 0.1);
    border-color: var(--secondary);
}

.btn-text {
    background: none;
    color: var(--accent);
    padding: 4px 8px;
}

.btn-text:hover {
    background: rgba(0, 206, 201, 0.1);
}

.btn-small {
    padding: 6px 10px;
    font-size: 0.8rem;
    border-radius: 6px;
}

/* Workspace */
.workspace {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1.5fr;
    gap: 1px;
    /* Borders via background */
    background: var(--border);
    flex: 1;
    overflow: hidden;
}

.panel {
    background: var(--bg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

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

.panel-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: relative;
    padding: 20px;
}

/* Schema Input */
#schemaInput {
    flex: 1;
    width: 100%;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    color: var(--text-main);
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    resize: none;
    outline: none;
    transition: var(--transition);
}

#schemaInput:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(232, 67, 147, 0.2);
}

.parse-action {
    margin-top: 16px;
}

.error-msg {
    color: #ff7675;
    font-size: 0.85rem;
    margin-top: 12px;
    display: none;
}

/* Builder Tree */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    gap: 16px;
    text-align: center;
}

.hidden {
    display: none !important;
}

.badge {
    background: rgba(232, 67, 147, 0.15);
    color: var(--secondary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.tree-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tree-node {
    margin-left: 20px;
    position: relative;
}

.tree-node::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--border);
}

.node-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.node-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.node-item input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.node-name {
    font-size: 0.9rem;
    font-family: 'Fira Code', monospace;
}

.node-type {
    font-size: 0.75rem;
    color: var(--accent);
    margin-left: auto;
}

.expand-icon {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.expand-icon.open {
    transform: rotate(90deg);
}

.children-container {
    display: none;
}

.children-container.open {
    display: block;
}

/* Output Panel */
.code-editor {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    color: var(--accent);
    overflow-x: auto;
    min-height: 200px;
    flex: 1;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.variables-section h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.variables-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.var-item {
    display: flex;
    gap: 8px;
    background: rgba(0, 0, 0, 0.2);
    padding: 8px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.var-item input {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 6px 10px;
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    flex: 1;
}

.var-item input:focus {
    outline: none;
    border-color: var(--primary);
}

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

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

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

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