/* ============================================
   ShopOS · Global Design System
   Inspired by: deep black, high contrast,
   rounded cards, colored accents
   ============================================ */

/* Google Font - Inter */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Core Backgrounds - deeper black like reference */
  --bg:        #080809;
  --bg2:       #0f0f12;
  --bg3:       #16161a;
  --bg4:       #1c1c22;

  /* Borders */
  --border:    #ffffff0f;
  --border2:   #ffffff18;
  --border3:   #ffffff25;

  /* Text */
  --text:      #f0f0f8;
  --text2:     #9090a8;
  --text3:     #505068;

  /* Accent - Blue */
  --accent:        #5b6ef5;
  --accent2:       #4558e8;
  --accent-light:  #5b6ef520;
  --accent-border: #5b6ef540;

  /* Status Colors */
  --green:        #22d3a0;
  --green-bg:     #22d3a012;
  --green-border: #22d3a030;

  --red:        #f55b6e;
  --red-bg:     #f55b6e12;
  --red-border: #f55b6e30;

  --yellow:        #f5b93b;
  --yellow-bg:     #f5b93b12;
  --yellow-border: #f5b93b30;

  --purple:        #a855f7;
  --purple-bg:     #a855f712;
  --purple-border: #a855f730;

  --orange:        #f5813b;
  --orange-bg:     #f5813b12;

  /* Shadows */
  --shadow-sm: 0 2px 8px #00000040;
  --shadow-md: 0 4px 20px #00000060;
  --shadow-lg: 0 8px 40px #00000080;
  --shadow-accent: 0 4px 24px #5b6ef530;

  /* Radius */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius:    14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html { font-size: 15px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Autofill Fix ── */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--bg4) inset !important;
  -webkit-text-fill-color: var(--text) !important;
  caret-color: var(--text) !important;
  transition: background-color 5000s ease-in-out 0s;
}

/* ── Typography ── */
h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.03em; line-height: 1.2; }
p { line-height: 1.6; color: var(--text2); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Cards ── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

.card-lg {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 28px;
}

/* Accent top border on cards */
.card-accent-blue  { border-top: 2px solid var(--accent); }
.card-accent-green { border-top: 2px solid var(--green); }
.card-accent-red   { border-top: 2px solid var(--red); }
.card-accent-yellow{ border-top: 2px solid var(--yellow); }
.card-accent-purple{ border-top: 2px solid var(--purple); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-accent);
}
.btn-primary:hover { background: var(--accent2); transform: translateY(-1px); box-shadow: 0 6px 28px #5b6ef540; }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg3);
  color: var(--text2);
  border: 1px solid var(--border2);
}
.btn-secondary:hover { background: var(--bg4); color: var(--text); border-color: var(--border3); }

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg3); color: var(--text); }

.btn-danger {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-border);
}
.btn-danger:hover { background: var(--red); color: #fff; }

.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: var(--radius-xs); }
.btn-lg { padding: 12px 24px; font-size: 15px; border-radius: var(--radius-sm); }

/* ── Inputs ── */
.input, .form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus, .form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.input::placeholder, .form-input::placeholder { color: var(--text3); }

select.input, select.form-input { cursor: pointer; }

.input:disabled, .form-input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Input with icon */
.input-wrap { position: relative; }
.input-wrap .form-input { padding-right: 42px; }
.input-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 2px;
  transition: color 0.15s;
}
.input-icon:hover { color: var(--text2); }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.badge-blue   { background: var(--accent-light);  color: var(--accent); border: 1px solid var(--accent-border); }
.badge-green  { background: var(--green-bg);       color: var(--green);  border: 1px solid var(--green-border); }
.badge-red    { background: var(--red-bg);         color: var(--red);    border: 1px solid var(--red-border); }
.badge-yellow { background: var(--yellow-bg);      color: var(--yellow); border: 1px solid var(--yellow-border); }
.badge-purple { background: var(--purple-bg);      color: var(--purple); border: 1px solid var(--purple-border); }
.badge-gray   { background: var(--bg3);            color: var(--text3);  border: 1px solid var(--border2); }

/* Role badges */
.badge-superadmin { background: var(--purple-bg); color: var(--purple); border: 1px solid var(--purple-border); }
.badge-admin      { background: var(--accent-light); color: var(--accent); border: 1px solid var(--accent-border); }
.badge-mitarbeiter{ background: var(--bg3); color: var(--text3); border: 1px solid var(--border2); }
.badge-aktiv      { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.badge-inaktiv    { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }

/* ── Tables ── */
.table-wrap {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}

.table-header h3 { font-size: 14px; font-weight: 600; color: var(--text); }

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

thead th {
  padding: 10px 20px;
  text-align: left;
  font-size: 11px;
  color: var(--text3);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 14px 20px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
  transition: background 0.1s;
}

tbody td:first-child { color: var(--text); }
tbody tr:last-child td { border-bottom: none; }
tbody tr { border-left: 2px solid transparent; transition: all 0.12s; }
tbody tr:hover td { background: var(--bg3); }
tbody tr:hover { border-left-color: var(--accent); }

/* ── Search Input ── */
.search-input {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  outline: none;
  width: 220px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.search-input::placeholder { color: var(--text3); }

/* ── Stat Cards ── */
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.2s;
}

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}

.stat-card.blue::before   { background: linear-gradient(90deg, var(--accent), #818cf8); }
.stat-card.green::before  { background: linear-gradient(90deg, var(--green), #34d399); }
.stat-card.yellow::before { background: linear-gradient(90deg, var(--yellow), #fbbf24); }
.stat-card.red::before    { background: linear-gradient(90deg, var(--red), #fb7185); }
.stat-card.purple::before { background: linear-gradient(90deg, var(--purple), #c084fc); }

.stat-label {
  font-size: 11px;
  color: var(--text3);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
}

.stat-value.blue   { color: var(--accent); }
.stat-value.green  { color: var(--green); }
.stat-value.yellow { color: var(--yellow); }
.stat-value.red    { color: var(--red); }
.stat-value.purple { color: var(--purple); }

.stat-sub { font-size: 12px; color: var(--text3); margin-top: 8px; }

/* ── Form Layout ── */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }
.form-label { font-size: 12px; color: var(--text2); font-weight: 500; display: block; margin-bottom: 6px; }
.form-hint { font-size: 11px; color: var(--text3); margin-top: 5px; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: #00000090;
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
  padding: 16px;
}
.modal-overlay.show { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal h3 { font-size: 18px; font-weight: 700; margin-bottom: 24px; color: var(--text); }

.modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 24px; padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ── Toasts ── */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 9999;
}

.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  min-width: 260px;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.25s ease;
  border: 1px solid;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.toast.success { background: var(--green-bg); color: var(--green); border-color: var(--green-border); }
.toast.error   { background: var(--red-bg);   color: var(--red);   border-color: var(--red-border); }
.toast.info    { background: var(--accent-light); color: var(--accent); border-color: var(--accent-border); }

/* ── Page Layout ── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.page-title { font-size: 22px; font-weight: 700; letter-spacing: -0.04em; color: var(--text); }
.page-sub   { font-size: 13px; color: var(--text3); margin-top: 3px; }

/* ── Divider ── */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border3); }

/* ── Mobile ── */
@media (max-width: 768px) {
  .form-row { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .btn-primary { width: 100%; justify-content: center; }
  .search-input { width: 100%; }
}