/* Category Cards */
.category-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow var(--transition-fast);
}

.category-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--cat-color, var(--color-accent));
}

.category-card:active {
  box-shadow: var(--shadow-md);
}

.category-card__name {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-normal);
  padding-left: var(--space-sm);
}

.category-card__stats {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  padding-left: var(--space-sm);
}

.category-card__edit {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  padding: var(--space-sm);
  color: var(--color-text-light);
}

/* Task Items */
.task-item {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.task-item__header {
  display: flex;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  gap: var(--space-md);
  cursor: pointer;
}

.task-item__dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.task-item__name {
  flex: 1;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
}

.task-item__chevron {
  width: 16px;
  height: 16px;
  color: var(--color-text-light);
  transition: transform var(--transition-fast);
}

.task-item.expanded .task-item__chevron {
  transform: rotate(180deg);
}

.task-item__body {
  display: none;
  padding: 0 var(--space-lg) var(--space-lg);
}

.task-item.expanded .task-item__body {
  display: block;
}

.task-item__stats {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-md);
}

.task-item__actions {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.task-item__edit-row {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border-light);
}

/* Action Buttons (stopwatch, timer, reminder) */
.action-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  background: var(--color-bg-alt);
  transition: background var(--transition-fast);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
  color: var(--color-text-muted);
}

.action-btn:active {
  background: var(--color-border);
}

.action-btn svg {
  width: 24px;
  height: 24px;
  color: var(--color-accent);
}

/* Small utility buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-normal);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.btn--primary {
  background: var(--color-accent);
  color: #fff;
}

.btn--primary:active {
  background: color-mix(in srgb, var(--color-accent) 85%, black);
}

.btn--secondary {
  background: var(--color-bg-alt);
  color: var(--color-text);
}

.btn--secondary:active {
  background: var(--color-border);
}

.btn--danger {
  color: var(--color-danger);
}

.btn--small {
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--font-size-xs);
}

.btn--full {
  width: 100%;
  justify-content: center;
}

.btn--add {
  width: 100%;
  padding: var(--space-md);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
  transition: border-color var(--transition-fast), color var(--transition-fast);
}

.btn--add:active {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* GitHub-style Tracker */
.tracker-wrapper {
  width: 100%;
  overflow: hidden;
}

.tracker-wrapper svg {
  width: 100%;
  height: auto;
  display: block;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: auto;
  opacity: 0;
  transition: opacity var(--transition-base);
  z-index: var(--z-modal);
}

.modal-overlay.visible {
  opacity: 1;
}

.modal-content {
  background: var(--color-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: var(--app-max-width);
  max-height: 85dvh;
  overflow-y: auto;
  padding: var(--space-xl) var(--space-lg) var(--space-2xl);
  transform: translateY(100%);
  transition: transform var(--transition-base);
}

.modal-overlay.visible .modal-content {
  transform: translateY(0);
}

.modal-content__title {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-lg);
  letter-spacing: var(--letter-spacing-wide);
}

.modal-content__actions {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

/* Input fields */
.input-group {
  margin-bottom: var(--space-lg);
}

.input-group__label {
  display: block;
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
  color: var(--color-text-muted);
  margin-bottom: var(--space-sm);
}

.input-group__field {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  font-size: var(--font-size-base);
  transition: border-color var(--transition-fast);
}

.input-group__field:focus {
  outline: none;
  border-color: var(--color-accent);
}

/* Color Picker */
.color-picker {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: var(--space-sm);
}

.color-swatch {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color var(--transition-fast), transform var(--transition-fast);
}

.color-swatch.selected {
  border-color: var(--color-text);
  transform: scale(1.1);
}

/* Color Picker Custom */
.color-picker-wrapper {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.color-swatch--custom {
  border: 2px dashed var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.color-swatch--custom.selected {
  border-color: var(--color-text);
  border-style: solid;
}

.color-picker__custom {
  display: none;
  align-items: center;
  gap: var(--space-md);
  padding-top: var(--space-sm);
}

.color-picker__custom.active {
  display: flex;
}

.color-picker__hue {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right,
    hsl(0,35%,52%),hsl(30,35%,52%),hsl(60,35%,52%),
    hsl(90,35%,52%),hsl(120,35%,52%),hsl(150,35%,52%),
    hsl(180,35%,52%),hsl(210,35%,52%),hsl(240,35%,52%),
    hsl(270,35%,52%),hsl(300,35%,52%),hsl(330,35%,52%),
    hsl(360,35%,52%));
  outline: none;
}

.color-picker__hue::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  border: 2px solid var(--color-text-muted);
  box-shadow: var(--shadow-sm);
}

.color-picker__preview {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  border: 1px solid var(--color-border-light);
}

/* Drag Insert Line */
.drag-insert-line {
  height: 2px;
  background: var(--color-accent);
  border-radius: 1px;
  margin: -1px 0;
  pointer-events: none;
}

/* Flow Toggle */
.flow-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
  color: var(--color-text-muted);
}


