/* VereinInventar - App Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Mono:wght@400;500&display=swap');

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

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface2: #21262d;
  --surface3: #2d333b;
  --border: #30363d;
  --border-light: #21262d;
  --accent: #5865f2;
  --accent-hover: #6e7bf5;
  --accent2: #818cf8;
  --accent-muted: rgba(88,101,242,0.15);
  --accent-muted-30: rgba(88,101,242,0.30);
  --success: #2ea043;
  --success-muted: rgba(46,160,67,0.15);
  --warning: #d29922;
  --warning-muted: rgba(210,153,34,0.15);
  --error: #da3633;
  --error-muted: rgba(218,54,51,0.15);
  --text: #e6edf3;
  --text-muted: #8b949e;
  --text-dim: #484f58;
  --sidebar-w: 240px;
  --topbar-h: 56px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --transition: 150ms ease;
}

html { font-size: 15px; }

body {
  font-family: 'DM Sans', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
}

/* ===== LAYOUT ===== */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 50;
  transition: transform var(--transition);
}

.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  min-height: var(--topbar-h);
}

.sidebar-logo {
  display: flex; align-items: center; gap: 0.65rem;
}
.sidebar-logo-icon { font-size: 1.5rem; }
.sidebar-logo-title {
  font-size: 0.95rem; font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
}
.sidebar-logo-sub {
  font-size: 0.7rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 140px;
}

.sidebar-close {
  display: none;
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 0.25rem; font-size: 1rem;
}

.sidebar-nav {
  flex: 1; overflow-y: auto;
  padding: 0.75rem 0.5rem;
  display: flex; flex-direction: column; gap: 2px;
}

.nav-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem; font-weight: 500;
  transition: all var(--transition);
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active {
  background: var(--accent-muted);
  color: var(--accent2);
}
.nav-item.active .nav-icon { color: var(--accent2); }

.sidebar-user {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 1rem;
  border-top: 1px solid var(--border);
}
.sidebar-user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 0.82rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role { font-size: 0.7rem; color: var(--text-muted); }
.sidebar-logout {
  color: var(--text-muted); padding: 0.25rem;
  display: flex; text-decoration: none;
  transition: color var(--transition);
}
.sidebar-logout:hover { color: var(--error); }

.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
}

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1.25rem;
}
.topbar-menu {
  display: none;
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 0.25rem;
}
.topbar-title {
  flex: 1;
  font-size: 0.875rem; font-weight: 600; color: var(--text-muted);
}
.topbar-scan {
  color: var(--text-muted); display: flex; align-items: center;
  padding: 0.35rem; border-radius: 6px;
  text-decoration: none;
  transition: all var(--transition);
}
.topbar-scan:hover { background: var(--surface2); color: var(--accent); }

.content {
  flex: 1;
  padding: 1.5rem;
  max-width: 1400px;
  width: 100%;
}

