/* ─── Reset & Base ────────────────────────────────────── */

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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-hover: #222633;
  --border: #2a2e3b;
  --text: #e4e6ed;
  --text-muted: #8b8fa3;
  --primary: #6366f1;
  --primary-hover: #5457e5;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --green: #22c55e;
  --yellow: #eab308;
  --red: #ef4444;
  --blue: #3b82f6;
  --radius: 8px;
  --radius-sm: 4px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: var(--primary);
  text-decoration: none;
}

/* ─── Buttons ─────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 13px;
}

/* ─── Forms ───────────────────────────────────────────── */

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
  margin-top: 12px;
}

input[type="text"],
input[type="password"],
input[type="date"],
textarea,
select {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
}

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

/* ─── Alerts ──────────────────────────────────────────── */

.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
}

.alert-error {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ─── Header ──────────────────────────────────────────── */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.app-header .logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.app-header nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-name {
  font-size: 14px;
  color: var(--text-muted);
}

/* ─── Login ───────────────────────────────────────────── */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 380px;
}

.login-card h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}

.login-subtitle {
  color: var(--text-muted);
  margin-bottom: 24px;
}

.login-card .btn {
  width: 100%;
  justify-content: center;
  margin-top: 20px;
  padding: 10px;
}

/* ─── Container ───────────────────────────────────────── */

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* ─── Boards List ─────────────────────────────────────── */

.boards-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.boards-header h1 {
  font-size: 24px;
}

.boards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.board-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.15s, background 0.15s;
}

.board-card:hover {
  border-color: var(--primary);
  background: var(--surface-hover);
}

.board-card h2 {
  font-size: 17px;
  color: var(--text);
  margin-bottom: 6px;
}

.board-card p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.board-meta {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
}

.empty-state {
  color: var(--text-muted);
  font-size: 15px;
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 0;
}

/* ─── Board / Kanban ──────────────────────────────────── */

.board-page {
  height: calc(100vh - 57px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.board-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  flex-shrink: 0;
}

.board-title {
  font-size: 20px;
  font-weight: 600;
  flex: 1;
  outline: none;
  border-radius: var(--radius-sm);
  padding: 2px 6px;
}

.board-title:focus {
  background: var(--surface);
}

.kanban {
  display: flex;
  gap: 16px;
  padding: 0 24px 24px;
  overflow-x: auto;
  flex: 1;
  align-items: flex-start;
}

.kanban-column {
  min-width: 280px;
  max-width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: 100%;
  flex-shrink: 0;
}

.column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.column-name {
  font-weight: 600;
  font-size: 14px;
}

.column-count {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 10px;
}

.task-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  min-height: 40px;
}

/* ─── Task Cards ──────────────────────────────────────── */

.task-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 6px;
  cursor: grab;
  transition: border-color 0.15s;
  border-left: 3px solid transparent;
}

.task-card:hover {
  border-color: var(--primary);
}

.task-card.priority-high {
  border-left-color: var(--red);
}

.task-card.priority-medium {
  border-left-color: var(--yellow);
}

.task-card.priority-low {
  border-left-color: var(--green);
}

.task-card-title {
  font-size: 14px;
  font-weight: 500;
}

.task-card-meta {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.task-ghost {
  opacity: 0.4;
}

.task-drag {
  opacity: 0.9;
}

/* ─── Quick Add ───────────────────────────────────────── */

.quick-add {
  padding: 8px;
  border-top: 1px solid var(--border);
}

.quick-add-input {
  background: transparent;
  border: 1px dashed var(--border);
  padding: 6px 10px;
  font-size: 13px;
}

.quick-add-input::placeholder {
  color: var(--text-muted);
}

/* ─── Modal ───────────────────────────────────────────── */

dialog.modal {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  max-width: 480px;
  width: 90vw;
}

dialog.modal::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.modal-content {
  padding: 24px;
}

.modal-content h2 {
  font-size: 18px;
  margin-bottom: 4px;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
}

.modal-actions .spacer {
  flex: 1;
}

/* ─── Responsive ──────────────────────────────────────── */

@media (max-width: 640px) {
  .kanban-column {
    min-width: 260px;
  }

  .board-toolbar {
    padding: 10px 16px;
  }

  .kanban {
    padding: 0 16px 16px;
  }

  .container {
    padding: 20px 16px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}