.flow-toggle__dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  display: none;
}

.flow-toggle.active .flow-toggle__dot {
  display: block;
  animation: pulse 2s infinite;
}

.flow-toggle.shake {
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Full-screen overlay (stopwatch, timer) */
.fullscreen-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  z-index: var(--z-overlay);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-xl);
}

.fullscreen-overlay__time {
  font-size: var(--font-size-timer);
  font-weight: var(--font-weight-light);
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

.fullscreen-overlay__task {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
}

.fullscreen-overlay__actions {
  display: flex;
  gap: var(--space-lg);
  margin-top: var(--space-xl);
}

.fullscreen-overlay__btn {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

.fullscreen-overlay__btn--stop {
  background: var(--color-danger);
  color: #fff;
}

.fullscreen-overlay__btn--pause {
  background: var(--color-bg-alt);
  color: var(--color-text);
}

.fullscreen-overlay__btn--resume {
  background: var(--color-accent);
  color: #fff;
}

/* Time Picker */
.time-picker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
}

.time-picker__column {
  width: 64px;
  height: 140px;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  background: var(--color-bg-alt);
}

.time-picker__column::-webkit-scrollbar {
  display: none;
}

.time-picker__item {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: center;
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-light);
  color: var(--color-text-light);
  transition: color var(--transition-fast);
}

.time-picker__item.selected {
  color: var(--color-text);
}

.time-picker__separator {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-light);
  color: var(--color-text-light);
}

/* Ghost Drag */
.ghost-drag {
  position: fixed;
  pointer-events: none;
  z-index: var(--z-ghost);
  opacity: 0.92;
  transform: scale(1.04);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-md);
  transition: none;
}

.reorder-container {
  -webkit-user-select: none;
  user-select: none;
}

.hold-ready {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.dragging {
  opacity: 0.3;
}

/* Notification / Reminder Popup */
.notification-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: var(--z-notification);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.notification-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-xl) var(--space-lg);
  width: 100%;
  max-width: var(--app-max-width);
  box-shadow: var(--shadow-lg);
}

.notification-card__counter {
  font-size: var(--font-size-xs);
  color: var(--color-text-light);
  margin-bottom: var(--space-sm);
}

.notification-card__label {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  margin-bottom: var(--space-xs);
}

.notification-card__task {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-xs);
}

.notification-card__time {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-lg);
}

.notification-card__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
}

.notification-card__hint {
  text-align: center;
  margin-top: var(--space-sm);
  font-size: var(--font-size-xs);
  color: var(--color-text-light);
}

.notification-batch {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
  justify-content: center;
}

/* Toggle Switch */
.toggle {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
}

.toggle__track {
  width: 36px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--color-border);
  position: relative;
  transition: background var(--transition-fast);
}

.toggle__track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  transition: transform var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.toggle.active .toggle__track,
.flow-toggle.active .toggle__track {
  background: var(--color-accent);
}

.toggle.active .toggle__track::after,
.flow-toggle.active .toggle__track::after {
  transform: translateX(16px);
}

.toggle__label {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

/* Session Log list */
.session-list {
  margin-top: var(--space-md);
}

.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-border-light);
  font-size: var(--font-size-sm);
}

.session-item__date {
  color: var(--color-text-muted);
}

.session-item__duration {
  font-variant-numeric: tabular-nums;
}

.session-item__actions {
  display: flex;
  gap: var(--space-xs);
}

/* Recurrence day checkboxes */
.day-picker {
  display: flex;
  gap: var(--space-xs);
}

.day-picker__day {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs);
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.day-picker__day.selected {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

/* Urgent indicator */
.urgent-indicator {
  color: var(--color-accent-warm);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
}

/* Task picker (for planner) */
.task-picker {
  max-height: 300px;
  overflow-y: auto;
}

.task-picker__item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border-bottom: 1px solid var(--color-border-light);
  cursor: pointer;
}

.task-picker__item:active {
  background: var(--color-bg-alt);
}

.task-picker__category {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.task-picker__create {
  border-top: 1px solid var(--color-border-light);
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
}

.task-picker__create-toggle {
  padding: var(--space-sm) var(--space-md);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  cursor: pointer;
}

.task-picker__create-toggle:active {
  color: var(--color-accent);
}

.task-picker__create-form {
  padding: var(--space-sm) var(--space-md);
}