/* ===== FLASH MESSAGES ===== */
.flash-container {
  padding: 0 1.5rem;
  display: flex; flex-direction: column; gap: 0.5rem;
  margin-top: 0.75rem;
}
.alert {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
}
.alert-close {
  background: none; border: none; cursor: pointer;
  margin-left: auto; opacity: 0.6; color: inherit;
  font-size: 0.75rem;
}
.alert-success { background: var(--success-muted); color: #4ade80; border: 1px solid rgba(46,160,67,0.3); }
.alert-error { background: var(--error-muted); color: #f87171; border: 1px solid rgba(218,54,51,0.3); }
.alert-warning { background: var(--warning-muted); color: #fbbf24; border: 1px solid rgba(210,153,34,0.3); }
.alert-info { background: var(--accent-muted); color: var(--accent2); border: 1px solid var(--accent-muted-30, rgba(88,101,242,0.3)); }

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 1.5rem; gap: 1rem;
  flex-wrap: wrap;
}
.page-header-left {}
.page-title { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.3px; }
.page-subtitle { color: var(--text-muted); font-size: 0.875rem; margin-top: 0.2rem; }
.page-header-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem; font-weight: 600;
  cursor: pointer; border: 1px solid transparent;
  text-decoration: none; white-space: nowrap;
  transition: all var(--transition);
  outline: none;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface3); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { filter: brightness(1.1); }
.btn-danger { background: var(--error-muted); color: #f87171; border-color: rgba(218,54,51,0.3); }
.btn-danger:hover { background: var(--error); color: white; }
.btn-ghost { background: none; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-icon { padding: 0.5rem; gap: 0; }

/* ===== CARDS ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.card-title { font-weight: 600; font-size: 0.95rem; }
.card-body { padding: 1.25rem; }

/* ===== STAT CARDS ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.stat-card-header {
  display: flex; align-items: center; justify-content: space-between;
  color: var(--text-muted); font-size: 0.8rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.stat-card-icon {
  width: 28px; height: 28px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.stat-card-value {
  font-size: 2rem; font-weight: 700;
  letter-spacing: -1px; line-height: 1;
}
.stat-card-sub { font-size: 0.78rem; color: var(--text-muted); }

/* ===== TABLES ===== */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
table {
  width: 100%; border-collapse: collapse;
  font-size: 0.875rem;
}
thead th {
  background: var(--surface2);
  padding: 0.65rem 1rem;
  text-align: left;
  font-weight: 600; font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }
.table-actions { display: flex; gap: 0.25rem; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.72rem; font-weight: 600;
  white-space: nowrap;
}
.badge-primary { background: var(--accent-muted); color: var(--accent2); }
.badge-success { background: var(--success-muted); color: #4ade80; }
.badge-warning { background: var(--warning-muted); color: #fbbf24; }
.badge-error { background: var(--error-muted); color: #f87171; }
.badge-muted { background: var(--surface2); color: var(--text-muted); }

/* ===== FORMS ===== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group.full { grid-column: 1 / -1; }
.form-label {
  font-size: 0.82rem; font-weight: 600;
  color: var(--text-muted);
}
.form-label .required { color: var(--error); margin-left: 2px; }
.form-control {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.875rem;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  transition: border-color var(--transition);
  outline: none;
  width: 100%;
}
.form-control:focus { border-color: var(--accent); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: 0.75rem; color: var(--text-muted); }
.form-actions {
  display: flex; gap: 0.5rem; justify-content: flex-end;
  margin-top: 0.5rem; padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ===== SEARCH & FILTER BAR ===== */
.filter-bar {
  display: flex; gap: 0.75rem; flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.search-wrapper {
  position: relative; flex: 1; min-width: 200px;
}
.search-wrapper .search-icon {
  position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none;
}
.search-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.875rem 0.6rem 2.25rem;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  width: 100%; outline: none;
  transition: border-color var(--transition);
}
.search-input:focus { border-color: var(--accent); }
.filter-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.875rem;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  outline: none; cursor: pointer;
}

/* ===== MODAL ===== */
.modal-backdrop {
  display: none;
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 580px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-md);
  animation: modalIn 150ms ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(-8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-weight: 700; font-size: 1rem; }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 0.25rem; font-size: 1.1rem;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 1.25rem; }
.modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex; gap: 0.5rem; justify-content: flex-end;
}

/* ===== ITEM CARD GRID ===== */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.item-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex; flex-direction: column; gap: 0.875rem;
  transition: border-color var(--transition), transform var(--transition);
  position: relative;
  overflow: hidden;
}
.item-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.item-card-header { display: flex; gap: 0.75rem; align-items: flex-start; }
.item-card-image {
  width: 52px; height: 52px; border-radius: 8px;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; flex-shrink: 0;
  overflow: hidden;
}
.item-card-image img { width: 100%; height: 100%; object-fit: cover; }
.item-card-info { flex: 1; min-width: 0; }
.item-card-name { font-weight: 600; font-size: 0.95rem; margin-bottom: 0.2rem; }
.item-card-tag { font-size: 0.72rem; color: var(--text-muted); font-family: 'DM Mono', monospace; }
.item-card-meta {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  font-size: 0.78rem; color: var(--text-muted);
}
.item-card-qty {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface2);
  border-radius: 6px;
}
.qty-bar {
  flex: 1; height: 4px; background: var(--surface3);
  border-radius: 2px; overflow: hidden;
}
.qty-fill { height: 100%; border-radius: 2px; transition: width 0.3s; }
.qty-text { font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.item-card-actions { display: flex; gap: 0.375rem; margin-top: auto; }

/* ===== QR / LABEL ===== */
.label-preview {
  display: inline-flex;
  border: 2px dashed var(--border);
  border-radius: 4px;
  padding: 0.5rem;
  background: white;
  color: #000;
}
.label-sheet {
  background: white;
  color: #000;
  padding: 10mm;
}
.label-grid {
  display: grid;
  gap: 0;
}
.label-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2mm;
  padding: 2mm;
  border: 1px dashed #ccc;
  font-family: Arial, sans-serif;
  overflow: hidden;
  page-break-inside: avoid;
}
.label-cell-name {
  font-size: 8pt; font-weight: bold;
  text-align: center; word-break: break-word;
}
.label-cell-sub { font-size: 6pt; color: #555; text-align: center; }

/* ===== SCAN PAGE ===== */
.scan-container {
  display: flex; flex-direction: column; align-items: center;
  gap: 1.5rem; padding: 1rem;
}
.scan-video-wrapper {
  width: 100%; max-width: 480px;
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 2px solid var(--accent);
  position: relative; background: #000;
}
.scan-video-wrapper video {
  width: 100%; height: 100%; object-fit: cover;
}
.scan-crosshair {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.scan-crosshair::before {
  content: '';
  width: 60%; height: 60%;
  border: 2px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.4);
}
.scan-results { width: 100%; max-width: 480px; }
.scan-result-item {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.875rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  animation: slideIn 200ms ease;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}
.scan-count-badge {
  background: var(--accent);
  color: white;
  border-radius: 50%;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700;
}

/* ===== DASHBOARD ===== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.dashboard-grid .full { grid-column: 1 / -1; }
.activity-list { display: flex; flex-direction: column; }
.activity-item {
  display: flex; align-items: flex-start; gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.85rem;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px; height: 8px; border-radius: 50%;
  margin-top: 0.35rem; flex-shrink: 0;
}
.activity-time { color: var(--text-muted); font-size: 0.75rem; white-space: nowrap; }

/* ===== PAGINATION ===== */
.pagination {
  display: flex; align-items: center; gap: 0.25rem;
  margin-top: 1.25rem; flex-wrap: wrap;
}
.page-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--text-muted); font-size: 0.8rem;
  text-decoration: none;
  transition: all var(--transition);
}
.page-link:hover { background: var(--surface2); color: var(--text); }
.page-link.active { background: var(--accent); border-color: var(--accent); color: white; }
.page-link.disabled { opacity: 0.4; pointer-events: none; }

