:root {
  --bg-color: #0A1A14;
  --surface-color: #0F2922;
  --surface-hover: #14352E;
  --primary-color: #00B894;
  --secondary-color: #55EFC4;
  --accent-color: #E17055;
  --text-color: #ECF0F1;
  --border-color: #2D3436;
  --input-bg: #07120E;
  --border-radius: 8px;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

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

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

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

.app-header h1 {
  font-size: 1.25rem;
  color: var(--primary-color);
}

.main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar Controls */
.sidebar {
  width: 320px;
  background-color: var(--surface-color);
  border-right: 1px solid var(--border-color);
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.control-group h2 {
  font-size: 0.9rem;
  text-transform: uppercase;
  color: var(--secondary-color);
  margin-bottom: 1rem;
  letter-spacing: 1px;
}

.control-row {
  margin-bottom: 0.75rem;
}

.control-row label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
  color: #B2BEC3;
}

.dynamic-inputs {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.input-group {
  display: flex;
  gap: 0.5rem;
}

input[type="text"], input[type="number"] {
  background-color: var(--input-bg);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  padding: 0.5rem;
  border-radius: 4px;
  width: 100%;
  font-family: monospace;
}

input[type="text"]:focus, input[type="number"]:focus {
  outline: none;
  border-color: var(--primary-color);
}

button.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-primary {
  background-color: var(--primary-color);
  color: #000;
}

.btn-primary:hover {
  opacity: 0.9;
}

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

.btn-secondary:hover {
  background-color: rgba(0, 184, 148, 0.1);
}

.btn-danger {
  background-color: transparent;
  border: 1px solid var(--accent-color);
  color: var(--accent-color);
}

.btn-danger:hover {
  background-color: rgba(225, 112, 85, 0.1);
}

.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
}

.btn-remove {
  background: none;
  border: none;
  color: var(--accent-color);
  cursor: pointer;
  padding: 0 0.5rem;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
}

.items-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
}

.item-control {
  background-color: var(--input-bg);
  padding: 0.75rem;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
}

.item-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--secondary-color);
}

.item-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.presets-container {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Preview Area */
.preview-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #000;
  overflow: hidden;
}

.preview-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.grid-wrapper {
  flex: 1;
  padding: 2rem;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  background-image: radial-gradient(var(--surface-color) 1px, transparent 1px);
  background-size: 20px 20px;
}

.grid-container {
  width: 100%;
  height: 100%;
  min-height: 400px;
  max-width: 800px;
  max-height: 600px;
  /* Grid styles will be injected by JS */
  border: 1px dashed var(--border-color);
}

/* Generated items styling */
.grid-container > div {
  display: flex;
  justify-content: center;
  align-items: center;
  color: rgba(255,255,255,0.8);
  font-weight: bold;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.1);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.code-output {
  height: 200px;
  background-color: var(--surface-color);
  border-top: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.code-output h3 {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: #B2BEC3;
}

.code-output pre {
  flex: 1;
  background-color: var(--input-bg);
  padding: 1rem;
  border-radius: var(--border-radius);
  overflow: auto;
  font-family: monospace;
  font-size: 0.85rem;
  color: #74B9FF;
  border: 1px solid var(--border-color);
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
    overflow: auto;
  }

  .main-content {
    flex-direction: column;
    overflow: visible;
  }

  .sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  .preview-area {
    height: 600px;
  }
}
