/* ===== GLOBAL ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #000;
  color: #fff;
  font-family: 'Courier New', 'Consolas', monospace;
  font-size: 18px;
  line-height: 1.6;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ===== TOP BAR ===== */
#topBar {
  display: flex;
  gap: 1.75rem;
  align-items: center;
  padding: 1rem;
  background: #111;
  border-bottom: 2px solid #00eaff;
  flex-shrink: 0;
}

.control-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

label {
  color: #00eaff;
  text-transform: uppercase;
  font-weight: bold;
}

select, input[type="text"], input[type="number"], input[type="date"] {
  background: #222;
  color: #fff;
  border: 1px solid #00eaff;
  padding: 0.4rem 0.6rem;
  font-family: inherit;
  font-size: inherit;
  border-radius: 4px;
}

select:focus, input:focus, textarea:focus, button:focus {
  outline: 3px solid #ff00e6;
  outline-offset: 2px;
}

input[type="checkbox"] {
  accent-color: #00eaff;
}

button {
  background: #222;
  color: #00eaff;
  border: 2px solid #00eaff;
  padding: 0.4rem 0.75rem;
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  text-transform: uppercase;
  font-weight: bold;
  border-radius: 4px;
}

button:hover {
  background: #00eaff;
  color: #000;
}

button:active {
  background: #ff00e6;
  border-color: #ff00e6;
  color: #000;
}

/* ===== LIST CONTAINER ===== */
#listContainer {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: #000;
}

#todoList {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ===== TODO ITEM ===== */
.todo-item {
  border: 1px solid #333;
  padding: 0.75rem;
  background: #111;
  cursor: pointer;
  transition: border-color 0.1s;
}

/* Progress background tint */
.task-row-progress-host {
  position: relative;
  isolation: isolate;
}

.task-row-progress-host .progress-bg {
  position: absolute;
  inset: 0;
  background-color: rgba(46, 204, 113, 0.22);
  transform-origin: left center;
  transform: scaleX(var(--progress, 0));
  transition: transform 0.35s linear;
  pointer-events: none;
  z-index: 0;
}

.task-row-progress-host > * {
  position: relative;
  z-index: 1;
}

.todo-item:hover {
  border-color: #00eaff;
}

.todo-item.selected {
  border: 2px solid #ff00e6;
  background: #1a1024;
}

.todo-item.selected.selected-task {
  text-decoration: underline;
  text-decoration-color: #ff00e6;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.todo-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.todo-main {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex: 1;
}

.todo-title {
  font-weight: bold;
  color: #fff;
  font-size: 1.35em;
}

.todo-project {
  color: #0f0;
  font-size: 0.9em;
}

.todo-meta {
  display: flex;
  gap: 1rem;
  align-items: center;
  color: #888;
  font-size: 0.95em;
}

.todo-due {
  color: #ff0;
}

.todo-estimate {
  color: #00eaff;
}

.todo-score {
  color: #ff00e6;
  font-weight: bold;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-size: 0.85em;
  font-weight: bold;
  border-radius: 2px;
  text-transform: uppercase;
}

.badge-importance {
  color: #000;
}

/* Urgency color coding (green to red scale) */
.badge-importance-1 {
  background: #4caf50; /* Green - lowest importance */
}

.badge-importance-2 {
  background: #8bc34a; /* Light green */
}

.badge-importance-3 {
  background: #ffeb3b; /* Yellow - medium importance */
}

.badge-importance-4 {
  background: #ff9800; /* Orange */
}

.badge-importance-5 {
  background: #f44336; /* Red - highest importance */
}

.badge-impact {
  color: #000;
}

/* Impact color coding (blue to magenta scale) */
.badge-impact-1 {
  background: #2dd4ff;
  color: #000;
}

.badge-impact-2 {
  background: #7c4dff;
  color: #000;
}

.badge-impact-3 {
  background: #c026d3;
  color: #000;
}

.badge-impact-4 {
  background: #ff4dd2;
  color: #000;
}

.badge-impact-5 {
  background: #ff0066;
  color: #000;
  text-shadow: 0 0 5px #fff;
}

