/* BSR QR Generator – App Mode nach BSR Design Guide */

:root {
  /* Brand */
  --brand-primary:        #575e66;
  --brand-accent:         #f7a723;
  --brand-accent-hover:   #d89216;
  --brand-accent-soft:    #fff8ec;
  --brand-focus:          rgba(247, 167, 35, 0.22);
  --brand-sidebar-hover:  rgba(247, 167, 35, 0.18);

  --bg:        #f4f5f7;
  --surface:   #ffffff;
  --surface-2: #f8f9fb;
  --border:    #e0e3e8;
  --border-strong: #c9ced6;

  --text:         #171c26;
  --muted:        #667085;
  --muted-strong: #475569;

  --accent:       var(--brand-accent);
  --accent-hover: var(--brand-accent-hover);
  --accent-soft:  var(--brand-accent-soft);

  --success:      #059669;
  --success-soft: #ecfdf5;
  --danger:       #dc2626;
  --danger-soft:  #fef2f2;
  --warning:      var(--brand-accent);
  --warning-soft: #fff8ec;

  --slate: var(--brand-primary);

  --radius-sm:   3px;
  --radius:      4px;
  --radius-pill: 999px;

  --shadow:    0 2px 10px rgba(15, 23, 42, 0.045);
  --shadow-md: 0 10px 28px rgba(15, 23, 42, 0.075);

  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --focus-ring: 0 0 0 3px var(--brand-focus);
}

*, *::before, *::after { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
[hidden] { display: none !important; }
code { font-family: 'Menlo', 'Consolas', monospace; font-size: .95em; }

.muted { color: var(--muted); font-weight: 400; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.icon {
  width: 14px; height: 14px;
  fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}

/* ---------- Topbar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--slate);
  color: #fff;
  box-shadow: 0 6px 20px rgba(87, 94, 102, 0.18);
}

.topbar-inner {
  max-width: 1180px;
  min-height: 58px;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 15px;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.4px;
}

.brand-text { font-weight: 500; }
.brand-text strong { font-weight: 800; }

.tabs {
  display: flex;
  align-self: stretch;
  gap: 4px;
}

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.tab:hover { color: #fff; background: var(--brand-sidebar-hover); }

.tab.active { color: #fff; }
.tab.active::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 0;
  height: 3px;
  background: var(--accent);
}

.tab:focus-visible { outline: none; box-shadow: inset var(--focus-ring); }

.topbar-badge {
  margin-left: auto;
  padding: 4px 12px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- Layout ---------- */

.main-layout {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 28px 28px;
}

.tool-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 18px;
  align-items: start;
}

.settings-col { display: flex; flex-direction: column; gap: 14px; }

.preview-col {
  display: flex; flex-direction: column; gap: 12px;
  position: sticky; top: 74px;
}

/* ---------- Panel ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-header {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.panel-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted-strong);
}

.panel-header-actions { display: flex; align-items: center; gap: 6px; }

.panel-body { padding: 14px; display: flex; flex-direction: column; gap: 12px; }

/* ---------- Forms ---------- */

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.field-label { font-size: 11px; font-weight: 600; color: var(--muted-strong); }
.field-required { color: var(--danger); }
.field-optional { font-weight: 400; color: var(--muted); }
.field-hint { font-size: 11px; color: var(--muted); line-height: 1.45; }
.field-error { color: var(--danger); font-size: 11px; font-weight: 600; }
.field-error:empty { display: none; }

.input, .select {
  width: 100%; min-height: 34px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font: 600 13px/1.2 var(--font); padding: 7px 10px;
  outline: none; transition: border-color .15s, box-shadow .15s;
  appearance: none; -webkit-appearance: none;
}
.input:focus, .select:focus { border-color: var(--accent); box-shadow: var(--focus-ring); }
.input:disabled, .select:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.input.error, .select.error { border-color: var(--danger); }
.input-textarea { resize: vertical; min-height: 68px; line-height: 1.5; font-weight: 500; }
.input-mono { font-family: 'Menlo', 'Consolas', monospace; font-size: 12px; font-weight: 600; }

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

/* Color inputs */
.color-input-wrap { display: flex; align-items: center; gap: 6px; }
.color-swatch {
  flex-shrink: 0; width: 34px; height: 34px; padding: 2px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.color-swatch:focus-visible { border-color: var(--accent); box-shadow: var(--focus-ring); }
.input-color-hex { flex: 1; min-width: 0; font-family: 'Menlo','Consolas',monospace; font-size: 12px; }

/* ---------- Upload zone ---------- */

.upload-zone {
  position: relative; display: flex; align-items: center; gap: 11px;
  padding: 12px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--surface-2); cursor: pointer; outline: none;
  transition: border-color .15s, background .15s;
}
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.upload-zone:focus-visible { box-shadow: var(--focus-ring); border-color: var(--accent); }
.upload-zone-icon { flex-shrink: 0; color: var(--muted); display: flex; }
.upload-zone:hover .upload-zone-icon, .upload-zone.drag-over .upload-zone-icon { color: var(--accent); }
.upload-zone-text { display: flex; flex-direction: column; gap: 2px; }
.upload-zone-label { font-size: 12px; font-weight: 600; color: var(--muted-strong); }
.upload-zone-hint { font-size: 11px; color: var(--muted); }
.upload-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }

