/* ============================================
   BONSYSTEM - Admin Dashboard Styles
   Modernes, klares, professionelles Design
   ============================================ */

* { box-sizing: border-box; }

:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #1a1d29;
  --text-muted: #6b7280;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --sidebar-bg: #1a1d29;
  --sidebar-text: #b8bcc8;
  --sidebar-active: #4f46e5;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.12);
  --radius: 10px;
  --radius-sm: 6px;
  --font-base: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
  margin: 0;
  font-family: var(--font-base);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ===== Layout ===== */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 24px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar .brand {
  padding: 0 24px 24px;
  border-bottom: 1px solid #2d3142;
  margin-bottom: 16px;
}
.sidebar .brand h2 {
  margin: 0; color: white; font-size: 20px; letter-spacing: -0.3px;
}
.sidebar .brand .sub { font-size: 12px; color: #6b7280; margin-top: 2px; }

.nav-item {
  display: block;
  padding: 12px 24px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}
.nav-item:hover { background: rgba(255,255,255,0.04); color: white; }
.nav-item.active {
  background: rgba(79,70,229,0.15);
  color: white;
  border-left-color: var(--sidebar-active);
}
.nav-item .icon { display: inline-block; width: 24px; }

.sidebar-footer {
  margin-top: auto;
  padding: 16px 24px;
  border-top: 1px solid #2d3142;
  font-size: 12px;
  color: #6b7280;
}

.main {
  flex: 1;
  padding: 24px 32px;
  max-width: 100%;
  overflow-x: auto;
}

/* ===== Topbar ===== */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.topbar h1 { margin: 0; font-size: 24px; letter-spacing: -0.4px; }
.topbar .user { color: var(--text-muted); font-size: 13px; }
.topbar .user a { color: var(--primary); text-decoration: none; margin-left: 12px; }

/* ===== Cards ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.card h3 {
  margin: 0 0 12px; font-size: 16px; font-weight: 600;
}
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.card-header h3 { margin: 0; }

/* ===== Stat-Grid ===== */
.stat-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.stat-card .label {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-muted); font-weight: 600;
}
.stat-card .value {
  font-size: 28px; font-weight: 700; margin-top: 6px; letter-spacing: -0.5px;
}
.stat-card .delta { font-size: 12px; margin-top: 4px; }
.stat-card.primary { border-top: 3px solid var(--primary); }
.stat-card.success { border-top: 3px solid var(--success); }
.stat-card.warning { border-top: 3px solid var(--warning); }
.stat-card.danger  { border-top: 3px solid var(--danger); }

/* ===== Forms ===== */
label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin: 12px 0 6px; }
input[type=text], input[type=password], input[type=number], input[type=email],
input[type=color], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); font-size: 14px; font-family: inherit;
  background: white; transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
input[type=color] { height: 42px; padding: 4px; cursor: pointer; }
textarea { min-height: 80px; resize: vertical; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.row-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ===== Buttons ===== */
.btn {
  display: inline-block; padding: 10px 18px;
  background: var(--primary); color: white;
  border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer;
  text-decoration: none; transition: background 0.15s;
}
.btn:hover { background: var(--primary-hover); }
.btn-secondary { background: white; color: var(--text); border: 1px solid var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-success { background: var(--success); }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ===== Tabellen ===== */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table.data {
  width: 100%; border-collapse: collapse; background: white;
}
table.data th {
  background: var(--surface-2); text-align: left;
  padding: 12px 14px; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
table.data td {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--surface-2); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ===== Badges ===== */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 100px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-muted   { background: #f3f4f6; color: #374151; }

/* ===== Alerts ===== */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* ===== Stock Indicator ===== */
.stock-bar {
  display: inline-block; width: 60px; height: 6px; background: #e5e7eb;
  border-radius: 3px; overflow: hidden; vertical-align: middle; margin-left: 6px;
}
.stock-bar .fill { height: 100%; background: var(--success); }
.stock-bar.warn  .fill { background: var(--warning); }
.stock-bar.crit  .fill { background: var(--danger); }

/* ===== File-Upload-Bereich ===== */
.upload-zone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius);
  padding: 32px; text-align: center; background: var(--surface-2);
  cursor: pointer; transition: all 0.15s;
}
.upload-zone:hover { border-color: var(--primary); background: #eff6ff; }
.upload-zone input[type=file] { display: none; }

/* ===== Bon-Vorschau ===== */
.receipt-preview {
  font-family: 'Courier New', monospace;
  background: white; padding: 24px;
  width: 320px; margin: 0 auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  white-space: pre-wrap;
  font-size: 13px; line-height: 1.4;
  border-radius: 4px;
}

/* ===== Misc ===== */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.hidden { display: none !important; }

/* ===== Modal ===== */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 16px;
}
.modal {
  background: white; border-radius: var(--radius);
  width: 100%; max-width: 520px; padding: 24px;
  box-shadow: var(--shadow-lg); max-height: 90vh; overflow-y: auto;
}
.modal h2 { margin: 0 0 16px; font-size: 20px; }
.modal-actions {
  display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px;
}

/* ===== Color-Dot ===== */
.color-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: middle; margin-right: 6px; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; }
  .main { padding: 16px; }
  .row, .row-3, .row-4 { grid-template-columns: 1fr; }
}
