/* =====================================================
   Tempo — Component Patterns (supplements app.css)
   Design decisions documented inline for next developer.
   ===================================================== */

/* ── Timer Pulse ──────────────────────────────────────
   When timer exceeds 4h, the widget pulses red to signal
   "you probably forgot about this". Subtle enough to not
   alarm, persistent enough to not be ignored.
   Uses a named animation so Alpine.js can toggle the class. */

@keyframes t-timer-warn {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
  50%      { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0.15); }
}

.t-timer-warn {
  animation: t-timer-warn 2s ease-in-out infinite;
}

/* Timer bar color states:
   - default: sidebar dark (running normally)
   - warn: after 4h, border turns amber
   - danger: after 6h, entire bar turns dark red */
.t-timer-bar.is-warn  { border-top: 2px solid var(--t-warning); }
.t-timer-bar.is-danger {
  background: #450A0A;
  border-top: 2px solid var(--t-danger);
}

/* ── Timer Nudge ──────────────────────────────────────
   When no timer is running during work hours, a gentle
   nudge appears in the timer bar slot. Uses a soft gray
   instead of the active dark to avoid confusion. */
.t-timer-nudge {
  position: fixed;
  bottom: 0;
  left: var(--t-sidebar-w);
  right: 0;
  height: 44px;
  background: var(--t-surface);
  border-top: 1px solid var(--t-border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  z-index: 34;
  font-size: 0.8125rem;
  color: var(--t-text-muted);
}
@media (max-width: 1024px) {
  .t-timer-nudge { left: 0; }
}

/* ── Skeleton Screens ─────────────────────────────────
   Replace spinners with layout-matching gray rectangles.
   Animated shimmer conveys loading without blocking. */
@keyframes t-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.t-skeleton {
  background: linear-gradient(90deg, var(--t-border-subtle) 25%, var(--t-surface-hover) 50%, var(--t-border-subtle) 75%);
  background-size: 200% 100%;
  animation: t-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--t-radius-sm);
}
.t-skeleton-text { height: 0.875rem; width: 60%; }
.t-skeleton-title { height: 1.25rem; width: 40%; }
.t-skeleton-amount { height: 1rem; width: 5rem; margin-left: auto; }
.t-skeleton-circle { border-radius: 50%; }

/* ── OCR Confidence Field Highlighting ────────────────
   Instead of a single badge, each OCR-extracted field
   gets a border + icon indicating trust level.
   "Verified" = user manually confirmed value.
   "Check this" = confidence 0.75-0.9, auto-filled but flagged.
   "Needs input" = confidence < 0.75, field is editable. */

.t-field-verified {
  border-color: var(--t-success) !important;
  background: rgba(22, 163, 74, 0.04);
}
.t-field-verified::after {
  content: '';
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background: var(--t-success);
  mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='currentColor'%3e%3cpath fill-rule='evenodd' d='M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z' clip-rule='evenodd'/%3e%3c/svg%3e") no-repeat center;
}

.t-field-check {
  border-color: var(--t-warning) !important;
  background: rgba(202, 138, 4, 0.04);
}

.t-field-needs-input {
  border-color: var(--t-danger) !important;
  background: rgba(220, 38, 38, 0.04);
}

/* Wrapper for OCR fields to enable the ::after pseudo-element */
.t-ocr-field {
  position: relative;
}

/* ── Suggestion Notification Style ────────────────────
   Suggestions should feel like inbox notifications,
   not rows in a table. Left accent border indicates
   source type. Unread-style left border. */
.t-suggestion {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-left: 3px solid transparent;
  transition: all 150ms ease;
  cursor: default;
}
.t-suggestion:hover {
  background: var(--t-surface-hover);
}
.t-suggestion[data-source="outlook"],
.t-suggestion[data-source="gcalendar"]  { border-left-color: #4285F4; }
.t-suggestion[data-source="onedrive"],
.t-suggestion[data-source="gdrive"]     { border-left-color: #0F9D58; }
.t-suggestion[data-source="heartbeat"]  { border-left-color: var(--t-retainer); }

/* Actions always visible on mobile, hover on desktop */
.t-suggestion .t-suggestion-actions {
  opacity: 1;
}
@media (min-width: 1024px) {
  .t-suggestion .t-suggestion-actions {
    opacity: 0;
    transition: opacity 150ms ease;
  }
  .t-suggestion:hover .t-suggestion-actions {
    opacity: 1;
  }
}

/* ── Step Wizard ──────────────────────────────────────
   For the liquidation builder. Horizontal steps with
   connector lines. Current step is filled, completed
   steps have a checkmark, future steps are hollow. */
.t-wizard-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 1.5rem 0;
}

.t-wizard-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--t-text-light);
  white-space: nowrap;
}
.t-wizard-step.is-active {
  color: var(--t-accent);
  font-weight: 600;
}
.t-wizard-step.is-completed {
  color: var(--t-success);
}

.t-wizard-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  border: 2px solid var(--t-border);
  background: var(--t-surface);
  color: var(--t-text-light);
  flex-shrink: 0;
}
.is-active .t-wizard-dot {
  border-color: var(--t-accent);
  background: var(--t-accent);
  color: #fff;
}
.is-completed .t-wizard-dot {
  border-color: var(--t-success);
  background: var(--t-success);
  color: #fff;
}

.t-wizard-connector {
  width: 48px;
  height: 2px;
  background: var(--t-border);
  flex-shrink: 0;
  margin: 0 0.25rem;
}
.t-wizard-connector.is-completed {
  background: var(--t-success);
}

/* ── Retainer Heat Bar ────────────────────────────────
   Progress bar that shifts color based on month progress.
   Days remaining determines urgency, not just hours logged.
   A retainer with 0h logged on day 20 is more urgent than
   0h on day 3. */
.t-retainer-bar {
  position: relative;
  padding: 0.875rem 1rem;
  border-radius: var(--t-radius);
  border: 1px solid var(--t-border);
  transition: border-color 150ms ease;
}
.t-retainer-bar:hover {
  border-color: var(--t-border-strong);
}
.t-retainer-bar.is-behind {
  border-left: 3px solid var(--t-warning);
}
.t-retainer-bar.is-critical {
  border-left: 3px solid var(--t-danger);
}

/* ── Empty State Variants ─────────────────────────────
   Actionable empty states with a primary CTA.
   The illustration area uses a subtle radial gradient
   to draw the eye without being decorative fluff. */
.t-empty-rich {
  text-align: center;
  padding: 3rem 2rem;
}
.t-empty-rich .t-empty-glow {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37,99,235,0.08) 0%, transparent 70%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.t-empty-rich .t-empty-heading {
  font-size: 1rem;
  font-weight: 600;
  color: var(--t-text);
  margin-bottom: 0.375rem;
}
.t-empty-rich .t-empty-body {
  font-size: 0.8125rem;
  color: var(--t-text-muted);
  max-width: 320px;
  margin: 0 auto 1.25rem;
  line-height: 1.5;
}
.t-empty-rich .t-empty-hint {
  font-size: 0.75rem;
  color: var(--t-text-light);
  margin-top: 0.75rem;
}

/* ── Page transition ──────────────────────────────────
   Fade-in on HTMX content swap. Subtle enough to convey
   responsiveness without feeling slow. */
@keyframes t-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.t-content > * {
  animation: t-fade-in 0.15s ease-out;
}

/* ── Focus ring ──
   Consistent focus ring for keyboard navigation. */
:focus-visible {
  outline: 2px solid var(--t-accent);
  outline-offset: 2px;
}
