/* ============================================================
   Gutschein App – Design System (Fluent UI inspired)
   ============================================================ */

:root {
  --primary:        #0078d4;
  --primary-dark:   #106ebe;
  --primary-light:  #deecf9;
  --bg:             #f3f2f1;
  --surface:        #ffffff;
  --surface-alt:    #faf9f8;
  --text:           #201f1e;
  --text-secondary: #605e5c;
  --text-disabled:  #a19f9d;
  --border:         #d1d1d1;
  --border-light:   #edebe9;
  --error:          #c50f1f;
  --error-bg:       #fde7e9;
  --success:        #107c10;
  --success-bg:     #dff6dd;
  --warning:        #d83b01;
  --radius:         6px;
  --radius-lg:      8px;
  --shadow-sm:      0 1px 2px rgba(0,0,0,.08);
  --shadow:         0 2px 8px rgba(0,0,0,.12);
  --shadow-lg:      0 8px 24px rgba(0,0,0,.14);
  --nav-h:          52px;
  --font:           'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Navigation bar ───────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: 100;
}

.nav-brand {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-brand svg { color: var(--primary); }

.nav-spacer { flex: 1; }

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

.nav-user strong { color: var(--text); }

.nav-link {
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: background .15s;
}

.nav-link:hover { background: var(--primary-light); }

/* ── Page layout ──────────────────────────────────────────── */
.page {
  padding-top: calc(var(--nav-h) + 32px);
  padding-bottom: 48px;
  min-height: 100vh;
}

.page-center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.container {
  max-width: 1024px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-light);
}

.card-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.card-header p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.card-body { padding: 24px; }

/* ── Form elements ────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  line-height: 1.5;
}

input:hover, select:hover { border-color: #8a8886; }

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

input.error, select.error {
  border-color: var(--error);
  box-shadow: 0 0 0 1px var(--error);
}

select { cursor: pointer; }

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

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 16px;
  font-size: 14px;
  font-family: var(--font);
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.5;
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-alt);
  border-color: #8a8886;
}

.btn-danger {
  background: var(--surface);
  color: var(--error);
  border-color: var(--border);
}

.btn-danger:hover:not(:disabled) {
  background: var(--error-bg);
  border-color: var(--error);
}

.btn-sm { padding: 4px 12px; font-size: 13px; }
.btn-full { width: 100%; }

/* ── Alerts / messages ────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.alert-error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid #f1b9bc;
}

.alert-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid #bad80a33;
}

.alert-info {
  background: var(--primary-light);
  color: var(--primary-dark);
  border: 1px solid #b3d7f2;
}

/* ── Badge ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary);
}

.badge-admin { background: #e8f3ff; color: #004578; }

/* ── Table ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
}

table.data-table th {
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-secondary);
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border-light);
  text-align: left;
  white-space: nowrap;
}

table.data-table td {
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

table.data-table tbody tr:hover { background: #faf9f8; }
table.data-table tbody tr:last-child td { border-bottom: none; }

/* ── Auth pages ───────────────────────────────────────────── */
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.auth-header {
  background: var(--primary);
  padding: 28px 32px 24px;
  color: #fff;
}

.auth-header h1 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 4px;
}

.auth-header p { font-size: 14px; opacity: .85; }

.auth-body { padding: 28px 32px; }

/* ── Setup wizard ─────────────────────────────────────────── */
.setup-card {
  width: 100%;
  max-width: 560px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.setup-steps {
  display: flex;
  padding: 16px 32px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border-light);
  gap: 8px;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.step.active { color: var(--primary); font-weight: 600; }
.step.done   { color: var(--success); }

.step-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  background: var(--border-light);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.step.active .step-num { background: var(--primary); color: #fff; }
.step.done   .step-num { background: var(--success); color: #fff; }

.step-divider {
  flex: 1;
  height: 1px;
  background: var(--border-light);
  margin: 0 4px;
  align-self: center;
}

/* ── Misc helpers ─────────────────────────────────────────── */
.hidden { display: none !important; }
.text-secondary { color: var(--text-secondary); font-size: 13px; }
.text-error { color: var(--error); font-size: 12px; margin-top: 4px; }
.mb-16 { margin-bottom: 16px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.justify-between { justify-content: space-between; }
.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* ── Sidebar layout (admin) ───────────────────────────────── */
.layout {
  display: flex;
  min-height: calc(100vh - var(--nav-h));
  margin-top: var(--nav-h);
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border-light);
  padding: 16px 0;
  position: fixed;
  top: var(--nav-h);
  bottom: 0;
  overflow-y: auto;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  transition: background .15s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.sidebar-item:hover { background: var(--surface-alt); }
.sidebar-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }

.main-content {
  flex: 1;
  margin-left: 220px;
  padding: 32px;
  max-width: 860px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Code type indicator ──────────────────────────────────── */
.code-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 3px 10px;
  border-radius: 12px;
  margin-top: 6px;
}
