/* Per-tab "sticky note" floating card — overlays the top-right of the terminal.
   It does NOT resize the terminal; it floats above it and never steals focus. */

.sticky-note-card {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 30;
  width: 280px;
  max-width: calc(100% - 20px);
  max-height: 42%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-primary);
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(6px);
  /* Float over xterm without capturing scroll/click on the body region. */
  pointer-events: auto;
}

/* The `hidden` attribute must win over `display:flex` above — without this the
   card can never collapse (a class selector outranks the UA [hidden] rule). */
.sticky-note-card[hidden] {
  display: none !important;
}

/* Respect iOS PWA safe areas (Dynamic Island / notch) on the right edge. */
@supports (padding: env(safe-area-inset-right)) {
  html.pwa-standalone .sticky-note-card {
    right: max(10px, env(safe-area-inset-right));
    top: max(10px, env(safe-area-inset-top));
  }
}

.sticky-note-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  cursor: default;
  border-bottom: 1px solid var(--border-subtle);
}

.sticky-note-titlebar {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.sticky-note-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex: 0 0 auto;
}

.sticky-note-card.summarizing .sticky-note-dot {
  animation: sticky-note-pulse 1.1s ease-in-out infinite;
}

@keyframes sticky-note-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.7); }
}

.sticky-note-fresh {
  margin-left: auto;
  font-size: 10px;
  opacity: 0.6;
  white-space: nowrap;
}

.sticky-note-collapse {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  padding: 0;
  line-height: 1;
  font-size: 14px;
  color: inherit;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0.7;
}
.sticky-note-collapse:hover { opacity: 1; background: var(--surface-tertiary); }

.sticky-note-body {
  padding: 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sn-sec-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.55;
  margin-bottom: 2px;
}

.sn-goal-text { font-weight: 500; }

/* Append-only Updates log: newest on top, each with a relative timestamp. */
.sn-updates .sn-list { list-style: none; padding-left: 0; }
.sn-updates .sn-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.sn-updates .sn-list li:last-child { border-bottom: none; }
.sn-update-text { word-break: break-word; }
.sn-update-at { flex: 0 0 auto; font-size: 10px; opacity: 0.45; white-space: nowrap; }


.sn-list {
  margin: 0;
  padding-left: 16px;
  list-style: disc;
}
.sn-list li { margin: 1px 0; word-break: break-word; }

.sn-placeholder { opacity: 0.6; font-style: italic; }

/* On narrow screens, keep the card compact and out of the way. */
@media (max-width: 640px) {
  .sticky-note-card {
    width: 200px;
    max-height: 35%;
    font-size: 11px;
  }
}
