/*
 * Yönetim aracı — tüm stiller (BEM).
 * Baskı rengi: elemanlara JS ile yazılan --p (0–1) değerinden türetilir;
 * 0 = sakin lavanta, 0.5 = pembe, 1 = kırmızı. Taban mobil, 900px üstü masaüstü.
 */

:root {
  --ink: #2f2b3a;
  --ink-soft: #7d7890;
  --ink-faint: #b3afc2;
  --surface: #ffffff;
  --canvas: #f4f2f9;
  --line: #e8e5f1;
  --accent: #8e7cc3;
  --accent-soft: #efebfa;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(60 50 100 / 6%), 0 6px 18px rgb(60 50 100 / 5%);
  --font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Baskı renkleri ---------- */

.has-pressure {
  --p: 0;
  --hue: calc(295 + 90 * var(--p));
  --pressure-color: oklch(calc(0.6 - 0.03 * var(--p)) calc(0.12 + 0.11 * var(--p)) var(--hue));
  --pressure-tint: oklch(calc(0.995 - 0.05 * var(--p)) calc(0.003 + 0.045 * var(--p)) var(--hue));
  --pressure-line: oklch(calc(0.93 - 0.09 * var(--p)) calc(0.015 + 0.085 * var(--p)) var(--hue));
}

.dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pressure-color);
}

/* ---------- Sidebar ---------- */

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 24px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.sidebar__title {
  margin: 0 8px 14px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.sidebar__home,
.brand__toggle,
.project {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 10px;
  text-align: left;
  transition: background-color 0.15s;
}

.sidebar__home:hover,
.brand__toggle:hover,
.project:hover {
  background: var(--canvas);
}

.sidebar__home {
  justify-content: space-between;
  font-weight: 600;
}

.sidebar__home.is-active,
.project.is-active {
  background: var(--accent-soft);
  color: #5b4a99;
}

.sidebar__count,
.project__count {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}

.sidebar__label {
  margin: 18px 10px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.sidebar__brands {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar__logout {
  margin-top: auto;
  padding: 16px 10px 0;
}

.brand__header {
  display: flex;
  align-items: center;
}

.brand__toggle {
  flex: 1;
  min-width: 0;
  font-weight: 600;
}

.brand__chevron {
  flex: none;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--ink-faint);
  border-bottom: 2px solid var(--ink-faint);
  transform: rotate(-45deg);
  transition: transform 0.15s;
}

.brand.is-open .brand__chevron {
  transform: rotate(45deg);
}

.brand__name,
.project__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand__delete {
  flex: none;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: 8px;
  font-size: 16px;
  color: var(--ink-faint);
  opacity: 0;
  transition: opacity 0.15s;
}

.brand__header:hover .brand__delete,
.brand__delete:focus-visible,
.brand__delete.is-armed {
  opacity: 1;
}

.brand__delete:hover {
  color: var(--ink);
  background: var(--canvas);
}

.brand__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 2px 0 8px 13px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}

.is-armed {
  font-size: 12px;
  font-weight: 600;
  color: #c2334d;
}

.brand__delete.is-armed {
  font-size: 12px;
  color: #c2334d;
}

.add-inline {
  display: flex;
  align-items: center;
  margin-top: 4px;
  border-radius: 10px;
  background: var(--canvas);
}

.add-inline--nested {
  background: none;
}

.add-inline__input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: none;
}

.add-inline__input::placeholder,
.task-add__title::placeholder {
  color: var(--ink-faint);
}

.add-inline__submit {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 18px;
  color: var(--ink-faint);
}

.add-inline__submit:hover {
  color: var(--accent);
}

.text-button {
  font-size: 13px;
  color: var(--ink-soft);
}

.text-button:hover {
  color: var(--ink);
}

/* ---------- Pano ---------- */

.board {
  padding: 28px 16px 64px;
}

.board__header,
.task-add,
.task-list,
.board__empty {
  max-width: 720px;
  margin-inline: auto;
}

.board__eyebrow {
  margin: 0 0 2px;
  font-size: 13px;
  color: var(--ink-soft);
}

.board__title-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 20px;
}

.board__title {
  margin: 0;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-wrap: balance;
}

.board__count {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-faint);
  white-space: nowrap;
}

.board__delete {
  margin-left: auto;
  white-space: nowrap;
}

.board__empty {
  margin-top: 28px;
  text-align: center;
  color: var(--ink-faint);
}

.task-add {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  margin-bottom: 14px;
  padding: 0 10px 0 18px;
  border-radius: var(--radius);
  background: #ebe8f3;
}

.task-add__plus {
  font-size: 22px;
  font-weight: 300;
  color: var(--ink-soft);
}

.task-add__title {
  flex: 1;
  min-width: 0;
  height: 54px;
  border: 0;
  background: none;
}

.task-add__title:focus-visible {
  outline: none;
}

.task-add:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.task-add__date {
  height: 34px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  background: rgb(255 255 255 / 70%);
  color: var(--ink-soft);
}

.task-add__submit {
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--accent);
  font-weight: 600;
  color: #ffffff;
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0;
  list-style: none;
}

.task {
  display: flex;
  align-items: center;
  min-height: 58px;
  border-radius: var(--radius);
  background: var(--pressure-tint);
  box-shadow: 0 0 0 1px var(--pressure-line), var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
}

.task:hover {
  transform: translateY(-1px);
}

.task.is-selected {
  box-shadow: 0 0 0 2px var(--pressure-color), var(--shadow);
}

