/* ===== Kanban custom styles – built on PicoCSS ===== */

/* --- Layout --------------------------------------------------- */

.login-card {
  max-width: 400px;
  margin: 4rem auto;
}

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

.col-stats {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-top: -0.5rem;
}

.board-actions {
  align-items: stretch;
}

.board-actions form {
  margin-bottom: 0;
}

.board-actions form button {
  width: 100%;
  height: 100%;
  margin-bottom: 0;
}

.board-actions a[role="button"] {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0;
}

.board-header {
  margin-bottom: 1rem;
}

.board-toolbar {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.board-toolbar .search-inline {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  min-width: 200px;
  margin-bottom: 0;
}

.board-toolbar .search-inline input {
  margin-bottom: 0;
}

.board-toolbar .search-inline button {
  white-space: nowrap;
  margin-bottom: 0;
}

/* --- Kanban board --------------------------------------------- */

.kanban-board {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  min-height: 60vh;
}

.kanban-column {
  min-width: 280px;
  max-width: 340px;
  flex: 1 0 280px;
  display: flex;
  flex-direction: column;
  background: var(--pico-card-background-color);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  padding: 0.75rem;
}

.kanban-column-header {
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--pico-primary);
}

.kanban-column-header summary {
  cursor: pointer;
  list-style: none;
}

.kanban-column-header details[open] {
  margin-bottom: 0.5rem;
}

.kanban-column-header details form {
  margin-top: 0.5rem;
}

.kanban-cards {
  flex: 1;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* --- Cards ---------------------------------------------------- */

.kanban-card {
  padding: 0.75rem;
  margin: 0;
  border-left: 4px solid var(--pico-muted-border-color);
  cursor: grab;
  transition: box-shadow 0.15s ease, opacity 0.15s ease;
  font-size: 0.9rem;
}

.kanban-card:active {
  cursor: grabbing;
}

.kanban-card.sortable-ghost {
  opacity: 0.4;
}

.kanban-card.sortable-chosen {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Priority colours */
.kanban-card.priority-high {
  border-left-color: #e53e3e;
}
.kanban-card.priority-medium {
  border-left-color: #d69e2e;
}
.kanban-card.priority-low {
  border-left-color: #38a169;
}

/* Deadline status */
.kanban-card.deadline-overdue {
  background: color-mix(in srgb, var(--pico-card-background-color) 90%, #e53e3e);
}
.kanban-card.deadline-soon {
  background: color-mix(in srgb, var(--pico-card-background-color) 90%, #d69e2e);
}

/* Pinned cards */
.kanban-card.pinned {
  border-left-color: var(--pico-primary);
  border-left-width: 4px;
  background: color-mix(in srgb, var(--pico-card-background-color) 92%, var(--pico-primary));
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.kanban-card.pinned .card-link {
  color: var(--pico-primary);
}

.pin-icon {
  font-size: 0.85em;
}

.card-link {
  text-decoration: none;
  color: var(--pico-color);
}

.card-link:hover {
  text-decoration: underline;
}

.card-desc {
  margin-top: 0.4rem;
  max-height: 4.5em;
  overflow: hidden;
  font-size: 0.85rem;
  opacity: 0.8;
}

.card-desc p {
  margin: 0;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.5rem;
  padding: 0;
  background: none;
  border: none;
}

/* --- Badges --------------------------------------------------- */

.badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.1em 0.5em;
  border-radius: 999px;
  background: var(--pico-muted-border-color);
  color: var(--pico-color);
  white-space: nowrap;
}

.badge.high {
  background: #e53e3e;
  color: #fff;
}

.badge.low {
  background: #38a169;
  color: #fff;
}

.badge.overdue {
  background: #e53e3e;
  color: #fff;
}

.badge.soon {
  background: #d69e2e;
  color: #fff;
}

/* --- Tags ----------------------------------------------------- */

.tag {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.1em 0.4em;
  border-radius: var(--pico-border-radius);
  background: var(--pico-primary-focus);
  color: var(--pico-primary);
  text-decoration: none;
}

.tag:hover {
  background: var(--pico-primary);
  color: var(--pico-primary-inverse);
}

.tag.active {
  background: var(--pico-primary);
  color: var(--pico-primary-inverse);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.5rem 0;
}

.tag-filter-dropdown {
  margin-bottom: 0;
}

/* --- New card form -------------------------------------------- */

.new-card-form {
  margin-top: 0.5rem;
}

.new-card-form summary {
  font-size: 0.85rem;
}

.new-card-form form {
  margin-top: 0.5rem;
}

/* --- Show more link ------------------------------------------- */

.show-more {
  display: block;
  text-align: center;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

/* --- Card detail ---------------------------------------------- */

.card-detail-grid {
  align-items: flex-start;
}

.card-detail-grid > article {
  min-width: 0;
}

.card-detail-grid > aside {
  min-width: 280px;
}

.rendered-markdown {
  line-height: 1.7;
}

.rendered-markdown pre {
  overflow-x: auto;
}

.rendered-markdown img {
  max-width: 100%;
}

/* --- Activity log --------------------------------------------- */

.activity-log {
  max-height: 400px;
  overflow-y: auto;
}

.activity-entry {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--pico-muted-border-color);
}

.activity-entry:last-child {
  border-bottom: none;
}

.activity-time {
  opacity: 0.6;
}

.activity-action {
  font-weight: 600;
  text-transform: capitalize;
}

/* --- Theme toggle --------------------------------------------- */

.theme-toggle {
  padding: 0.3rem 0.6rem;
  font-size: 1.1rem;
  line-height: 1;
  border: none;
}

[data-theme="light"] .icon-dark { display: none; }
[data-theme="dark"] .icon-light { display: none; }

/* --- Flash messages ------------------------------------------- */

[role="alert"],
.flash-error,
.flash-info {
  padding: 0.75rem 1rem;
  border-radius: var(--pico-border-radius);
  margin-bottom: 1rem;
}

.flash-error {
  background: color-mix(in srgb, var(--pico-card-background-color) 85%, #e53e3e);
  border-left: 4px solid #e53e3e;
}

.flash-info {
  background: color-mix(in srgb, var(--pico-card-background-color) 85%, #3182ce);
  border-left: 4px solid #3182ce;
}

/* --- Small button utility ------------------------------------- */

.small {
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
}

/* --- Responsive ----------------------------------------------- */

@media (max-width: 768px) {
  .kanban-board {
    flex-direction: column;
  }
  .kanban-column {
    min-width: 100%;
    max-width: 100%;
  }
  .card-detail-grid {
    display: flex;
    flex-direction: column;
  }
}

/* --- Breadcrumb ----------------------------------------------- */

nav[aria-label="breadcrumb"] ul {
  display: flex;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  font-size: 0.9rem;
}

nav[aria-label="breadcrumb"] li:not(:last-child)::after {
  content: " ›";
  margin-left: 0.5rem;
  opacity: 0.5;
}

/* --- Footer --------------------------------------------------- */

footer.container-fluid {
  padding: 1rem;
  text-align: center;
  opacity: 0.6;
}

kbd {
  display: inline-block;
  padding: 0.2em 0.5em;
  font-size: 0.8rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  border: 1px solid var(--pico-muted-border-color);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--pico-muted-border-color);
  color: var(--pico-color);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15);
  line-height: 1.4;
}
