/* ===================== VARIABLES ===================== */
:root {
  --bg-dark: #0c0c18;
  --bg-main: #111126;
  --bg-card: #1a1a35;
  --bg-card-hover: #222250;
  --bg-input: #15152e;
  --sidebar-bg: #0e0e20;
  --accent: #c9a84c;
  --accent-hover: #dabb60;
  --accent-dim: rgba(201, 168, 76, 0.15);
  --text: #e8e8f0;
  --text-muted: #7878a0;
  --border: #2a2a50;
  --success: #4caf50;
  --warning: #ff9800;
  --danger: #e53935;
  --info: #42a5f5;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 20px rgba(0,0,0,0.3);
}

/* ===================== RESET ===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ===================== AUTH PAGES ===================== */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-dark) 0%, #0d0d24 50%, #14142a 100%);
}

.auth-container { width: 100%; max-width: 420px; padding: 20px; }

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow);
}

.auth-header { text-align: center; margin-bottom: 32px; }
.auth-icon { font-size: 48px; color: var(--accent); margin-bottom: 12px; }
.auth-header h1 { font-size: 28px; font-weight: 700; color: var(--accent); }
.auth-header p { color: var(--text-muted); margin-top: 4px; }

.auth-form { display: flex; flex-direction: column; gap: 16px; }

.auth-footer { text-align: center; margin-top: 24px; color: var(--text-muted); font-size: 14px; }

/* ===================== FORM ELEMENTS ===================== */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

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

input[type="text"], input[type="password"], input[type="email"], textarea, select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text);
  font-size: 15px;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  font-family: inherit;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
textarea { resize: vertical; }
select { cursor: pointer; }
select option { background: var(--bg-card); color: var(--text); }

.error-msg { color: var(--danger); font-size: 14px; min-height: 20px; }

/* ===================== BUTTONS ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  font-family: inherit;
}
.btn-primary { background: var(--accent); color: #111; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #c62828; }
.btn-small { padding: 6px 12px; font-size: 12px; }
.btn-full { width: 100%; }

.form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 16px; }

/* ===================== APP LAYOUT ===================== */
.app-layout { display: flex; height: 100vh; overflow: hidden; }

/* ===================== SIDEBAR ===================== */
.sidebar {
  width: 250px;
  min-width: 250px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-logo { font-size: 28px; color: var(--accent); }
.sidebar-header h2 { font-size: 20px; font-weight: 700; color: var(--accent); }

.sidebar-nav { list-style: none; padding: 12px 0; flex: 1; }
.sidebar-nav li { padding: 0 8px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  transition: all 0.2s;
  margin-bottom: 2px;
}
.nav-link:hover { background: var(--accent-dim); color: var(--text); }
.nav-link.active { background: var(--accent-dim); color: var(--accent); font-weight: 600; }
.nav-icon { font-size: 18px; width: 24px; text-align: center; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.user-info { font-size: 14px; color: var(--text-muted); }

/* ===================== MAIN CONTENT ===================== */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  background: var(--bg-main);
}

.page { display: none; }
.page.active { display: block; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h1 { font-size: 26px; font-weight: 700; }

/* ===================== STATS ===================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-number { font-size: 36px; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

/* ===================== FILTERS ===================== */
.filters {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.filters input, .filters select { max-width: 250px; }

/* ===================== CARDS ===================== */
.card-list { display: flex; flex-direction: column; gap: 12px; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
}
.card:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow); }

.card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.card-top h3 { font-size: 16px; font-weight: 600; }
.card-desc { font-size: 14px; color: var(--text-muted); margin-bottom: 8px; }
.card-meta { display: flex; gap: 16px; font-size: 13px; color: var(--text-muted); flex-wrap: wrap; }

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
  font-size: 15px;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ===================== BADGES ===================== */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-offen { background: rgba(66, 165, 245, 0.15); color: var(--info); }
.badge-in_bearbeitung { background: rgba(255, 152, 0, 0.15); color: var(--warning); }
.badge-abgeschlossen { background: rgba(76, 175, 80, 0.15); color: var(--success); }
.badge-info { background: var(--accent-dim); color: var(--accent); }

/* ===================== TAGS ===================== */
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.tag button { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 14px; padding: 0 2px; }
.tag-clickable { cursor: pointer; }
.tag-clickable:hover { background: rgba(201, 168, 76, 0.3); }
.tag-input-container { display: flex; flex-direction: column; gap: 8px; }

/* ===================== LAWS ===================== */
.laws-list { display: flex; flex-direction: column; gap: 12px; }

.law-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.law-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  transition: background 0.2s;
}
.law-header:hover { background: var(--bg-card-hover); }
.law-header h3 { font-size: 15px; font-weight: 600; }
.law-actions { display: flex; align-items: center; gap: 10px; }
.expand-icon { color: var(--text-muted); transition: transform 0.3s; font-size: 12px; }
.law-card.expanded .expand-icon { transform: rotate(180deg); }

.law-sections {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}
.law-card.expanded .law-sections {
  max-height: 10000px;
  border-top: 1px solid var(--border);
}

.law-section {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(42, 42, 80, 0.5);
}
.law-section:last-child { border-bottom: none; }
.law-section-header { font-weight: 600; color: var(--accent); margin-bottom: 6px; font-size: 14px; }
.law-section-text { font-size: 14px; color: var(--text-muted); line-height: 1.7; }

/* ===================== MODAL ===================== */
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); }
.modal-content {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}
.modal-header h2 { font-size: 18px; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 24px; cursor: pointer; padding: 4px; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; }

/* ===================== DETAIL VIEW ===================== */
.detail-view { display: flex; flex-direction: column; gap: 12px; }
.detail-row { display: flex; align-items: center; gap: 12px; }
.detail-label { font-weight: 600; color: var(--text-muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; min-width: 120px; }
.detail-section { margin-top: 8px; }
.detail-section p { margin-top: 6px; font-size: 14px; line-height: 1.7; }

.mini-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  margin-top: 6px;
  cursor: pointer;
  transition: background 0.2s;
}
.mini-card:hover { background: var(--bg-card-hover); }

.text-muted { color: var(--text-muted); }
.section { margin-top: 8px; }
.section h2 { font-size: 18px; margin-bottom: 16px; }

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
  .sidebar { width: 60px; min-width: 60px; }
  .sidebar-header h2, .nav-link span:not(.nav-icon), .sidebar-footer .user-info { display: none; }
  .sidebar-header { justify-content: center; padding: 16px 8px; }
  .nav-link { justify-content: center; padding: 12px; }
  .main-content { padding: 20px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
}
