/* ─── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Background layers */
  --bg:          #080c14;
  --bg-card:     #0d1220;
  --bg-col:      #0a0f1a;
  --bg-header:   #060912;

  /* Borders */
  --border:      #1c2538;
  --border-bright: #2a3650;

  /* Text */
  --text:        #c0cedf;
  --text-muted:  #4a5a72;
  --text-bright: #eef2fa;
  --text-dim:    #8899b2;

  /* Column accent colors */
  --col-backlog:   #4a5568;
  --col-analise:   #2563a8;
  --col-andamento: #c2620a;
  --col-revisao:   #7c3aed;
  --col-concluido: #16a34a;

  /* Priority */
  --priority-alta:  #f85149;
  --priority-media: #d29922;
  --priority-baixa: #3fb950;

  /* Typography */
  --font-ui:   'Rajdhani', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  /* Sizing */
  --card-radius: 6px;
  --col-min-width: 260px;
}

/* ─── Light Mode ─────────────────────────────────────────── */
[data-theme="light"] {
  --bg:          #f0f2f5;
  --bg-card:     #ffffff;
  --bg-col:      #f7f8fa;
  --bg-header:   #ffffff;

  --border:      #d8dce3;
  --border-bright: #bfc6d0;

  --text:        #3d4551;
  --text-muted:  #8893a2;
  --text-bright: #1a1f2b;
  --text-dim:    #5c6575;

  --col-backlog:   #6b7585;
  --col-analise:   #2563a8;
  --col-andamento: #c2620a;
  --col-revisao:   #7c3aed;
  --col-concluido: #16a34a;

  --priority-alta:  #dc3545;
  --priority-media: #c08a00;
  --priority-baixa: #198754;
}

[data-theme="light"] body {
  background-image:
    radial-gradient(circle at 20% 20%, #d0daf022 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, #e0d0f022 0%, transparent 50%),
    radial-gradient(circle, #d8dce312 1px, transparent 1px);
}

[data-theme="light"] .noise-overlay {
  opacity: 0.012;
}

[data-theme="light"] .card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: #bfc6d0;
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: #a0aab5;
}

html, body {
  height: 100%;
}

body {
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 20% 20%, #0d1f3c22 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, #1a0d3022 0%, transparent 50%),
    radial-gradient(circle, #1c253812 1px, transparent 1px);
  background-size: auto, auto, 28px 28px;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

/* Subtle noise texture overlay */
.noise-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

/* ─── Header ──────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  max-width: 100%;
}

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

.brand-mark {
  font-size: 18px;
  color: var(--col-andamento);
  opacity: 0.9;
  line-height: 1;
}

.project-name {
  font-family: var(--font-ui);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-bright);
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.meta-label {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.meta-value {
  color: var(--text-dim);
  font-weight: 500;
}

/* ─── Theme Toggle ────────────────────────────────────────── */
.theme-toggle {
  background: var(--border);
  border: 1px solid var(--border-bright);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  line-height: 1;
}

.theme-toggle:hover {
  background: var(--border-bright);
  color: var(--text-bright);
}

/* ─── Board Layout ────────────────────────────────────────── */
.board-wrapper {
  position: relative;
  z-index: 1;
  overflow-x: auto;
  padding: 28px;
  min-height: calc(100vh - 57px);
}

.kanban-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  min-width: calc(var(--col-min-width) * 5 + 16px * 4);
  align-items: start;
}

/* ─── Column ──────────────────────────────────────────────── */
.kanban-col {
  background: var(--bg-col);
  border: 1px solid var(--border);
  border-top: 3px solid var(--col-color, #4a5568);
  border-radius: var(--card-radius);
  min-width: var(--col-min-width);
  display: flex;
  flex-direction: column;
  animation: col-enter 0.4s ease both;
}

@keyframes col-enter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.kanban-col:nth-child(1) { animation-delay: 0.00s; }
.kanban-col:nth-child(2) { animation-delay: 0.06s; }
.kanban-col:nth-child(3) { animation-delay: 0.12s; }
.kanban-col:nth-child(4) { animation-delay: 0.18s; }
.kanban-col:nth-child(5) { animation-delay: 0.24s; }

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

.col-title {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--col-color, var(--text-muted));
}

.col-count {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--border);
  padding: 1px 7px;
  border-radius: 20px;
  min-width: 22px;
  text-align: center;
}

.col-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  flex: 1;
}

.col-cards:empty::after {
  content: 'Nenhuma demanda';
  display: block;
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 24px 0;
  opacity: 0.5;
}

/* ─── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--priority-color, var(--border));
  border-radius: var(--card-radius);
  padding: 14px;
  cursor: default;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  animation: card-enter 0.35s ease both;
}

@keyframes card-enter {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card:hover {
  border-color: var(--border-bright);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  transform: translateY(-1px);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.card-id {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.priority-badge {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--priority-color);
  border: 1px solid var(--priority-color);
  padding: 1px 7px;
  border-radius: 3px;
  opacity: 0.9;
}

.card-title {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-bright);
  line-height: 1.35;
  margin-bottom: 12px;
}

/* ─── Progress ────────────────────────────────────────────── */
.progress-wrap {
  margin-bottom: 4px;
}

.progress-track {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 4px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563a8, #3fb950);
  border-radius: 2px;
  transition: width 0.6s ease;
}

.progress-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* ─── Subtasks ────────────────────────────────────────────── */
.subtask-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}

.subtask {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.4;
  transition: color 0.2s;
}

.subtask.done {
  color: var(--text-muted);
  text-decoration: line-through;
  opacity: 0.55;
}

.subtask-check {
  font-family: var(--font-mono);
  font-size: 10px;
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--text-muted);
  line-height: 1.4;
}

.subtask.done .subtask-check {
  color: var(--priority-baixa);
}

/* ─── Expand / Description ────────────────────────────────── */
.expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 3px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  margin-top: 2px;
  width: 100%;
  justify-content: center;
}

.expand-btn::after {
  content: '▾';
  font-size: 12px;
  transition: transform 0.25s ease;
  display: inline-block;
}

.expand-btn[aria-expanded="true"]::after {
  transform: rotate(180deg);
}

.expand-btn:hover {
  border-color: var(--border-bright);
  color: var(--text);
  background: var(--border);
}

.card-description {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease, opacity 0.3s ease, margin-top 0.3s ease;
  opacity: 0;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
  margin-top: 0;
  border-top: 1px solid transparent;
}

.card-description.open {
  max-height: 200px;
  opacity: 1;
  margin-top: 10px;
  padding-top: 10px;
  border-top-color: var(--border);
}

/* ─── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border-bright);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #3a4d68;
}

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .board-wrapper {
    padding: 16px;
  }

  .kanban-grid {
    grid-template-columns: repeat(5, var(--col-min-width));
  }

  .header-inner {
    padding: 12px 16px;
  }

  .project-name {
    font-size: 15px;
  }
}
