@import url("../styles.css");

:root {
  --bg: #f3eef9;
  --surface: rgba(252, 249, 255, 0.9);
  --surface-strong: #faf7ff;
  --ink: #2f2438;
  --muted: #70617d;
  --line: rgba(87, 60, 112, 0.12);
  --accent: #8f69c2;
  --accent-deep: #714aa5;
  --accent-soft: #e1d3f3;
  --left: #aa83d2;
  --right: #7f95d4;
  --bottle: #9baf86;
  --shadow: 0 18px 60px rgba(98, 74, 132, 0.14);
}

body {
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.78), transparent 28%),
    radial-gradient(circle at top right, rgba(210, 191, 237, 0.42), transparent 26%),
    linear-gradient(180deg, #faf6ff 0%, var(--bg) 100%);
}

.topnav a[aria-current="page"],
.topnav-dropdown[data-current="true"] > .topnav-trigger,
.topnav-dropdown[data-open="true"] > .topnav-trigger {
  background: rgba(247, 241, 255, 0.96);
  border-color: rgba(113, 74, 165, 0.2);
  color: var(--accent-deep);
}

.reset-card {
  padding: 22px;
}

.child-picker-actions {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.history-hero-actions {
  margin-top: 16px;
}

.child-tabs-shell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 24px 0 18px;
}

.child-tabs-shell[data-can-scroll="false"] {
  grid-template-columns: minmax(0, 1fr);
}

.child-tabs-viewport {
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
  padding: 12px 0 16px;
}

.child-tabs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 10px;
}

.child-tabs-shell[data-can-scroll="false"] .child-tabs-viewport {
  overflow: visible;
}

.child-tabs-viewport::-webkit-scrollbar {
  display: none;
}

.child-tab-card {
  --child-theme-color: var(--accent);
  --child-theme-tint: rgba(171, 83, 58, 0.14);
  position: relative;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  display: grid;
  gap: 10px;
  min-width: 0;
  scroll-snap-align: start;
  cursor: pointer;
  isolation: isolate;
}

.child-tab-card[data-active="true"] {
  border-color: color-mix(in srgb, var(--child-theme-color) 20%, white);
}

.child-tab-card[data-selected="true"] {
  background: color-mix(in srgb, var(--child-theme-tint) 78%, white);
  border-color: color-mix(in srgb, var(--child-theme-color) 28%, white);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--child-theme-color) 14%, white);
}

.child-tab-card:hover {
  border-color: color-mix(in srgb, var(--child-theme-color) 24%, white);
}

.child-tab {
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  display: grid;
  align-content: start;
  gap: 4px;
  text-align: left;
  cursor: pointer;
}

.child-tab:hover,
.child-tab:focus-visible {
  transform: translateY(-1px);
}

.child-tab:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--child-theme-color) 32%, white);
  outline-offset: 4px;
}

.child-tab-name {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
  font-family: "Fraunces", serif;
  font-size: 1.08rem;
  line-height: 1.1;
}

.child-tab-swatch {
  width: 11px;
  height: 11px;
  margin-top: 0.08em;
  border-radius: 999px;
  background: var(--child-theme-color);
  flex-shrink: 0;
}

.child-tab-card[data-active="true"] .child-tab-swatch {
  animation: child-tab-swatch-pulse 2.2s ease-in-out infinite;
}

.child-tab-meta {
  color: var(--muted);
  font-size: 0.9rem;
  padding-left: 21px;
}

.child-edit-button {
  justify-self: start;
  min-height: 0;
  padding: 8px 12px;
  font-size: 0.86rem;
  cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--child-theme-color) 18%, white);
  background: color-mix(in srgb, var(--child-theme-tint) 72%, white);
}

.child-scroll-button {
  min-height: 44px;
  min-width: 44px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.child-tabs-shell[data-can-scroll="false"] .child-scroll-button {
  display: none;
}

.child-scroll-button[disabled] {
  pointer-events: none;
}

.nap-status {
  gap: 18px;
}

.status-copy-group {
  display: grid;
  gap: 8px;
}

.status-copy-group h3 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  line-height: 1.1;
}

.state-pill,
.metric-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.state-pill {
  display: inline-flex;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
}

.state-pill[data-active="true"] {
  background: rgba(244, 213, 200, 0.85);
  color: var(--accent-deep);
}