.task__check {
  position: relative;
  flex: none;
  width: 24px;
  height: 24px;
  margin: 0 4px 0 18px;
  border: 2px solid var(--pressure-color);
  border-radius: 50%;
}

/* Tıklama alanını 44px'e büyütür */
.task__check::before {
  content: "";
  position: absolute;
  inset: -12px;
}

.task.is-done .task__check {
  border-color: var(--accent);
  background: var(--accent);
}

.task.is-done .task__check::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 7px;
  width: 6px;
  height: 10px;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  transform: rotate(45deg);
}

.task__body {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 12px;
  min-width: 0;
  padding: 14px 18px 14px 12px;
  text-align: left;
}

.task__title {
  flex: 1 1 60%;
  min-width: 0;
  overflow-wrap: anywhere;
}

.task__context {
  order: 3;
  flex-basis: 100%;
  font-size: 12px;
  color: var(--ink-soft);
}

.task__due {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--pressure-color);
  white-space: nowrap;
}

.task.is-overdue .task__due {
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--pressure-color);
  color: #ffffff;
}

.task.is-done {
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line);
}

.task.is-done .task__title,
.task.is-done .task__due {
  color: var(--accent);
  font-weight: 400;
}

/* ---------- Detay (baskı) paneli ---------- */

.detail {
  --deep: oklch(calc(0.5 - 0.06 * var(--p)) calc(0.14 + 0.08 * var(--p)) calc(var(--hue) - 12));
  --glow: oklch(calc(0.64 - 0.02 * var(--p)) calc(0.13 + 0.11 * var(--p)) calc(var(--hue) + 14));
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  overflow-y: auto;
  color: #ffffff;
  background: linear-gradient(165deg, var(--glow), var(--deep));
  transition: background-color 0.4s;
}

.detail__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail__crumb {
  margin: 0;
  font-size: 13px;
  opacity: 0.85;
}

.detail__close {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgb(255 255 255 / 16%);
  font-size: 20px;
  line-height: 1;
}

.detail__close:hover {
  background: rgb(255 255 255 / 28%);
}

.detail :focus-visible {
  outline-color: #ffffff;
}

.detail__title {
  width: 100%;
  padding: 6px 8px;
  margin: 0 -8px;
  border: 0;
  border-radius: 8px;
  background: none;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.detail__title:hover,
.detail__title:focus {
  background: rgb(255 255 255 / 14%);
}

.detail__status {
  margin: 18px 0 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  animation: pulse calc(3.2s - 2.6s * var(--p)) ease-in-out infinite;
}

.countdown__cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 4px 12px;
  border-radius: 12px;
  background: rgb(255 255 255 / 14%);
}

.countdown__value {
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.countdown__unit {
  margin-top: 6px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.8;
}

/* Nabız: baskı arttıkça hem hızlanır hem büyür */
@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(calc(1 + 0.035 * var(--p)));
  }
}

.detail.is-overdue .countdown__cell {
  background: rgb(0 0 0 / 22%);
}

.burn__track {
  height: 8px;
  border-radius: 99px;
  background: rgb(255 255 255 / 22%);
  overflow: hidden;
}

.burn__fill {
  width: var(--burned, 0%);
  height: 100%;
  border-radius: 99px;
  background: #ffffff;
  transition: width 0.4s;
}

.burn__label {
  margin: 8px 0 0;
  font-size: 13px;
  opacity: 0.9;
}

.detail__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: auto;
}

.detail__field-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.8;
}

.detail__deadline {
  height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: rgb(255 255 255 / 92%);
  color: var(--ink);
}

.detail__actions {
  display: flex;
  gap: 10px;
}

.detail__button {
  flex: 1;
  height: 46px;
  border-radius: 12px;
  background: rgb(255 255 255 / 16%);
  font-weight: 600;
  transition: background-color 0.15s, transform 0.1s;
}

.detail__button:hover {
  background: rgb(255 255 255 / 28%);
}

.detail__button:active {
  transform: scale(0.98);
}

.detail__button--primary,
.detail__button--primary:hover {
  background: #ffffff;
  color: var(--deep);
}

.detail__button.is-armed {
  font-size: inherit;
  color: #ffffff;
  background: rgb(0 0 0 / 30%);
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 20;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: #ffffff;
  font-size: 14px;
  transform: translateX(-50%);
}

/* ---------- Giriş ---------- */

.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.login__card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 340px;
  padding: 32px 28px;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login__title {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.02em;
}

.login__hint {
  margin: 0 0 8px;
  color: var(--ink-soft);
}

.login__input {
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--canvas);
}

.login__error {
  margin: 0;
  font-size: 14px;
  color: #c2334d;
}

.login__submit {
  height: 46px;
  border-radius: 12px;
  background: var(--accent);
  font-weight: 600;
  color: #ffffff;
}

/* ---------- Masaüstü ---------- */

@media (min-width: 900px) {
  .app {
    display: grid;
    grid-template-columns: 288px minmax(0, 1fr);
    height: 100vh;
    overflow: hidden;
  }

  .app.has-detail {
    grid-template-columns: 288px minmax(0, 1fr) 400px;
  }

  .sidebar {
    overflow-y: auto;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .board {
    padding: 56px 40px 80px;
    overflow-y: auto;
  }

  .detail {
    position: static;
    padding: 32px 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .countdown {
    animation: none;
  }

  .task,
  .burn__fill {
    transition: none;
  }
}

/* En sonda: hidden özniteliği bileşenlerin display değerlerini ezer */
[hidden] {
  display: none;
}