/* ===== AVAILABILITY INDICATOR ===== */
.avail-indicator {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.8rem;
}
.avail-dot { width: 8px; height: 8px; border-radius: 50%; }
.avail-dot.green { background: var(--success); }
.avail-dot.yellow { background: var(--warning); }
.avail-dot.red { background: var(--error); }

/* ===== PRINT ===== */
@media print {
  body { background: white; color: black; }
  .sidebar, .topbar, .topbar-menu, .btn, .page-header-actions { display: none !important; }
  .main-wrapper { margin-left: 0; }
  .content { padding: 0; }
  .label-sheet { padding: 0; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: flex; }
  .main-wrapper { margin-left: 0; }
  .topbar-menu { display: flex; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .content { padding: 1rem; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .items-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .filter-bar { flex-direction: column; }
  .table-container { font-size: 0.8rem; }
}

@media (max-width: 380px) {
  .stat-grid { grid-template-columns: 1fr; }
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center; padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }
.empty-state h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--text); }

/* ===== TOOLTIP ===== */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--surface3); color: var(--text);
  padding: 0.3rem 0.6rem; border-radius: 4px; font-size: 0.72rem;
  white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity 0.15s;
  z-index: 200;
}
[data-tooltip]:hover::after { opacity: 1; }

/* ===== QUICK BOOKING PANEL ===== */
.quick-booking {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 480px;
  margin: 2rem auto;
  overflow: hidden;
}
.quick-booking-header {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  padding: 2rem;
  text-align: center;
  color: white;
}
.quick-booking-header h2 { font-size: 1.25rem; font-weight: 700; }
.quick-booking-body { padding: 1.5rem; }