.logo-preview-wrap {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.logo-preview-img { width: 38px; height: 38px; object-fit: contain; border: 1px solid var(--border); border-radius: 2px; background: #fff; }
.logo-preview-info { display: flex; align-items: center; justify-content: space-between; flex: 1; gap: 8px; min-width: 0; }
.logo-preview-name { font-size: 12px; color: var(--muted-strong); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 32px; border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 6px 13px; font: 600 12px/1.2 var(--font); cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--muted-strong); }
.btn-secondary:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-hover); background: var(--accent-soft); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); padding: 4px 8px; }
.btn-ghost:hover:not(:disabled) { color: var(--danger); background: var(--danger-soft); }
.btn-danger { background: var(--surface); border-color: #f3c4c4; color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); border-color: var(--danger); }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-sm { min-height: 28px; padding: 5px 10px; font-size: 11px; }
.btn-lg { min-height: 40px; padding: 9px 18px; font-size: 13px; font-weight: 700; width: 100%; justify-content: center; }

.action-row { display: flex; }
.action-row .btn-lg { width: 100%; }

/* ---------- Badge ---------- */

.badge {
  display: inline-flex; align-items: center; min-height: 18px;
  border-radius: var(--radius); padding: 1px 7px;
  font-size: 10px; font-weight: 700; letter-spacing: .3px;
  white-space: nowrap; text-transform: uppercase;
}
.badge-accent { background: var(--accent); color: #fff; }

/* ---------- Preview ---------- */

.preview-panel { min-height: 320px; }
.preview-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 280px; padding: 24px 18px;
}

.preview-placeholder { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.preview-placeholder-icon { color: var(--border); }
.preview-placeholder-text { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }

.preview-canvas {
  max-width: 100%; height: auto;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  display: block; image-rendering: pixelated;
}

.preview-loading { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.spinner { width: 22px; height: 22px; border: 2.5px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Info box ---------- */

.info-box {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 9px 13px; background: var(--accent-soft);
  border: 1px solid rgba(247,167,35,.28); border-radius: var(--radius-sm);
  font-size: 12px; line-height: 1.5; color: var(--text);
}
.info-box-icon { flex-shrink: 0; color: var(--accent); margin-top: 1px; }
.info-box.is-error { background: var(--danger-soft); border-color: rgba(220,38,38,.22); }
.info-box.is-error .info-box-icon { color: var(--danger); }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .tool-grid { grid-template-columns: 1fr; }
  .preview-col { position: static; }
}

@media (max-width: 768px) {
  .topbar-inner { flex-wrap: wrap; gap: 0 16px; padding: 0 16px; }
  .brand { min-height: 52px; }
  .topbar-badge { display: none; }
  .tabs { order: 3; width: 100%; overflow-x: auto; }
  .tab { min-height: 42px; }

  .main-layout { padding: 18px 16px; }
  .field-row { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
  .topbar-badge { display: none; }
}

/* ---------- Footer ---------- */

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 24px;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  padding: 14px 28px 22px;
  color: var(--muted);
  font-size: 12px;
}

.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }

@media (max-width: 768px) {
  .footer { padding: 14px 16px 22px; }
}
