/* Day Planner Sidebar */

.day-planner {
  position: fixed;
  right: 0;
  top: var(--topbar-height);
  bottom: 0;
  width: 40px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-subtle);
  z-index: 110;
  transition: width var(--transition-normal);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.day-planner--expanded {
  width: 380px;
  overflow: visible;
}

.day-planner--hidden {
  display: none;
}

/* Show day planner above work mode fullscreen overlay */
.work-mode-active .day-planner {
  z-index: 252;
  top: 0;
}

/* Push main content only when expanded */
.day-planner-margin--expanded {
  margin-right: 380px;
}

/* ── Collapsed view ── */

.day-planner__collapsed {
  display: flex;
  flex-direction: column;
  height: 100%;
  cursor: pointer;
  padding: var(--space-xs) 0;
}

.day-planner__toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 28px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
}

.day-planner__toggle-btn:hover {
  color: var(--text-primary);
}

.day-planner__strips {
  display: flex;
  gap: 4px;
  flex: 1;
  padding: 0 6px;
  position: relative;
  min-height: 0;
}

.day-planner__strip {
  flex: 1;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  position: relative;
  overflow: hidden;
}

.day-planner__strip-segment {
  position: absolute;
  left: 0;
  right: 0;
  border-radius: 2px;
  min-height: 2px;
}

.day-planner__now-marker {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  z-index: 2;
  pointer-events: none;
}

/* ── Expanded view ── */

.day-planner__expanded {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.day-planner__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  cursor: pointer;
}

.day-planner__date {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
}

.day-planner__collapse-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: var(--space-xs);
  border-radius: var(--radius-sm);
  font-size: 16px;
}

.day-planner__collapse-btn:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.day-planner__columns {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.day-planner__column {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.day-planner__column+.day-planner__column {
  border-left: 1px solid var(--border-subtle);
}

.day-planner__column-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.day-planner__column-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.day-planner__timeline {
  position: relative;
}

.day-planner__hours {
  position: relative;
  user-select: none;
}

.day-planner__hour-row {
  height: 48px;
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
  display: flex;
  align-items: flex-start;
}

.day-planner__hour-label {
  font-size: 10px;
  color: var(--text-muted);
  width: 32px;
  padding: 2px 4px 0;
  flex-shrink: 0;
  text-align: right;
}

.day-planner__hour-slot {
  flex: 1;
  height: 100%;
  position: relative;
  cursor: crosshair;
}

.day-planner__hour-slot:hover {
  background: var(--bg-elevated);
}

/* ── Time blocks ── */

.day-planner__block {
  position: absolute;
  left: 32px;
  right: 4px;
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-size: 11px;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  z-index: 1;
  cursor: grab;
  min-height: 18px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: box-shadow var(--transition-fast), filter var(--transition-fast);
}

.day-planner__block:hover {
  filter: brightness(1.15);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3);
  z-index: 5 !important;
}

.day-planner__block--editing {
  box-shadow: 0 0 0 2px var(--accent);
  filter: brightness(1.2);
  z-index: 2;
}

.day-planner__block--dragging {
  opacity: 0.75;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 0 0 2px rgba(255, 255, 255, 0.2);
  z-index: 10;
  cursor: grabbing;
  transition: none;
  pointer-events: none;
}

.day-planner__block-label {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  pointer-events: none;
}

/* ── Copy-to-log button ── */

.day-planner__block-copy {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
  line-height: 1;
  opacity: 0;
  transition: opacity var(--transition-fast), color var(--transition-fast);
  pointer-events: auto;
}

.day-planner__block:hover .day-planner__block-copy {
  opacity: 1;
}

.day-planner__block-copy:hover {
  color: #fff;
}

/* ── Resize handles ── */

.day-planner__block-resize-handle {
  position: absolute;
  left: 0;
  right: 0;
  height: 6px;
  cursor: ns-resize;
  z-index: 2;
}

.day-planner__block-resize-handle--top {
  top: -2px;
}

.day-planner__block-resize-handle--bottom {
  bottom: -2px;
}

.day-planner__block-resize-handle:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ── Drag preview ── */

.day-planner__drag-preview {
  position: absolute;
  left: 32px;
  right: 4px;
  background: var(--accent);
  opacity: 0.25;
  border-radius: var(--radius-sm);
  z-index: 2;
  pointer-events: none;
  border: 2px dashed var(--accent);
}

/* ── Active activity pulse ── */

.day-planner__block--active {
  animation: dp-pulse 2s ease-in-out infinite;
}

@keyframes dp-pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }
}

/* ── Now line ── */

.day-planner__timeline-now {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  z-index: 3;
  pointer-events: none;
}

.day-planner__timeline-now::before {
  content: '';
  position: absolute;
  left: 28px;
  top: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

/* ── Popover (inline modal) ── */

.day-planner__popover {
  position: absolute;
  z-index: 20;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: calc(100% - 8px);
}

.day-planner__popover-label {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 6px 8px;
  font-size: 13px;
  width: 100%;
  outline: none;
}

.day-planner__popover-label:focus {
  border-color: var(--accent);
}

.day-planner__popover-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.day-planner__popover-time {
  font-size: 12px;
  flex: 0 0 auto;
}

.day-planner__popover-sep {
  color: var(--text-muted);
  font-size: 12px;
}

.day-planner__popover-category {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 4px 6px;
  font-size: 12px;
  flex: 1;
  min-width: 0;
}

.day-planner__popover-actions {
  display: flex;
  gap: var(--space-xs);
  justify-content: flex-end;
  margin-top: 2px;
}

.day-planner__popover-btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.day-planner__popover-btn--save {
  background: var(--accent);
  color: var(--bg-primary);
}

.day-planner__popover-btn--save:hover {
  background: var(--accent-light);
}

.day-planner__popover-btn--cancel {
  background: none;
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

.day-planner__popover-btn--cancel:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.day-planner__popover-btn--danger {
  background: var(--danger);
  color: #fff;
  margin-right: auto;
}

.day-planner__popover-btn--danger:hover {
  background: var(--danger-dark);
}

/* ── Activity footer ── */

.day-planner__footer {
  padding: var(--space-sm) var(--space-md);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.day-planner__start-btn {
  width: 100%;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--bg-primary);
  padding: var(--space-xs) var(--space-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.day-planner__start-btn:hover {
  background: var(--accent-light);
}

.day-planner__active-activity {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.day-planner__active-info {
  flex: 1;
  min-width: 0;
}

.day-planner__active-label {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-planner__active-elapsed {
  font-size: 11px;
  color: var(--text-secondary);
}

.day-planner__stop-btn {
  background: var(--danger);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.day-planner__stop-btn:hover {
  background: var(--danger-dark);
}

/* Timer-float is on the left side — no adjustment needed for day planner sidebar */

/* ── Morning Plan Banner ── */

.day-planner__plan-banner {
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  flex-shrink: 0;
}

.day-planner__plan-banner--planning {
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-elevated));
  border-bottom: 2px solid var(--accent);
}

.day-planner__plan-banner-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.day-planner__plan-banner-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.day-planner__plan-banner-dismiss {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.day-planner__plan-banner-dismiss:hover {
  color: var(--text-secondary);
}

/* ── Responsive ── */

@media (max-width: 768px) {
  .day-planner--expanded {
    width: 300px;
  }

  .day-planner-margin--expanded {
    margin-right: 300px;
  }
}

@media (max-width: 480px) {
  .day-planner--expanded {
    width: 100vw;
  }

  .day-planner-margin--expanded {
    margin-right: 0;
  }
}