@source ".";

:root {
  --athena-auth-ui-control-radius: var(--field-radius);

  /* Common showcase & chat surface radii (to eliminate duplicated arbitrary values) */
  --athena-radius-card: 28px;
  --athena-radius-section: 24px;
  --athena-radius-bubble: 22px;
  --athena-radius-small: 14px;
  --athena-radius-compact: 20px;

  /* Common viewport-constrained heights used in auth flows & showcases */
  --athena-min-h-viewport: calc(100svh - 3.75rem);

  /*
   * Email palette mirrors HeroUI semantic tokens.
   * React Email cannot use var() in many clients, so email templates read the
   * matching concrete values from `email-colors.ts` (keep those in sync).
   */
  --athena-email-background: var(--background);
  --athena-email-primary: var(--accent);
  --athena-email-primary-foreground: var(--accent-foreground);
}

:root,
.light,
.default,
[data-theme="light"],
[data-theme="default"] {
  /* Thin scrollbar thumb (light / default themes) */
  --scrollbar: oklch(87.1% 0.0015 253.83);
}

.dark,
[data-theme="dark"] {
  --scrollbar: oklch(70.5% 0.0015 253.83);
}

/* Visible thin scrollbar — apply on scroll containers */
.scrollbar {
  scrollbar-color: var(--scrollbar) transparent;
  scrollbar-width: thin;
}

/*
 * AthenaTable chip tones (status / boolean / colorMap).
 * Reinforce HeroUI Chip colors via data-color so soft fills stay distinct when
 * BEM compound selectors or Tailwind content scanning miss dynamic class names.
 */
[data-slot="chip"][data-color="accent"] {
  --chip-bg: var(--accent-soft);
  --chip-fg: var(--accent-soft-foreground);
  color: var(--chip-fg);
  background-color: var(--chip-bg);
}

[data-slot="chip"][data-color="success"] {
  --chip-bg: var(--success-soft);
  --chip-fg: var(--success-soft-foreground);
  color: var(--chip-fg);
  background-color: var(--chip-bg);
}

[data-slot="chip"][data-color="warning"] {
  --chip-bg: var(--warning-soft);
  --chip-fg: var(--warning-soft-foreground);
  color: var(--chip-fg);
  background-color: var(--chip-bg);
}

[data-slot="chip"][data-color="danger"] {
  --chip-bg: var(--danger-soft);
  --chip-fg: var(--danger-soft-foreground);
  color: var(--chip-fg);
  background-color: var(--chip-bg);
}

[data-slot="chip"][data-color="default"] {
  --chip-bg: var(--default-soft);
  --chip-fg: var(--default-soft-foreground);
  color: var(--chip-fg);
  background-color: var(--chip-bg);
}

/* Primary (solid) chip fills when HeroUI variant="primary" is also set */
[data-slot="chip"].chip--primary[data-color="accent"] {
  --chip-bg: var(--accent);
  --chip-fg: var(--accent-foreground);
}

[data-slot="chip"].chip--primary[data-color="success"] {
  --chip-bg: var(--success);
  --chip-fg: var(--success-foreground);
}

[data-slot="chip"].chip--primary[data-color="warning"] {
  --chip-bg: var(--warning);
  --chip-fg: var(--warning-foreground);
}

[data-slot="chip"].chip--primary[data-color="danger"] {
  --chip-bg: var(--danger);
  --chip-fg: var(--danger-foreground);
}

[data-slot="chip"].chip--primary[data-color="default"] {
  --chip-bg: var(--default);
  --chip-fg: var(--default-foreground);
}

/* Tertiary: colored text on transparent fill */
[data-slot="chip"].chip--tertiary[data-color] {
  --chip-bg: transparent;
}

/* Hidden scrollbar while still scrollable */
.invisible-scrollbar {
  -ms-overflow-style: none; /* IE and Edge */
  scrollbar-width: none; /* Firefox */
}

.invisible-scrollbar::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

/*
 * AthenaTable desktop containment: columns share the table width and cells
 * clip at the column edge instead of overflowing into neighbors.
 * Body-scroll mode also uses table-layout: fixed on header/row tables below.
 */
.table-root .table__content,
.table-root [data-slot="table-content"] {
  width: 100%;
  table-layout: fixed;
}

.table-root .table__cell,
.table-root [data-slot="table-cell"] {
  overflow: hidden;
}

/*
 * AthenaTable body-only vertical scroll.
 * Keeps thead outside the vertical scrollport so rows stop at the header edge
 * instead of scrolling underneath a sticky (often transparent) header.
 */
.athena-table--body-scroll {
  display: block;
  width: 100%;
}

.athena-table--body-scroll [data-slot="table-header"] {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.athena-table--body-scroll [data-slot="table-body"] {
  display: block;
  width: 100%;
  max-height: var(--athena-table-body-max-height);
  overflow-x: hidden;
  overflow-y: auto;
}

.athena-table--body-scroll [data-slot="table-body"] [data-slot="table-row"] {
  display: table;
  width: 100%;
  table-layout: fixed;
}

/*
 * Empty-state centering for desktop AthenaTable (md/lg/xl/auto).
 * React Aria renders empty content as a single row + rowheader cell and sets
 * `data-empty` on the body. Center that content in the body viewport.
 */
.table-root [data-slot="table-body"][data-empty] {
  min-height: 16rem;
}

/* Non-scroll tables: give the empty row real height and middle-align the cell. */
.table-root [data-slot="table-body"][data-empty] > [data-slot="table-row"] {
  height: 16rem;
}

.table-root [data-slot="table-body"][data-empty] [data-slot="table-row"],
.table-root [data-slot="table-body"][data-empty] [data-slot="table-cell"] {
  background: transparent;
  border: none;
  box-shadow: none;
}

.table-root [data-slot="table-body"][data-empty] [data-slot="table-cell"] {
  width: 100%;
  padding-block: 0;
  vertical-align: middle;
  text-align: center;
}

/* Body-scroll tables: flex-center within the configured body max-height. */
.athena-table--body-scroll [data-slot="table-body"][data-empty] {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--athena-table-body-max-height, 16rem);
}

