/* 1. THEME & CORE */
:root {
  --base: #1e1e2e;
  --mantle: #181825;
  --crust: #11111b;
  --text: #cdd6f4;
  --subtext: #a6adc8;
  --mauve: #cba6f7;
  --blue: #89b4fa;
  --green: #a6e3a1;
  --red: #f38ba8;
  --surface: #313244;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--base);
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  margin: 0;
  display: flex;
  justify-content: center;
  padding: 15px;
}

main {
  width: 100%;
  max-width: 320px;
}

/* 2. HEADER & CENTERED DATE PICKER */
header {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  margin-bottom: 25px;
}

.date-picker-wrapper {
  position: relative;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 40px; /* Larger hit area for thumbs */
}

header span {
  font-size: 0.7rem;
  color: var(--mauve);
  font-weight: 300;
  letter-spacing: 0.05rem;
  white-space: nowrap;
  opacity: 0.9;
  z-index: 1;
  pointer-events: none; /* Allows click to pass through to the input */
}

/* The Secret Date Picker Fix for Web & Mobile */
.hidden-date-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 10; /* Sits on top of the text */
  border: none;
  appearance: none;
}

/* Desktop Chrome/Safari: This forces the invisible 'calendar icon' to be the size of the whole header */
.hidden-date-input::-webkit-calendar-picker-indicator {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  cursor: pointer;
  opacity: 0;
}

/* 3. INPUT SECTION */
.input-group {
  display: flex;
  align-items: center;
  background: var(--mantle);
  padding: 4px 10px;
  border-radius: 4px;
  margin-bottom: 25px;
  border: 1px solid var(--surface);
}

.input-group::before {
  content: ">";
  color: var(--green);
  margin-right: 10px;
  font-weight: bold;
}

input[type="text"] {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
}

/* 4. AGENDA LIST */
ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.task-item {
  display: flex;
  position: relative;
  padding-left: 20px;
  margin-bottom: 0;
  border-left: 1px solid var(--surface);
  transition: height 0.3s ease;
  min-height: 65px;
  justify-content: space-between;
}

.task-item::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 15px;
  width: 7px;
  height: 7px;
  background: var(--surface);
  border-radius: 50%;
}

.task-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-top: 10px;
}

.timestamp {
  font-size: 0.55rem;
  color: var(--mauve);
  opacity: 0.7;
  margin-bottom: 4px;
  text-transform: lowercase;
}

.name {
  font-size: 0.9rem;
  color: var(--blue);
  margin-bottom: 2px;
  cursor: pointer;
}

/* 5. DESCRIPTION TEXTAREA */
.description-text {
  margin-top: 6px;
  width: 100%;
}

.description-text textarea {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  color: var(--subtext);
  background: transparent;
  border: none;
  border-left: 2px solid var(--surface);
  padding: 2px 0 2px 8px;
  width: 100%;
  resize: none;
  overflow: hidden;
  outline: none;
  line-height: 1.4;
}

.description-text textarea::placeholder {
  color: var(--surface);
}

.time {
  font-size: 0.75rem;
  color: var(--subtext);
  font-variant-numeric: tabular-nums;
}

/* 6. BUTTONS */
button {
  background: transparent;
  border: none;
  color: var(--subtext);
  cursor: pointer;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

button i {
  width: 16px;
  height: 16px;
  stroke-width: 2px;
}

header button:first-child { justify-self: start; }
header button:last-child { justify-self: end; }

.task-actions {
  display: flex;
  gap: 8px;
  align-self: flex-start;
  padding-top: 10px;
}

/* 7. STATES & ANIMATIONS */
.running.task-item::before {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.running .name { color: var(--green); }

.running .btn-toggle {
  color: var(--green);
  animation: pulse 2s infinite;
}

.btn-delete {
  opacity: 0.3;
}

.btn-delete:hover {
  color: var(--red);
  opacity: 1;
}

@keyframes pulse {
  50% { opacity: 0.4; }
}
