/* ── BeOne Design System ── */
/* Based on Lobster Board / LifeOS: Lexend, Light/Dark, Glassmorphism */

@font-face {
  font-family: 'Lexend';
  src: url('/static/lexend-variable.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

/* ── Dark Theme (Default) ── */
:root, :root.dark-theme {
  --bg: #16181c;
  --surface: #1a1d22;
  --surface2: #21252b;
  --border: #2d3139;
  --border-strong: #3a3f48;
  --text: #e0e4ea;
  --text-secondary: #8a90a0;
  --text-muted: #5a6070;
  --accent: #e5484d;
  --accent-dark: #d13438;
  --accent-light: rgba(229,72,77,0.12);
  --accent-bg: rgba(229,72,77,0.06);
  --success: #22c55e;
  --warning: #eab308;
  --radius: 10px;
  --radius-sm: 8px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.12);
  --shadow: 0 2px 8px rgba(0,0,0,0.25), 0 1px 3px rgba(0,0,0,0.15);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.15);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.35), 0 4px 8px rgba(0,0,0,0.15);
  --transition: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Lexend', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Light Theme ── */
:root.light-theme {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface2: #eef1f5;
  --border: #d8dce3;
  --border-strong: #c0c6d0;
  --text: #1a1d24;
  --text-secondary: #5a6070;
  --text-muted: #8a90a0;
  --accent: #e5484d;
  --accent-dark: #c93c40;
  --accent-light: rgba(229,72,77,0.08);
  --accent-bg: rgba(229,72,77,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 2px 8px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.05);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.05);
}

/* ── Reset + Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  transition: background-color 0.3s, color 0.3s;
}

/* ── Navigation ── */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  height: 56px;
  padding: 0 20px;
  background: rgba(26, 29, 34, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
:root.light-theme .top-nav {
  background: rgba(255, 255, 255, 0.92);
}
.nav-left { display: flex; align-items: center; }
.nav-center { display: flex; justify-content: center; }
.nav-right { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.nav-brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.nav-user {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 10px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ── Tab Bar ── */
.tab-bar { display: flex; gap: 0; }
.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  height: 56px;
  padding: 0 16px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--transition), border-color var(--transition);
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* ── Tab Content ── */
.tab-content { display: none; }
.tab-content.active { display: block; }
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text);
}

/* ── Buttons ── */
.btn {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-primary:active { transform: scale(0.98); }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--surface2); border-color: var(--border-strong); }
.btn-danger {
  background: transparent;
  color: var(--accent);
  border-color: rgba(229,72,77,0.35);
}
.btn-danger:hover { background: var(--accent-light); }
.btn-sm { font-size: 12px; padding: 5px 10px; }

.btn-icon {
  font-family: var(--font);
  font-size: 15px;
  padding: 8px 12px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  text-decoration: none;
}
.btn-icon:hover { background: var(--surface2); border-color: var(--border-strong); }

/* ── Inputs ── */
.input {
  font-family: var(--font);
  font-size: 13px;
  padding: 9px 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition);
  width: 100%;
}
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(229,72,77,0.15);
}
.textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.select { cursor: pointer; }
.input-file { font-size: 12px; }

/* ── Login Page ── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.login-brand {
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 28px;
  letter-spacing: -0.03em;
}
.login-card input[type="password"] {
  font-family: var(--font);
  font-size: 20px;
  text-align: center;
  padding: 14px 20px;
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: var(--radius-xl);
  transition: border-color var(--transition), box-shadow var(--transition);
  letter-spacing: 0.15em;
}
.login-card input[type="password"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(229,72,77,0.15);
}
.login-card input[type="password"]::placeholder {
  font-size: 14px;
  letter-spacing: 0;
  color: var(--text-muted);
}
.login-error {
  margin-top: 12px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
}
.theme-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  font-size: 16px;
  padding: 10px 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: all var(--transition);
}
.theme-toggle:hover { background: var(--surface2); }

/* ── Shake Animation ── */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}
.shake { animation: shake 0.4s ease; }

/* ── Blog Posts ── */
.post-card { }
.post-header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.post-title { font-size: 17px; font-weight: 600; line-height: 1.3; }
.post-date { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.post-body { font-size: 14px; line-height: 1.6; color: var(--text-secondary); }
.post-actions { margin-top: 12px; display: flex; gap: 8px; }

.editor-card { border-left: 3px solid var(--accent); }
.editor-card h3 { color: var(--accent); font-size: 14px; }
.editor-card .input { margin-bottom: 10px; }
.editor-actions { display: flex; gap: 8px; }

/* ── Tools ── */
.tool-card { }
.tool-header { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.tool-icon { font-size: 36px; line-height: 1; }
.tool-title { font-size: 17px; font-weight: 600; margin-bottom: 2px; }
.tool-subtitle { font-size: 13px; color: var(--text-muted); }
.tool-desc { font-size: 14px; line-height: 1.6; color: var(--text-secondary); margin-bottom: 14px; }
.tool-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.tool-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.tool-badge {
  font-size: 11px; font-weight: 600;
  padding: 2px 10px;
  background: var(--surface2);
  color: var(--text-secondary);
  border-radius: 99px;
  border: 1px solid var(--border);
}
.tool-badge-pw {
  background: var(--accent-light);
  color: var(--accent);
  border-color: rgba(229,72,77,0.35);
  font-weight: 700;
}
.tool-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.tool-hint code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  background: var(--surface2);
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--text);
  border: 1px solid var(--border);
}

/* ── Fragebogen ── */
.cat-card {}
.cat-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.cat-header h3 { margin-bottom: 0; }
.pdf-list { display: flex; flex-direction: column; gap: 4px; }
.pdf-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.pdf-item:hover { background: var(--surface2); }
.pdf-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  flex: 1;
}
.pdf-link:hover { color: var(--accent); }
.pdf-icon { font-size: 18px; }
.pdf-size { font-size: 11px; color: var(--text-muted); margin-left: auto; }

.upload-row, .cat-row, .user-create-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.upload-row .input, .upload-row .select { flex: 1; min-width: 120px; }
.cat-row .input { flex: 1; }
.user-create-row .input { flex: 1; min-width: 100px; }

/* ── Data Tables ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}
.data-table tr:hover td { background: var(--surface2); }

/* ── Badges ── */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
}
.badge-admin { background: var(--accent-light); color: var(--accent); }
.badge-user { background: var(--surface2); color: var(--text-secondary); }

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state h2 { font-size: 18px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 14px; }

/* ── Utilities ── */
.text-muted { color: var(--text-muted); font-size: 13px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .top-nav {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 56px auto;
    height: auto;
    padding: 0 12px;
  }
  .nav-left { grid-column: 1; grid-row: 1; }
  .nav-right { grid-column: 2; grid-row: 1; }
  .nav-center {
    grid-column: 1 / -1;
    grid-row: 2;
    border-top: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .nav-center::-webkit-scrollbar { display: none; }
  .tab-bar { width: max-content; margin: 0 auto; }
  .tab-btn { height: 44px; padding: 0 14px; font-size: 13px; white-space: nowrap; }
  .container { padding: 16px 12px; }
  .login-card { padding: 28px 24px; }
  .post-header { flex-direction: column; gap: 4px; }
  .upload-row, .user-create-row { flex-direction: column; }
  .nav-user { display: none; }
  .card { padding: 16px; }
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 6px 8px; }
}