/* Editing indicator - pink glow for badges */
.badge-editing {
  box-shadow: 0 0 10px #ff00e6, 0 0 20px #ff00e6 !important;
  border: 2px solid #ff00e6 !important;
  animation: pulseEditing 1s infinite;
}

/* Editing indicator - pink glow for non-badge fields */
.todo-estimate.badge-editing,
.todo-time.badge-editing,
.todo-due.badge-editing {
  box-shadow: 0 0 10px #ff00e6, 0 0 20px #ff00e6 !important;
  border: 1px solid #ff00e6 !important;
  padding: 0.3rem 0.6rem !important;
  border-radius: 3px !important;
  animation: pulseEditing 1s infinite;
}

@keyframes pulseEditing {
  0%, 100% {
    box-shadow: 0 0 10px #ff00e6, 0 0 20px #ff00e6;
  }
  50% {
    box-shadow: 0 0 15px #ff00e6, 0 0 30px #ff00e6;
  }
}

/* ===== DETAILED EDITOR ===== */
.todo-editor {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #333;
}

/* Top row in editor: project + due + estimate */
.todo-editor-top {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

/* Project combobox in editor */
.editor-project-field {
  position: relative;
  margin-bottom: 0.5rem;
  flex: 1;
}

.editor-project-input {
  width: 100%;
  background: #000;
  color: #0f0;
  border: 1px solid #00eaff;
  padding: 0.3rem 0.5rem;
  font-family: inherit;
  font-size: 0.9em;
}

.editor-project-dropup {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  min-width: 200px;
  max-width: 320px;
  max-height: 180px;
  overflow-y: auto;
  background: #111;
  border: 2px solid #00eaff;
  box-shadow: 0 0 20px rgba(0,234,255,0.25);
  padding: 0.4rem;
  z-index: 600;
}

.editor-due-input,
.editor-estimate-input {
  background: #000;
  color: #fff;
  border: 1px solid #00eaff;
  padding: 0.3rem 0.5rem;
  font-family: inherit;
  font-size: 0.85em;
}

.editor-due-input {
  width: 9.5rem;
}

.editor-estimate-input {
  width: 7.5rem;
}

.todo-editor textarea {
  width: 100%;
  height: 5.5em;
  background: #000;
  color: #0f0;
  border: 1px solid #00eaff;
  padding: 0.5rem;
  font-family: inherit;
  font-size: inherit;
  resize: none;
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 1.35em,
    rgba(0, 234, 255, 0.05) 1.35em,
    rgba(0, 234, 255, 0.05) 1.4em
  );
}

/* ===== ADD FORM ===== */
#addForm {
  flex-shrink: 0;
  background: #111;
  border-top: 2px solid #00eaff;
  padding: 0.75rem 1rem;
}

.add-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.prompt {
  color: #00eaff;
  font-size: 1.5em;
  font-weight: bold;
}

#addTitle {
  flex: 2;
}

/* Project field with dropup */
.project-field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
}

.project-field input#addProject {
  flex: 1;
}

#projectDropToggle {
  padding: 0.1rem 0.4rem;
  line-height: 1;
}

#projectDropup {
  position: absolute;
  bottom: calc(100% + 0.4rem);
  left: 0;
  min-width: 200px;
  max-width: 320px;
  max-height: 180px;
  overflow-y: auto;
  background: #111;
  border: 2px solid #00eaff;
  box-shadow: 0 0 20px rgba(0,234,255,0.25);
  padding: 0.4rem;
  z-index: 500;
}

.dropup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
}

.dropup-row:last-child {
  margin-bottom: 0;
}

.project-pill {
  background: #00eaff;
  color: #000;
  border: 1px solid #00eaff;
  padding: 0.15rem 0.5rem;
  cursor: pointer;
  font-weight: bold;
}

.project-pill:hover {
  background: #ff00e6;
  border-color: #ff00e6;
}

/* Active option in editor dropdown (keyboard highlight) */
.project-pill-active {
  outline: 2px solid #ff00e6;
  box-shadow: 0 0 8px #ff00e6;
}

