:root {
  --background: #0f172a;
  --foreground: #f8fafc;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --border: rgba(255, 255, 255, 0.1);
  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(255, 255, 255, 0.1);
  --danger: #ef4444;
}

* { box-sizing: border-box; }

body {
  background-color: var(--background);
  color: var(--foreground);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0; padding: 0; min-height: 100vh;
}

.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.btn {
  background: var(--primary);
  color: white; border: none; padding: 0.5rem 1rem;
  border-radius: 6px; cursor: pointer; transition: background 0.2s;
  font-weight: 500; display: inline-block;
}
.btn:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.75rem; }

.input-field {
  width: 100%; padding: 0.75rem; border-radius: 6px;
  border: 1px solid var(--border); background: rgba(15, 23, 42, 0.8);
  color: var(--foreground); margin-bottom: 1rem;
}
.input-field:focus { outline: 2px solid var(--primary); border-color: transparent; }
textarea.input-field { min-height: 100px; resize: vertical; }

/* Layouts */
.login-container { display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 1rem; }
.login-box { padding: 2rem; border-radius: 16px; width: 100%; max-width: 400px; text-align: center; }
.login-box button { width: 100%; margin-top: 1rem; }

.dashboard-container { display: flex; min-height: 100vh; }
.sidebar { width: 250px; padding: 1.5rem; border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.sidebar h2 { margin-top: 0; margin-bottom: 2rem; font-size: 1.25rem; }
.sidebar ul { list-style: none; padding: 0; margin: 0; }
.sidebar li { margin-bottom: 0.5rem; }
.sidebar button.doc-btn { width: 100%; text-align: left; padding: 0.75rem 1rem; background: transparent; border: none; color: var(--foreground); cursor: pointer; border-radius: 4px; transition: all 0.2s; }
.sidebar button.doc-btn:hover { background: rgba(255,255,255,0.05); }
.sidebar button.doc-btn.active { background: rgba(59, 130, 246, 0.2); border-left: 3px solid var(--primary); }

.main-content { flex: 1; padding: 2rem; overflow-y: auto; height: 100vh; display: flex; flex-direction: column; }
.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.header h1 { margin: 0; font-size: 2rem; text-transform: capitalize; }

.editor-controls { display: flex; gap: 0.5rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border); padding-bottom: 1rem; }
.editor-controls button { background: transparent; border: 1px solid var(--border); color: white; padding: 0.5rem 1rem; border-radius: 6px; cursor: pointer; }
.editor-controls button.active { background: var(--primary); border-color: var(--primary); }

.editor-area { flex: 1; border-radius: 12px; padding: 1.5rem; display: flex; flex-direction: column; }
#json-editor { flex: 1; min-height: 400px; font-family: monospace; font-size: 14px; background: rgba(0,0,0,0.5); color: #e2e8f0; }

.empty-state { flex: 1; border-radius: 12px; display: flex; flex-direction: column; justify-content: center; align-items: center; color: #94a3b8; text-align: center; padding: 3rem; }
.empty-state i { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }

.toast { position: fixed; bottom: 20px; right: 20px; background: rgba(74, 222, 128, 0.9); color: #064e3b; padding: 1rem 1.5rem; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); transform: translateY(100px); opacity: 0; transition: all 0.3s; z-index: 1000; }
.toast.show { transform: translateY(0); opacity: 1; }

/* Dynamic Form UI */
#form-editor { display: none; flex-direction: column; gap: 1rem; }
.object-wrap { width: 100%; }
.field-wrap { margin-bottom: 1rem; }
.field-wrap > label { display: block; font-size: 0.875rem; margin-bottom: 0.4rem; color: #94a3b8; text-transform: capitalize; }
.field-wrap > h4 { margin: 0 0 1rem 0; color: var(--primary); text-transform: capitalize; }

.array-wrap { margin-left: 1rem; border-left: 2px solid var(--primary); padding-left: 1rem; margin-bottom: 1.5rem; background: rgba(0,0,0,0.1); padding: 1rem; border-radius: 0 8px 8px 0; }
.array-item { margin-bottom: 1.5rem; background: rgba(0,0,0,0.25); padding: 1.5rem; border-radius: 8px; border: 1px solid var(--border); }
.array-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
.array-header strong { color: #cbd5e1; }
.add-btn { background: rgba(59, 130, 246, 0.2); color: #60a5fa; border: 1px dashed #60a5fa; width: 100%; }
