/* ============================================================
   Aufgaben-Tool – Aussehen. Hier darfst du gern experimentieren.
   ============================================================ */

:root {
  --blue:   #2e8bd0;
  --blue-d: #246fa6;
  --bg:     #f4f6f9;
  --card:   #ffffff;
  --text:   #2b2f36;
  --muted:  #8a929c;
  --border: #e2e6ec;
  --red:    #d9534f;
  --green:  #4caf50;
  --orange: #e8920c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

/* Kopfleiste */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: #383d44;                 /* dunkelgrau statt blau */
  color: #fff;
  padding: 12px 20px;
}
.topbar .brand { font-size: 20px; font-weight: 700; display: flex; align-items: baseline; flex-wrap: wrap; }
.topbar .brand-co  { font-weight: 600; opacity: .8; }
.topbar .brand-sep { opacity: .55; margin: 0 8px; }
.topbar .brand-app { font-weight: 800; letter-spacing: .5px; }
.topbar nav { display: flex; align-items: center; gap: 18px; }
.topbar nav a { color: #fff; text-decoration: none; opacity: .92; }
.topbar nav a:hover { opacity: 1; text-decoration: underline; }
.topbar .user { opacity: .85; font-size: 14px; }
.topbar .logout { font-weight: 600; }

.container { max-width: 760px; margin: 28px auto; padding: 0 16px; }
.narrow { max-width: 420px; margin: 0 auto; }

h1 { font-size: 24px; margin: 0 0 18px; }
h2 { font-size: 17px; margin: 28px 0 10px; }

/* Karten / Formulare */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 20px;
}
.row { display: flex; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.row > input[type="text"] { flex: 1 1 220px; }

input[type="text"], input[type="password"], input[type="date"], textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 15px;
  font-family: inherit;
}
textarea { resize: vertical; }
label { display: block; margin-bottom: 12px; font-size: 14px; color: #444; }
label input { margin-top: 5px; }
label.inline { display: flex; align-items: center; gap: 8px; margin: 6px 0 12px; }
label.inline input { margin: 0; width: auto; }

button {
  background: var(--blue);
  color: #fff; border: 0;
  padding: 9px 16px;
  border-radius: 7px;
  font-size: 15px; cursor: pointer;
}
button:hover { background: var(--blue-d); }

.btn-secondary {
  display: inline-block; padding: 9px 16px;
  background: #eef1f5; color: #444; border-radius: 7px;
  text-decoration: none;
}
.btn-small {
  display: inline-block; padding: 5px 10px; font-size: 13px;
  background: #eef1f5; color: #444; border: 0; border-radius: 6px;
  text-decoration: none; cursor: pointer;
}
.btn-small:hover { background: #e2e6ec; }
.btn-small.danger, button.danger { background: #fbe9e8; color: var(--red); }
.btn-small.danger:hover, button.danger:hover { background: #f6d6d4; }

/* Meldungen */
.error { background: #fbe9e8; color: var(--red); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.ok    { background: #e7f6e8; color: #2e7d32; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.warn  { color: var(--orange); }
.empty { color: var(--muted); text-align: center; padding: 30px 0; }
.muted { color: var(--muted); font-size: 13px; }

/* Aufgabenliste */
.tasks { list-style: none; padding: 0; margin: 0; }
.task {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.task .check {
  background: none; color: var(--blue);
  font-size: 22px; line-height: 1; padding: 0; margin-top: 2px;
}
.task .check:hover { background: none; color: var(--blue-d); }
.task-main { flex: 1; min-width: 0; }
.task-title { font-size: 16px; font-weight: 600; }
.task-notes { color: #555; font-size: 14px; margin-top: 3px; }
.task-meta { margin-top: 6px; font-size: 13px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; }
.task-meta .due.overdue { color: var(--red); font-weight: 600; }
.task-meta .due.soon { color: var(--orange); font-weight: 600; }
.task-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }

/* Erledigte Aufgaben abgeschwächt */
.task.done { opacity: .6; }
.task.done .task-title { text-decoration: line-through; }

/* Benutzer-Tabelle */
table.users { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
table.users th, table.users td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
table.users th { background: #f7f9fb; font-weight: 600; }
.row-inline { display: flex; gap: 6px; }
.row-inline input { width: auto; flex: 1; }

.task-meta .recur { color: var(--blue-d); }
.comments-link { color: var(--blue); text-decoration: none; }
.comments-link:hover { text-decoration: underline; }

select {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
}

/* Kommentar-Verlauf */
.comments { list-style: none; padding: 0; margin: 0 0 20px; }
.comment {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.comment-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 5px; }
.comment-head .muted { font-size: 12px; }
.comment-body { white-space: pre-wrap; }
.comment-actions { display: flex; gap: 8px; margin-top: 8px; }
.comment-edit textarea { margin-bottom: 8px; }

.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 0; }

/* ============================================================
   Kanban-Board
   ============================================================ */
/* Board nutzt die komplette Seitenbreite */
.container.wide { max-width: none; padding: 0 24px; }

/* Notizfeld im Anlege-Formular höher */
.task-form textarea { min-height: 144px; }

/* Gesamtlayout: feste erste Spalte + scrollbarer Rest daneben */
.board-layout {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.board {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  overflow-x: auto;            /* bei vielen Spalten seitlich scrollen */
  padding-bottom: 14px;
  flex: 1 1 auto;             /* nimmt den Platz neben der ersten Spalte ein */
  min-width: 0;              /* erlaubt das seitliche Scrollen */
}

.column {
  flex: 0 0 300px;             /* feste Spaltenbreite */
  background: #eef1f5;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
}
.column.done-col { background: #eaf3ea; }

/* Erste Spalte: „Neue Aufgabe“ – breiter und dezent abgesetzt */
/* Linke Seite (Neue Aufgabe + Notizzettel) als Einheit, läuft beim Scrollen mit */
.left-col {
  flex: 0 0 600px;                    /* Breite der linken Seite */
  display: flex; flex-direction: column; gap: 16px;
  position: sticky; top: 16px; align-self: flex-start;
}
.left-col .column { flex: 0 0 auto; width: 100%; }   /* natürliche Höhe, volle Breite */

.add-column {
  background: #f1f3f6;
  border: 1px dashed #cdd4dc;         /* zurückhaltend abgesetzt */
}

/* Notizzettel: eigener, klar abgesetzter Block (Notizblock-Optik) */
.scratch-column {
  background: #fdf9e7;                /* warmes Gelb – hebt sich vom Formular ab */
  border: 1px solid #ece3b8;
}
.scratch-status { font-size: 12px; font-weight: 500; color: var(--muted); }
.add-column .column-name { color: var(--muted); font-weight: 600; }
.add-column .task-form {
  display: flex; flex-direction: column; gap: 11px;
  padding: 2px 4px 6px;
}
.add-column .task-form .field { margin: 0; font-size: 13px; color: var(--muted); }
.add-column .task-form .field input,
.add-column .task-form .field select { margin-top: 4px; }
.add-column .task-form input,
.add-column .task-form select,
.add-column .task-form textarea { width: 100%; background: #fff; }
.add-actions { display: flex; gap: 10px; align-items: center; margin-top: 2px; }

/* Gemeinsamer Notizzettel unter der „Neue Aufgabe“-Spalte */
.scratchpad { margin-top: 16px; padding-top: 14px; border-top: 1px dashed #cdd4dc; }
.scratch-head { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.scratch-area { width: 100%; min-height: 220px; background: #fff; margin-bottom: 10px; }

/* Sekundär-Knopf (z. B. „Leeren“) beim Überfahren nicht blau werden lassen */
.btn-secondary:hover { background: #e2e6ec; color: #444; }

.column-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 6px 10px;
  font-weight: 700;
}
.column-name { font-size: 15px; }
.column-count {
  background: #dfe4ea; color: #5a626c;
  border-radius: 20px; padding: 1px 9px; font-size: 13px; font-weight: 600;
}
.done-col .column-count { background: #cfe6cf; color: #2e7d32; }

.column-body { display: flex; flex-direction: column; }

.card-task {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 11px;
  margin-bottom: 9px;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.card-top { display: flex; align-items: flex-start; gap: 8px; padding-top: 5px; }
.card-top .check {
  background: none; color: var(--blue);
  font-size: 19px; line-height: 1; padding: 0; margin-top: 1px;
}
.card-top .check:hover { background: none; color: var(--blue-d); }
.card-title { font-size: 17px; font-weight: 700; color: var(--text); line-height: 1.3; flex: 1; min-width: 0; word-wrap: break-word; }

.card-notes { color: #555; font-size: 13px; margin: 5px 0 0 27px; white-space: pre-wrap; }

/* Automatisch erkannte Links (in Titel, Notizen, Kommentaren) */
.card-title a, .card-notes a, .task-notes a, .comment-body a {
  color: var(--blue);
  overflow-wrap: anywhere;      /* lange URLs brechen sauber um */
}
.card-meta {
  margin: 7px 0 0 27px; font-size: 12.5px; color: var(--muted);
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
}
/* Datum standardmäßig hellgrau hinterlegt … */
.card-meta .due {
  color: #5a626c; background: #e6eaef;
  padding: 1px 7px; border-radius: 5px;
}
/* … überfällig rot, heute orange (überschreiben die graue Basis) */
.card-meta .due.overdue {
  color: #fff; background: var(--red); font-weight: 600;
  padding: 1px 7px; border-radius: 5px;
}
.card-meta .due.soon {
  color: #fff; background: var(--orange); font-weight: 600;
  padding: 1px 7px; border-radius: 5px;
}
.card-meta .recur { color: var(--blue-d); }

.card-actions {
  margin: 9px 0 0 27px;
  display: flex; gap: 4px; align-items: center; flex-wrap: wrap;
  opacity: .5; transition: opacity .15s;      /* dezent – tritt beim Überfahren hervor */
}
.card-task:hover .card-actions { opacity: 1; }

/* Formulare in der Aktionszeile nicht als eigene Zeile/Rand behandeln */
.card-actions form { margin: 0; display: inline-flex; align-items: center; }

/* Bearbeiten / Löschen: blass und ohne Kasten, erst beim Überfahren betont.
   Gleiche Höhe + Zeilenhöhe -> Text sitzt exakt auf einer Linie. */
.card-actions .btn-small {
  background: transparent; color: var(--muted);
  padding: 3px 6px; font-size: 12px;
  line-height: 18px; height: 24px;
  display: inline-flex; align-items: center;
}
.card-actions .btn-small:hover { background: #eef1f5; color: var(--text); }
.card-actions .btn-small.danger { background: transparent; color: var(--muted); }
.card-actions .btn-small.danger:hover { background: #fbe9e8; color: var(--red); }

/* Kategorie-Dropdown: fast unsichtbar, bis man es anfasst */
.card-actions .move select {
  padding: 3px 5px; font-size: 12px; border-radius: 6px; max-width: 150px;
  border-color: transparent; background: transparent; color: var(--muted);
}
.card-actions .move select:hover,
.card-actions .move select:focus { border-color: var(--border); background: #fff; color: var(--text); }

/* Erledigte Karten abgeschwächt */
.card-task.done { opacity: .62; }
.card-task.done .card-title { text-decoration: line-through; }

.column-add {
  display: block; text-align: left;
  margin-top: 2px; padding: 8px 6px;
  color: var(--muted); text-decoration: none; font-size: 14px;
  border-radius: 7px;
}
.column-add:hover { background: #e2e6ec; color: var(--text); }
.done-more { margin: 4px 6px; font-size: 12px; }

/* Board-Formular: Auswahl-Felder etwas kompakter */
.task-form .row select { flex: 0 0 auto; }

/* Auf schmalen Bildschirmen: Spalten untereinander statt scrollen */
@media (max-width: 700px) {
  .board-layout { flex-direction: column; }
  .board { flex-direction: column; }
  .column { flex: 1 1 auto; width: 100%; }
  .left-col { position: static; flex: 1 1 auto; width: 100%; }
}