.project-del,
.todo-del-btn,
.done-del-btn,
.archive-del-btn {
  background: #222;
  color: #f66;
  border: 1px solid #f66;
  width: 1.4rem;
  height: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.project-del:hover,
.todo-del-btn:hover,
.done-del-btn:hover,
.archive-del-btn:hover {
  background: #f66;
  color: #000;
}

.dropup-empty {
  color: #888;
  text-align: center;
  padding: 0.5rem 0.25rem;
}

#addDue, #addEstimate, #addImportance, #addImpact {
  flex: 0 0 auto;
}

/* ===== SETTINGS OVERLAY ===== */
#settingsOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

#settingsOverlay.hidden {
  display: none;
}

#settingsPanel {
  background: #111;
  border: 3px solid #00eaff;
  padding: 2rem;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 0 30px rgba(0, 234, 255, 0.5);
}

#settingsPanel h2 {
  color: #00eaff;
  margin-bottom: 1.5rem;
  text-align: center;
  font-size: 1.5em;
}

fieldset {
  border: 1px solid #00eaff;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

legend {
  color: #ff00e6;
  font-weight: bold;
  padding: 0 0.5rem;
}

#settingsForm label {
  display: block;
  margin-bottom: 0.75rem;
  color: #00eaff;
}

#settingsForm input, #settingsForm select {
  margin-left: 0.5rem;
  width: 200px;
}

#formulaText {
  color: #0f0;
  background: #000;
  padding: 1rem;
  border: 1px solid #333;
  font-size: 0.85em;
  white-space: pre-wrap;
  overflow-x: auto;
}

/* ===== ARCHIVE LIST IN SETTINGS ===== */
#archiveSummary {
  margin-bottom: 0.5rem;
  color: #0f0;
  font-weight: bold;
  font-size: 0.9em;
}

#archiveList {
  max-height: 250px;
  overflow-y: auto;
  border: 1px solid #222;
  padding: 0.5rem;
  background: #050505;
}

.archive-empty {
  color: #666;
  text-align: center;
  padding: 0.5rem;
}

.archive-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.4rem;
  border-bottom: 1px solid #222;
  font-size: 0.85em;
}

.archive-item:last-child {
  border-bottom: none;
}

.archive-title {
  flex: 1;
  color: #eee;
}

.archive-project-pill {
  background: rgba(0, 234, 255, 0.15);
  border: 1px solid #00eaff;
  padding: 0.05rem 0.35rem;
  border-radius: 3px;
  font-size: 0.75em;
}

.archive-completed {
  color: #aaa;
  font-size: 0.75em;
}

.archive-restore-btn {
  background: #222;
  color: #0f0;
  border: 1px solid #0f0;
  padding: 0.15rem 0.4rem;
  font-size: 0.7em;
  cursor: pointer;
  text-transform: uppercase;
  border-radius: 2px;
}

.archive-restore-btn:hover {
  background: #0f0;
  color: #000;
}