.nap-live-stats,
.live-session-stats {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
}

.live-detail-card {
  min-width: 240px;
  padding: 16px 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(80, 52, 39, 0.08);
}

.live-detail-value {
  margin: 8px 0 0;
  font-family: "Fraunces", serif;
  font-size: 1.2rem;
  line-height: 1.2;
}

.action-row {
  display: grid;
  gap: 10px;
}

.storage-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.summary-totals {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.side-total {
  justify-content: space-between;
}

.side-total strong {
  line-height: 1.2;
  min-height: 2.3em;
}

.side-total span {
  white-space: nowrap;
}

.nap-list {
  margin-top: 10px;
  max-height: calc((10 * 98px) + (9 * 12px));
  overflow-y: auto;
  padding-right: 6px;
}

.nap-list .session-details p {
  margin: 4px 0 0;
}

.nap-list li.is-recently-edited {
  animation: edited-row-glow-fade 5s ease-out forwards;
}

.empty-list-state p {
  margin: 0;
}

.nap-modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.child-delete-button {
  min-height: 46px;
}

.reset-button,
.modal-secondary-button {
  background: rgba(255, 250, 244, 0.94);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: min(100% - 24px, 420px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  background: rgba(47, 36, 31, 0.96);
  color: #fffaf4;
  border-radius: 22px;
  box-shadow: 0 18px 46px rgba(47, 36, 31, 0.28);
  z-index: 40;
}

.toast-title,
.toast-copy {
  margin: 0;
}

.toast-title {
  font-weight: 700;
}

.toast-copy {
  margin-top: 4px;
  color: rgba(255, 250, 244, 0.82);
  line-height: 1.45;
}

.toast-button {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.16);
  color: #fffaf4;
}

.history-chart {
  margin-top: 18px;
}

.nap-history-overview-list {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.nap-history-overview-card {
  position: relative;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--child-theme-color) 14%, var(--line));
  border-radius: 18px;
  background: color-mix(in srgb, var(--child-theme-tint) 52%, white);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--child-theme-color) 10%, white);
}

.nap-history-overview-card[data-active="true"] .nap-history-filter-swatch {
  animation: child-tab-swatch-pulse 2.2s ease-in-out infinite;
}

.nap-history-overview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nap-history-overview-copy {
  margin: 8px 0 0;
  color: var(--muted);
}

.history-x-axis {
  grid-template-columns: repeat(var(--history-x-columns, 7), minmax(0, 1fr));
}

.nap-history-toolbar {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.nap-history-toolbar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.nap-history-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-filter-utility {
  min-height: 0;
  padding: 9px 14px;
  font-size: 0.92rem;
}

.nap-history-filters {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  overflow-x: auto;
  overflow-y: visible;
  padding: 2px 2px 10px;
  scrollbar-width: thin;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
}

.nap-history-filter {
  --child-filter-color: var(--accent);
  --child-filter-tint: rgba(171, 83, 58, 0.14);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 0;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  flex: 0 0 auto;
  scroll-snap-align: start;
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.nap-history-filter[aria-pressed="true"] {
  background: var(--child-filter-tint);
  border-color: color-mix(in srgb, var(--child-filter-color) 32%, white);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--child-filter-color) 14%, white);
}

.nap-history-filter[aria-pressed="false"] {
  opacity: 0.68;
}

.nap-history-filter:hover,
.nap-history-filter:focus-visible {
  transform: translateY(-1px);
}

.nap-history-filter:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--child-filter-color) 32%, white);
  outline-offset: 3px;
}

.nap-history-filter-swatch,
.nap-history-session-dot {
  flex-shrink: 0;
  width: 11px;
  height: 11px;
  border-radius: 999px;
}

.nap-history-filter-swatch {
  background: var(--child-filter-color);
}

.nap-history-filter[data-active="true"] .nap-history-filter-swatch {
  animation: child-tab-swatch-pulse 2.2s ease-in-out infinite;
}

.nap-history-filter-copy {
  display: grid;
  gap: 2px;
}

.nap-history-filter-name {
  font-weight: 700;
}

.nap-history-filter-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.nap-history-axis-range {
  margin: 0;
  padding-left: var(--history-axis-left);
  color: var(--muted);
  font-size: 0.9rem;
}

.nap-history-day-highlight {
  fill: rgba(200, 109, 82, 0.08);
}

