:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --bg-dark: #1f2937;
  --bg-sidebar: #ffffff;
  --bg-main: #f3f4f6;
  --text-main: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

.app-container {
  display: flex;
  height: 100%;
}

/* Sidebar */
.sidebar {
  width: 300px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
  box-shadow: 2px 0 5px rgba(0,0,0,0.05);
}

.logo-area {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
}

.logo {
  height: 32px;
  width: auto;
}

.logo-area h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.controls {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.control-group h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-weight: 600;
}

label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
  font-weight: 500;
}

input[type="number"],
select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

input[type="range"] {
  width: 100%;
  margin-bottom: 0.5rem;
}

.checkbox-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.checkbox-row label {
  margin-bottom: 0;
}

.color-picker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

input[type="color"] {
  width: 40px;
  height: 30px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
  background: none;
}

button {
  width: 100%;
  padding: 0.75rem;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 0.5rem;
}

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

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

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

.secondary-btn:hover {
  background: var(--bg-main);
  border-color: var(--text-muted);
}

.hidden {
  display: none !important;
}

/* Main Preview */
.preview-area {
  flex: 1;
  background: #e5e5e5;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: auto;
  padding: 2rem;
}

.canvas-wrapper {
  background: white;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  line-height: 0;
}

canvas {
  max-width: 100%;
  max-height: 90vh;
  display: block;
}

/* Loading Overlay */
#loadingOverlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255,255,255,0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  gap: 1rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}