.button-row {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-track {
  background: #000;
}

::-webkit-scrollbar-thumb {
  background: #00eaff;
  border: 2px solid #000;
}

::-webkit-scrollbar-thumb:hover {
  background: #ff00e6;
}

/* ===== UTILITY ===== */
.hidden {
  display: none !important;
}

/* ===== DONE BUTTON ===== */
.todo-done-btn {
  background: linear-gradient(135deg, #00eaff, #ff00e6);
  color: #000;
  border: none;
  padding: 0.3rem 0.8rem;
  font-family: inherit;
  font-size: 0.85em;
  font-weight: bold;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 4px;
  box-shadow: 0 0 10px rgba(0,234,255,0.6), 0 0 20px rgba(255,0,230,0.4);
  transition: all 0.2s;
  margin-left: auto;
}

.todo-done-btn:hover {
  box-shadow: 0 0 15px rgba(0,234,255,0.9), 0 0 30px rgba(255,0,230,0.7);
  transform: scale(1.05);
  animation: donePulse 0.6s infinite;
}

.todo-done-btn:focus {
  outline: 3px solid #ff00e6;
  outline-offset: 2px;
}

.todo-done-btn:active {
  transform: scale(0.95);
}

@keyframes donePulse {
  0%, 100% {
    box-shadow: 0 0 15px rgba(0,234,255,0.9), 0 0 30px rgba(255,0,230,0.7);
  }
  50% {
    box-shadow: 0 0 20px rgba(0,234,255,1), 0 0 40px rgba(255,0,230,0.9);
  }
}

/* ===== FALL-DOWN ANIMATION ===== */
@keyframes fallOut {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(110vh) rotate(12deg);
    opacity: 0;
  }
}

.todo-item.fall-out {
  animation: fallOut 1.1s ease-in forwards;
  z-index: 9999;
  pointer-events: none;
  filter: drop-shadow(0 0 15px #00eaff);
}

/* ===== CONFETTI ===== */
@keyframes confettiBurst {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translate(var(--dx), var(--dy)) scale(0.3) rotate(var(--rot));
  }
}

.confetti {
  position: fixed;
  width: 8px;
  height: 8px;
  pointer-events: none;
  z-index: 10000;
  animation: confettiBurst 0.8s ease-out forwards;
}

/* ===== DONE LIGHTSHOW ===== */
.lightshow-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9000;
  overflow: hidden;
  mix-blend-mode: screen;
  background: radial-gradient(circle at center,
    rgba(0, 0, 0, 0.9),
    rgba(0, 0, 0, 0.7) 60%
  );
  animation: lightshowBgFlash 0.12s steps(2, end) infinite;
}

.lightshow-beam {
  position: absolute;
  left: -40vmax;
  width: 60vmax;
  height: 35vmax;
  background: radial-gradient(circle,
    hsla(var(--beam-hue, 180), 100%, 65%, 0.9) 0%,
    hsla(var(--beam-hue, 180), 100%, 60%, 0.35) 40%,
    rgba(0, 0, 0, 0) 75%
  );
  opacity: 0.0;
  filter: blur(8px);
  mix-blend-mode: screen;
  animation-name: lightshowSweep, lightshowStrobe;
  animation-timing-function: linear, steps(2, end);
  animation-iteration-count: infinite, infinite;
}

@keyframes lightshowSweep {
  0% {
    transform: translate3d(-10%, -50%, 0) rotate(-30deg) scale(0.8);
  }
  100% {
    transform: translate3d(160%, -50%, 0) rotate(30deg) scale(1.2);
  }
}

@keyframes lightshowStrobe {
  0% { opacity: 0.0; }
  30% { opacity: 1.0; }
  60% { opacity: 0.15; }
  100% { opacity: 0.9; }
}

@keyframes lightshowBgFlash {
  0% {
    filter: brightness(1) contrast(1);
  }
  50% {
    filter: brightness(1.4) contrast(1.3);
  }
  100% {
    filter: brightness(0.8) contrast(1.1);
  }
}

/* ===== DONE TODAY DOCK ===== */
#doneDock {
  border-top: 2px solid #00eaff;
  background: rgba(17, 17, 17, 0.95);
  padding: 0.75rem 1rem;
  max-height: 30vh;
  overflow-y: auto;
  flex-shrink: 0;
}

#doneDockTitle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: #0f0;
  font-weight: bold;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  font-size: 0.9em;
  text-shadow: 0 0 5px rgba(0,255,0,0.5);
}

.doneDock-label {
  letter-spacing: 0.06em;
}

.doneDock-count {
  color: #8f8;
  font-size: 0.8em;
}

.doneDock-toggle {
  background: #111;
  color: #0f0;
  border: 1px solid #0f0;
  padding: 0.1rem 0.45rem;
  font-size: 0.75em;
  border-radius: 3px;
  cursor: pointer;
}

.doneDock-toggle:hover {
  background: #0f0;
  color: #000;
}

#doneDock.collapsed {
  max-height: 2.3rem;
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
  overflow: hidden;
}

#doneDock.collapsed #doneList {
  display: none;
}

