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

:root {
  --text:        #1C1C1E;
  --text-dim:    #9A9A9A;
  --border:      rgba(0, 0, 0, 0.07);
  --green:       #00C47A;
  --accent:      #FF8E5A;
  --accent2:     #FFBE5A;
  --red:         #FF4747;
  --blue:        #4A9EFF;
  --gray:        #C4C4C4;
  --radius-card: 22px;
  --radius-pill: 20px;
}

html { height: 100%; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text);
  min-height: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 36px 16px 120px;
  -webkit-font-smoothing: antialiased;

  /* Warm bokeh gradient — inspired by reference 1 */
  background-color: #F0E4D0;
  background-image:
    radial-gradient(ellipse 70% 60% at 12% 8%,  rgba(255, 195, 90,  0.62) 0%, transparent 62%),
    radial-gradient(ellipse 55% 65% at 90% 6%,  rgba(255, 225, 120, 0.48) 0%, transparent 58%),
    radial-gradient(ellipse 60% 55% at 75% 92%, rgba(160, 205, 255, 0.42) 0%, transparent 60%),
    radial-gradient(ellipse 50% 55% at 4%  88%, rgba(255, 155, 95,  0.32) 0%, transparent 55%),
    radial-gradient(ellipse 40% 40% at 50% 50%, rgba(255, 240, 180, 0.18) 0%, transparent 70%);
}

/* ── App shell ──────────────────────────────────────────────────────────── */
.app {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Tabs ───────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.46);
  border-radius: var(--radius-pill);
  width: fit-content;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.tab {
  background: transparent;
  border: none;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  font-weight: 500;
  color: rgba(28, 28, 30, 0.55);
  cursor: pointer;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
  font-family: inherit;
  white-space: nowrap;
}

.tab.active {
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* ── Direction bar ──────────────────────────────────────────────────────── */
.dir-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dir-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pill {
  background: rgba(255, 255, 255, 0.52);
  border: 1.5px solid rgba(255, 255, 255, 0.82);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  color: rgba(28, 28, 30, 0.6);
  cursor: pointer;
  transition: all 0.18s;
  font-family: inherit;
  white-space: nowrap;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.pill.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px rgba(255, 142, 90, 0.42);
}

.pill-add {
  background: transparent;
  border: 1.5px dashed rgba(28, 28, 30, 0.3);
  color: rgba(28, 28, 30, 0.4);
  font-size: 12px;
  backdrop-filter: none;
}

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

/* ── Card ───────────────────────────────────────────────────────────────── */
.card {
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-card);
  padding: 28px 28px 36px;
  box-shadow:
    0 4px 32px rgba(0, 0, 0, 0.07),
    0 1px 0 rgba(255, 255, 255, 0.6) inset;
  min-height: 420px;
}

/* ── Date header ────────────────────────────────────────────────────────── */
.date-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.date-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.date-day {
  font-size: 52px;
  font-weight: 300;
  line-height: 1;
  letter-spacing: -2px;
  /* Gradient text */
  background: linear-gradient(145deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.date-right-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.date-month {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.date-wd {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  color: var(--text-dim);
  text-transform: uppercase;
  align-self: center;
}

/* ── Task list ──────────────────────────────────────────────────────────── */
.task-list {
  display: flex;
  flex-direction: column;
}

.group-hdr {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 18px 0 8px;
}

.group-hdr:first-child { padding-top: 0; }

/* Task row */
.task-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}

.task-item:last-child,
.task-item:last-of-type { border-bottom: none; }

.task-body {
  flex: 1;
  min-width: 0;
}

.task-text {
  font-size: 15px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--text);
  word-break: break-word;
}

.task-item.is-done .task-text {
  color: var(--gray);
  text-decoration: line-through;
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
  flex-wrap: wrap;
}

/* Priority dot */
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-urgent  { background: var(--red);  }
.dot-normal  { background: var(--blue); }
.dot-someday { background: var(--gray); }

/* Direction tag */
.dir-tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 8px;
  border-radius: 8px;
}

/* Deadline */
.deadline { font-size: 11px; color: var(--text-dim); }
.deadline.overdue { color: var(--red); font-weight: 500; }

/* Checkbox */
.checkbox {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.16);
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.18s, background 0.18s;
  position: relative;
}

.checkbox:hover { border-color: var(--accent); }

.checkbox.is-done {
  background: var(--green);
  border-color: var(--green);
}

.checkbox.is-done::after {
  content: '';
  width: 9px;
  height: 5px;
  border-left: 2.5px solid #fff;
  border-bottom: 2.5px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
  display: block;
}

/* ── Empty state ────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 0 40px;
  color: var(--gray);
}

.empty-icon { font-size: 32px; opacity: 0.5; }
.empty-state p { font-size: 15px; }

/* ── FAB ────────────────────────────────────────────────────────────────── */
.fab {
  position: fixed;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent), var(--accent2));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 24px rgba(255, 142, 90, 0.48);
  transition: transform 0.2s, box-shadow 0.2s;
  z-index: 90;
}

.fab:hover {
  transform: translateX(-50%) scale(1.07);
  box-shadow: 0 8px 28px rgba(255, 142, 90, 0.58);
}

.fab-icon {
  font-size: 30px;
  color: #fff;
  line-height: 1;
  margin-top: -1px;
}

/* ── Modal ──────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.32);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: backdropIn 0.22s ease;
}

@keyframes backdropIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-sheet {
  background: rgba(255, 252, 248, 0.94);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 24px 24px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.9);
  padding: 12px 24px 36px;
  width: 100%;
  max-width: 480px;
  animation: sheetUp 0.28s cubic-bezier(.32,.72,0,1);
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  margin: 0 auto 20px;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text);
}

/* ── Form ───────────────────────────────────────────────────────────────── */
.field-group { margin-bottom: 14px; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.field {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.7);
  outline: none;
  transition: border-color 0.18s, background 0.18s;
  resize: none;
  appearance: none;
  -webkit-appearance: none;
}

.field:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.95);
}

.field::placeholder { color: var(--gray); }

select.field {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239A9A9A' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.btn-submit {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  margin-top: 6px;
  transition: opacity 0.18s, transform 0.12s;
  box-shadow: 0 4px 14px rgba(255, 142, 90, 0.38);
}

.btn-submit:hover  { opacity: 0.88; }
.btn-submit:active { transform: scale(0.98); }

/* ── Utilities ──────────────────────────────────────────────────────────── */
[hidden] { display: none !important; }

.task-item.fading {
  opacity: 0;
  transform: translateX(8px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