.athena-table--body-scroll
  [data-slot="table-body"][data-empty]
  > [data-slot="table-row"] {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: auto;
  min-height: 100%;
  table-layout: auto;
  border: none;
}

.button {
  border-radius: var(--athena-auth-ui-control-radius);
}

.input-group {
  overflow: hidden;
  border-radius: var(--athena-auth-ui-control-radius);
  isolation: isolate;
}

.input-group__input {
  background-clip: padding-box;
  border-radius: inherit;
}

.input-group:has([data-slot="input-group-prefix"]) .input-group__input {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.input-group:has([data-slot="input-group-suffix"]) .input-group__input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-group__prefix {
  border-top-left-radius: var(--athena-auth-ui-control-radius);
  border-bottom-left-radius: var(--athena-auth-ui-control-radius);
}

.input-group__suffix {
  border-top-right-radius: var(--athena-auth-ui-control-radius);
  border-bottom-right-radius: var(--athena-auth-ui-control-radius);
}

/* -------------------------------------------------
   Duplication-optimized classes for repeated
   arbitrary Tailwind values across the UI.
   Use via className or cn("chat-card", ...)
-------------------------------------------------- */

.chat-card,
.showcase-card {
  border-radius: var(--athena-radius-card);
}

.surface,
.section-surface,
.tool-section {
  border-radius: var(--athena-radius-section);
}

.chat-bubble,
.chat-message {
  border-radius: var(--athena-radius-bubble);
}

.chat-composer-shell {
  border-radius: var(--athena-radius-section);
}

.chat-mention {
  padding-inline: 0.2rem;
  font-weight: 600;
  color: var(--foreground);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-radius: 0.375rem;
}

.chat-mention:hover {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}

.chat-activity-connector {
  background: color-mix(in srgb, var(--color-default-400) 55%, transparent);
}

@media (prefers-reduced-motion: reduce) {
  .chat-message,
  .chat-reaction,
  .chat-composer-shell {
    transition: none !important;
  }
}

.avatar-small {
  border-radius: var(--athena-radius-small);
}

.compact-surface {
  border-radius: var(--athena-radius-compact);
}

/* Repeated subtle tint surfaces */
.tint-surface,
.empty-surface {
  background-color: color-mix(
    in srgb,
    var(--color-default-100) 45%,
    transparent
  );
}

.tint-surface-35 {
  background-color: color-mix(
    in srgb,
    var(--color-default-100) 35%,
    transparent
  );
}

/* Viewport min-height used in route loaders, chat, etc. */
.min-h-viewport {
  min-height: var(--athena-min-h-viewport);
}

/* Common modal widths to reduce calc duplication */
.modal-dialog {
  width: min(44rem, calc(100vw - 1rem));
}

/*
 * Dense dialog shell — HeroUI defaults to p-6 + large section gaps.
 * One surface pad; close sits in the pad inset.
 */
.athena-dialog {
  @apply gap-0 p-4;
}

.athena-dialog :is(.modal__header, .alert-dialog__header) {
  @apply gap-2 pr-8;
}

.athena-dialog :is(.modal__heading, .alert-dialog__heading) {
  @apply text-sm font-semibold leading-snug;
}

.athena-dialog :is(.modal__body, .alert-dialog__body) {
  @apply m-0 p-0;
}

.athena-dialog :is(.modal__footer, .alert-dialog__footer) {
  @apply gap-2;
}

.athena-dialog
  :is(.modal__header, .alert-dialog__header)
  + :is(.modal__body, .alert-dialog__body) {
  @apply mt-2.5;
}

.athena-dialog
  :is(.modal__header, .modal__body, .alert-dialog__header, .alert-dialog__body)
  + :is(.modal__footer, .alert-dialog__footer) {
  @apply mt-3.5;
}

.athena-dialog :is(.modal__close-trigger, .alert-dialog__close-trigger) {
  @apply top-3 right-3;
}

.athena-dialog--drawer {
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  @apply pt-3;
}

.athena-dialog--drawer .drawer__header {
  @apply gap-1.5 pb-0;
}

.athena-dialog--drawer .drawer__body {
  @apply m-0 p-0 pt-2.5;
}

.athena-dialog--drawer .drawer__footer {
  @apply gap-2 pt-3.5;
}

.athena-sidebar :is([data-slot="separator"], hr) {
  @apply opacity-70;
}

/* Scroll containers in tool panels */
.scroll-panel {
  max-height: 46rem;
}

/* Auth route card style (slightly different radius) */
.auth-card {
  border-radius: 2rem;
}

/*
 * Settings shell: container queries own desktop vs compact columns so route
 * changes never remount-measure into a compact flash. Do not transition
 * grid-template-columns / width — those produce the content-column "breath".
 */
.athena-settings-shell {
  container-name: athena-settings;
  container-type: inline-size;
}

.athena-settings-layout {
  min-width: 0;
}

@container athena-settings (min-width: 720px) {
  .athena-settings-layout[data-layout="unknown"]:not([data-hide-nav="true"]) {
    --settings-sidebar-gap: 1.5rem;
    --settings-sidebar-width: 16rem;
  }
}

@keyframes athena-settings-panel-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.athena-settings-panel-enter {
  animation: athena-settings-panel-in 150ms ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .athena-settings-panel-enter {
    animation: none;
  }
}