#doneList {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.done-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.4rem 0.5rem;
  background: #0a0a0a;
  border: 1px solid #222;
  border-radius: 2px;
}

.done-crossed {
  text-decoration: line-through;
  color: #666;
  opacity: 0.7;
  flex: 1;
}

.done-project-pill {
  background: rgba(0,255,0,0.15);
  color: #0f0;
  border: 1px solid #0f0;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.75em;
}

.done-undo-btn {
  background: #222;
  color: #ff0;
  border: 1px solid #ff0;
  padding: 0.15rem 0.4rem;
  font-size: 0.7em;
  cursor: pointer;
  text-transform: uppercase;
  border-radius: 2px;
}

.done-undo-btn:hover {
  background: #ff0;
  color: #000;
}

/* ===== CONCENTRATION MODE ===== */
/* Rocket start button */
.todo-start-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-right: 8px;
  border: 1px solid #00eaff;
  background: #001018;
  color: #00eaff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}

.todo-start-btn:hover {
  background: #00eaff;
  color: #000;
}

.todo-start-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: #000;
}

/* TIME display in meta */
.todo-time {
  color: #00eaff;
  font-weight: bold;
}

/* Full-screen concentration overlay */
#concentrationOverlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #000;
  animation: breatheDarkGreen 9s ease-in-out infinite;
  --enter-progress: 0;
}

#concentrationOverlay.hidden {
  display: none;
}

.conc-panel {
  background: rgba(0, 16, 16, 0.7);
  border: 1px solid #004d40;
  padding: 32px 40px;
  max-width: 900px;
  margin: 0 16px;
  border-radius: 8px;
  text-align: center;
}

/* Enter progress ring: grows with each registered Enter press */
.conc-enter-ring {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.conc-enter-ring-circle {
  /* Huge circle based on viewport max dimension so that scale=1 covers the
     entire screen including the corners. */
  width: 200vmax;
  height: 200vmax;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 4px solid #a8ffb0; /* light green */
  background: radial-gradient(circle,
    rgba(168, 255, 176, 0.55) 0%,
    rgba(168, 255, 176, 0.28) 40%,
    rgba(168, 255, 176, 0.10) 70%,
    rgba(168, 255, 176, 0.03) 85%
  );
  box-shadow: 0 0 32px rgba(168,255,176,0.95), 0 0 72px rgba(168,255,176,0.7);
  transform-origin: center;
  transform: scale(var(--enter-progress, 0));
  transition: transform 0.18s ease-out;
  opacity: 0.97;
}

.conc-title {
  font-size: 3em;
  margin-bottom: 12px;
  color: #ccffcc;
  font-weight: bold;
}

.conc-desc {
  font-size: 1.5em;
  margin-bottom: 20px;
  color: #a8e6a3;
  white-space: pre-wrap;
  line-height: 1.4;
}

.conc-timer {
  font-size: 3em;
  font-weight: bold;
  color: #ffffff;
  margin-bottom: 24px;
  letter-spacing: 0.05em;
}

.conc-stop-btn {
  padding: 12px 28px;
  font-size: 1.2em;
  font-weight: bold;
  border: 2px solid #ff5252;
  background: #330000;
  color: #ffaaaa;
  border-radius: 6px;
  cursor: pointer;
  text-transform: uppercase;
}

.conc-stop-btn:hover {
  background: #550000;
  box-shadow: 0 0 10px rgba(255, 82, 82, 0.5);
}

.conc-stop-btn:active {
  background: #ff5252;
  color: #000;
}

/* Breathing animation: black -> dark green -> black */
@keyframes breatheDarkGreen {
  0%   { background-color: #000000; }
  50%  { background-color: #001a00; }
  100% { background-color: #000000; }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  .todo-item.fall-out {
    animation: fallOut 0.3s ease-in forwards;
  }
  
  .confetti {
    animation: confettiBurst 0.2s ease-out forwards;
  }
  
  .todo-done-btn:hover {
    animation: none;
  }
  
  #concentrationOverlay {
    animation: none !important;
  }
}
