﻿/* SlitProjektHub — minimal app CSS */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --color-bg: #0f172a;
  --color-surface: #1e293b;
  --color-surface-2: #2d3f55;
  --color-border: #334155;
  --color-text: #e2e8f0;
  --color-text-muted: #94a3b8;
  --color-primary: #3b82f6;
  --color-primary-hover: #2563eb;
  --color-danger: #ef4444;
  --color-danger-hover: #dc2626;
  --color-success: #22c55e;
  --color-warning: #f59e0b;
  --radius: 8px;
  --radius-lg: 12px;
  --transition: 150ms ease;
}

body {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14px;
  line-height: 1.6;
}

/* ── Layout ── */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-logo {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
  letter-spacing: -0.02em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: background var(--transition), color var(--transition);
}
.nav-item:hover { background: var(--color-surface-2); color: var(--color-text); }
.nav-item.active { background: rgba(59,130,246,.15); color: var(--color-primary); font-weight: 600; }

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  height: 52px;
  border-bottom: 1px solid var(--color-border);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-surface);
}

.topbar-title { font-size: 1rem; font-weight: 600; }

.content { padding: 1.5rem; overflow-y: auto; flex: 1; }

/* ── Card ── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform 60ms ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-secondary { background: var(--color-surface-2); color: var(--color-text); border-color: var(--color-border); }
.btn-secondary:hover { background: #3a4f68; }
.btn-danger { background: transparent; color: var(--color-danger); border-color: var(--color-danger); }
.btn-danger:hover { background: var(--color-danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--color-text-muted); border-color: transparent; }
.btn-ghost:hover { color: var(--color-text); background: var(--color-surface-2); }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; }
.btn-icon { padding: 0.4rem; border-radius: 6px; }

/* ── Table ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--color-border); }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--color-surface-2);
  padding: 0.65rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
}
tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255,255,255,.025); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(59,130,246,.15);
  color: #93c5fd;
  border: 1px solid rgba(59,130,246,.3);
}
.badge-neutral { background: rgba(148,163,184,.15); color: var(--color-text-muted); border-color: rgba(148,163,184,.3); }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-text-muted);
}
.empty-state svg { opacity: 0.3; margin-bottom: 0.75rem; }

/* ── Modal overlay (small confirmations only) ── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(3px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  width: 100%;
  max-width: 440px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.modal-title { font-size: 1rem; font-weight: 700; }

/* ── Drawer (Slide-Over) — for all create/edit forms ── */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(2px);
  z-index: 50;
}
.drawer {
  position: fixed;
  top: 0; right: 0;
  width: min(680px, 95vw);
  height: 100vh;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  box-shadow: -8px 0 32px rgba(0,0,0,.4);
  z-index: 51;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 280ms cubic-bezier(.25,.46,.45,.94);
}
.drawer.drawer-open { transform: translateX(0); }

.drawer-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}
.drawer-title { font-size: 1rem; font-weight: 700; }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  /* scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}
.drawer-body::-webkit-scrollbar { width: 6px; }
.drawer-body::-webkit-scrollbar-track { background: transparent; }
.drawer-body::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }

.drawer-footer {
  flex-shrink: 0;
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

/* Drawer 2-column layout for wide forms */
.drawer-cols {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  height: 100%;
}
.drawer-cols-meta { display: flex; flex-direction: column; gap: 0; }
.drawer-cols-editor { display: flex; flex-direction: column; }
.drawer-cols-editor .editor-fill {
  flex: 1;
  resize: none;
  min-height: calc(100vh - 220px);
}

/* Wider drawer for complex forms */
.drawer-wide {
  width: min(960px, 95vw);
}

@media (max-width: 700px) {
  .drawer { width: 100vw; }
  .drawer-cols { grid-template-columns: 1fr; }
  .drawer-cols-editor .editor-fill { min-height: 300px; }
}

/* ── Form ── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--color-text-muted); margin-bottom: 0.35rem; letter-spacing: .03em; text-transform: uppercase; }
.form-input, .form-textarea, .form-select {
  width: 100%;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.55rem 0.8rem;
  color: var(--color-text);
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition);
  font-family: inherit;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.form-textarea { resize: vertical; min-height: 90px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.form-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--color-border); }

/* ── Toast / feedback ── */
#toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 99; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  border-left: 3px solid;
  background: var(--color-surface);
  border-color: var(--color-success);
  color: var(--color-text);
  animation: slideIn 200ms ease, fadeOut 300ms ease 2.5s forwards;
  min-width: 240px;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.toast-error { border-color: var(--color-danger); }
@keyframes slideIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeOut { to { opacity: 0; pointer-events: none; } }

/* HTMX loading indicators */
.htmx-indicator { opacity: 0; transition: opacity 200ms ease; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* ── Confirm dialog inline ── */
.confirm-row td { background: rgba(239,68,68,.07) !important; }

/* ── Page header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.page-title { font-size: 1.25rem; font-weight: 700; }
.page-subtitle { font-size: 0.875rem; color: var(--color-text-muted); margin-top: 0.1rem; }

/* ── Utility ── */
.text-muted { color: var(--color-text-muted); }
.font-mono { font-family: ui-monospace, monospace; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 0.5rem; }
.gap-1 { gap: 0.25rem; }
.mt-1 { margin-top: 0.25rem; }