.nap-history-day-hit-area {
  fill: transparent;
  cursor: pointer;
}

.nap-history-day-divider {
  stroke: rgba(80, 52, 39, 0.08);
  stroke-width: 1;
}

.nap-history-day-outline {
  fill: transparent;
  stroke: rgba(171, 83, 58, 0.34);
  stroke-width: 1.5;
}

.nap-history-bar {
  stroke: rgba(47, 36, 31, 0.12);
  stroke-width: 1;
  transition:
    opacity 160ms ease,
    stroke 160ms ease,
    stroke-width 160ms ease,
    filter 160ms ease;
}

.nap-history-day-column:hover .nap-history-bar,
.nap-history-day-column.is-selected .nap-history-bar {
  opacity: 0.96;
}

.nap-history-day-column:not(.is-selected) .nap-history-bar {
  opacity: 0.84;
}

.nap-history-bar.is-hovered {
  opacity: 1;
  stroke: color-mix(in srgb, var(--history-bar-accent) 60%, #fff5ee);
  stroke-width: 2.5;
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--history-bar-accent) 34%, transparent));
}

.history-bar-tooltip {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  min-width: 160px;
  max-width: min(240px, calc(100% - 20px));
  padding: 10px 12px;
  border: 1px solid rgba(255, 250, 244, 0.18);
  border-radius: 16px;
  background: rgba(56, 40, 35, 0.96);
  color: #fffaf4;
  box-shadow: 0 18px 34px rgba(56, 40, 35, 0.2);
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 4px));
}

.history-bar-tooltip[data-side="below"] {
  transform: translate(-50%, 4px);
}

.history-bar-tooltip-title,
.history-bar-tooltip-copy {
  margin: 0;
}

.history-bar-tooltip-title {
  font-family: "Fraunces", serif;
  font-size: 0.95rem;
}

.history-bar-tooltip-copy {
  margin-top: 4px;
  color: rgba(255, 250, 244, 0.82);
  font-size: 0.88rem;
  line-height: 1.4;
}

.nap-history-day-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 14px;
  color: var(--muted);
}

.nap-history-session-list {
  margin-top: 16px;
}

.nap-history-session-list .session-details p {
  margin: 4px 0 0;
}

.nap-history-session-child {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.nap-history-note {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.nap-history-editor {
  margin-top: 12px;
}

.nap-history-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

@keyframes child-tab-swatch-pulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow:
      0 0 0 4px var(--child-theme-tint),
      0 0 0 0 color-mix(in srgb, var(--child-theme-color) 0%, transparent),
      0 0 10px color-mix(in srgb, var(--child-theme-color) 16%, transparent);
  }

  50% {
    transform: scale(1.08);
    box-shadow:
      0 0 0 4px var(--child-theme-tint),
      0 0 0 8px color-mix(in srgb, var(--child-theme-color) 16%, transparent),
      0 0 18px color-mix(in srgb, var(--child-theme-color) 24%, transparent);
  }
}

@keyframes edited-row-glow-fade {
  0% {
    border-color: rgba(203, 109, 82, 0.78);
    box-shadow:
      0 0 0 2px rgba(203, 109, 82, 0.42),
      0 0 28px rgba(203, 109, 82, 0.2);
  }

  100% {
    border-color: rgba(73, 46, 32, 0.08);
    box-shadow: none;
  }
}

.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(47, 36, 31, 0.36);
  z-index: 30;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(100% - 24px, 520px);
  padding: 22px;
  transform: translate(-50%, -50%);
  z-index: 31;
}

.modal-fields {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.sr-announcer {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 700px) {
  .reset-card {
    padding: 18px;
    border-radius: 24px;
  }

  .child-picker-actions {
    justify-items: start;
  }

  .summary-totals {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nap-live-stats,
  .live-session-stats {
    align-items: stretch;
    flex-direction: column;
  }

  .live-detail-card {
    min-width: 0;
  }

  .nap-modal-grid {
    grid-template-columns: 1fr;
  }

  .modal {
    top: auto;
    bottom: 12px;
    left: 12px;
    right: 12px;
    width: auto;
    transform: none;
  }

  .toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    flex-direction: column;
    align-items: flex-start;
  }

  .nap-history-filter {
    max-width: 100%;
  }

  .nap-history-editor-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
}
