/* Specialized component styles. Utilities are compiled once by Tailwind in app.min.css. */

/* Theme toggle icon micro-animation (matches treinador project). */
.theme-toggle-icon {
  display: inline-block;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.theme-toggle-spin {
  animation: theme-toggle-spin 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes theme-toggle-spin {
  0%   { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(180deg) scale(0.7); }
  100% { transform: rotate(360deg) scale(1); }
}

/* Shared "X online" pulsing indicator (realtime card + whiteboard). */
.online-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  line-height: 1rem;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
  background-color: color-mix(in oklab, var(--color-success) 15%, transparent);
  /* The dot is the semantic signal; the label must stay readable (AA) on the
     tinted surface, where --color-success itself is 1.7:1. */
  /* The dot is the semantic signal; the label must stay readable (AA) on the
     tinted surface, where --color-success itself is 1.7:1. */
  color: var(--color-base-content);
}
.online-pill .pulse-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background-color: var(--color-success);
  animation: online-pulse 1.6s ease-in-out infinite;
}
/* When the client is offline the realtime/SSE channel is down, so the
   "X online" count is stale. Show a red "offline" badge instead of
   a live-green pulsing dot with a stale count. Driven by the
   .is-offline class toggle from reflectPresence() in
   internal/components/offline_banner.templ. */
.online-pill.is-offline {
  background-color: color-mix(in oklab, var(--color-error) 15%, transparent);
  color: var(--color-error);
}
.online-pill.is-offline .pulse-dot {
  background-color: var(--color-error);
  animation: none;
}
/* Hide the online count and show "offline" text when disconnected. */
.online-pill .pill-online { display: inline; }
.online-pill .pill-offline { display: none; }
.online-pill.is-offline .pill-online { display: none; }
.online-pill.is-offline .pill-offline { display: inline; }
@keyframes online-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.8); }
}

/* Theme toggle icons: show the icon that represents the mode you can
   SWITCH TO. In light mode show the moon (go dark); in dark mode show
   the sun (go light). Pure CSS so it works at first paint. The icons are
   inline SVG (internal/icon.Icon), so no script competes with these rules. */
[data-theme="light"] .icon-dark-mode { display: none; }
[data-theme="dark"] .icon-light-mode { display: none; }

/* Cally date picker: DaisyUI's bundle does not style the calendar web
   component's parts, so these token-driven rules keep the picker legible and
   consistent with the surrounding theme. */
.cally {
  font-size: 0.875rem;
}
.cally::part(container) {
  padding: 0.25rem;
}
.cally::part(header) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.25rem 0.25rem 0.5rem;
}
.cally::part(button) {
  border: 0;
  border-radius: 0.375rem;
  background: transparent;
  color: inherit;
  padding: 0.25rem 0.4rem;
  cursor: pointer;
}
.cally::part(button):hover,
.cally::part(day):hover {
  background: var(--color-base-200, #f1f5f9);
}
.cally::part(day) {
  border-radius: 0.375rem;
  padding: 0.25rem 0.4rem;
}
.cally::part(selected) {
  background: var(--color-primary, #4f46e5);
  color: var(--color-primary-content, #fff);
}
.cally::part(button day today) {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Cally month takes the popover's width: the calendar is the only content. */
.cally calendar-month { width: 100%; }

/* Date filter popover: native popover gives light dismiss and Escape for free.
   The anchor positions it under the trigger where supported; other browsers
   get a centered fallback. */
#created-filter-btn { anchor-name: --created-filter; }
#created-filter-popover[popover] {
  position: fixed;
  inset: auto;
  margin: 0.35rem 0 0;
  position-anchor: --created-filter;
  position-area: block-end span-inline-end;
  z-index: 100;
  width: max-content;
  min-width: 18rem;
  padding: 0.5rem;
  border: 1px solid var(--color-base-300, var(--border));
  border-radius: var(--radius-box, 0.75rem);
  background: var(--color-base-100, var(--card));
  color: var(--color-base-content, var(--foreground));
  box-shadow: 0 18px 40px -22px rgba(15, 23, 42, 0.45);
}
#created-filter-popover[popover]::backdrop { background: transparent; }
@supports not (position-area: block-end) {
  #created-filter-popover[popover] {
    top: 50%;
    left: 50%;
    translate: -50% -50%;
  }
}
