:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --secondary: #1e293b;
  --bg-color: #f8fafc;
  --surface: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius-lg: 24px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 40px rgba(15, 23, 42, 0.08);
}

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

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

@media (min-width: 900px) {
  body {
    height: 100vh;
    overflow: hidden;
  }
}

.app-container {
  display: flex;
  flex-direction: column-reverse;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  flex: 1;
}

@media (min-width: 900px) {
  .app-container {
    flex-direction: row;
    height: 100%;
    overflow: hidden;
  }
}

/* Global Header */
.global-header {
  width: 100%;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px; /* Kompakt für Mobile */
  text-align: center;
  z-index: 20;
}

.global-header .header-content {
  max-width: 1200px;
  margin: 0 auto;
}

.global-header h1 {
  font-size: 1.4rem; /* Kompakt für Mobile */
  font-weight: 700;
  margin-bottom: 2px;
  letter-spacing: -0.5px;
}

.global-header h1 span {
  color: var(--primary);
}

.global-header p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0;
}

@media (min-width: 900px) {
  .global-header {
    padding: 16px 32px;
  }
  .global-header h1 {
    font-size: 1.8rem;
    margin-bottom: 4px;
  }
  .global-header p {
    font-size: 0.95rem;
  }
}

/* Sidebar */
.sidebar {
  width: 100%;
  background: var(--surface);
  padding: 16px; /* Kompakt für Mobile */
  overflow-y: auto;
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  z-index: 10;
}

@media (min-width: 900px) {
  .sidebar {
    width: 400px;
    flex-shrink: 0;
    padding: 32px;
  }
}

.global-footer {
  padding: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--surface);
  z-index: 20;
}

/* Form Settings */
.settings-section {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.settings-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.settings-section h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--secondary);
}

.control-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
}

@media (min-width: 900px) {
  .settings-section {
    margin-bottom: 28px;
    padding-bottom: 24px;
  }
  .settings-section h2 {
    font-size: 1.1rem;
    margin-bottom: 16px;
  }
  .control-group {
    margin-bottom: 16px;
  }
}

.control-group label {
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-main);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Inputs */
input[type="text"],
select {
  width: 100%;
  padding: 8px 12px; /* Kompakt für Mobile */
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--bg-color);
  color: var(--text-main);
  transition: all 0.2s;
  appearance: none;
}

@media (min-width: 900px) {
  input[type="text"],
  select {
    padding: 12px 16px;
    font-size: 0.95rem;
  }
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* Color Picker */
.color-picker-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg-color);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

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

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}
input[type="color"]::-webkit-color-swatch {
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 4px;
}

.color-value {
  font-family: monospace;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Range */
input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
}

/* File Input */
.file-input {
  font-size: 0.85rem;
}
.file-input::file-selector-button {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  margin-right: 12px;
  transition: all 0.2s;
}
.file-input::file-selector-button:hover {
  background: var(--bg-color);
}

/* Icon Gallery */
.icon-gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.icon-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  height: 40px; /* Kompakt für Mobile */
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
}

@media (min-width: 900px) {
  .icon-btn {
    height: 48px;
    font-size: 0.9rem;
  }
}

.icon-btn:hover {
  background: var(--bg-color);
  border-color: var(--primary);
  color: var(--primary);
}

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

.icon-btn svg {
  width: 24px;
  height: 24px;
}

/* Preview Area */
.preview-area {
  flex-grow: 1;
  display: flex;
  flex-direction: column; /* Allow ads to stack */
  align-items: center;
  justify-content: flex-start;
  padding: 12px; /* Super kompakt für Mobile */
  background: linear-gradient(135deg, #e0e7ff, #f8fafc);
}

.preview-card {
  background: var(--surface);
  padding: 16px; /* Noch kompakter */
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 480px;
}

@media (min-width: 900px) {
  .preview-area {
    padding: 32px;
    justify-content: center;
  }
  .preview-card {
    padding: 48px;
  }
}

#qr-container {
  width: 100%;
  max-width: 160px; /* Noch etwas kleiner */
  aspect-ratio: 1/1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px; /* Reduziert von 16px */
  background: white;
  border-radius: var(--radius-md);
  padding: 8px;
}

@media (min-width: 900px) {
  #qr-container {
    max-width: 100%;
    margin-bottom: 32px;
    padding: 16px;
  }
}

#qr-container svg,
#qr-container canvas {
  width: 100%;
  height: 100%;
}

.status-message {
  min-height: 24px;
  margin-bottom: 12px; /* Reduziert von 24px */
  font-size: 0.85rem; /* Etwas kleiner auf Mobile */
  font-weight: 500;
  text-align: center;
  transition: color 0.3s;
}

@media (min-width: 900px) {
  .status-message {
    margin-bottom: 24px;
    font-size: 0.9rem;
  }
}

.status-message.error {
  color: #ef4444;
}

.status-message.success {
  color: #10b981;
}

/* Buttons */
.actions {
  display: flex;
  gap: 8px; /* Reduziert von 16px */
  width: 100%;
}

@media (min-width: 900px) {
  .actions {
    gap: 16px;
  }
}

.btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px; /* Reduziert von 8px */
  padding: 10px 12px; /* Reduziert von 12px 24px */
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.85rem; /* Reduziert von 0.95rem */
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

@media (min-width: 900px) {
  .btn {
    padding: 12px 24px;
    gap: 8px;
    font-size: 0.95rem;
  }
}

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

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

.btn-secondary:hover {
  background: var(--bg-color);
  border-color: #cbd5e1;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
