@import "tailwindcss";

:root {
  --bg-primary: rgba(246, 246, 246, 0.92);
  --bg-secondary: rgba(232, 232, 232, 0.6);
  --bg-tertiary: rgba(210, 210, 210, 0.5);
  --bg-grouped: #fff;
  --bg-inset: rgba(0, 0, 0, 0.04);
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #aeaeb2;
  --border: rgba(0, 0, 0, 0.12);
  --border-row: rgba(0, 0, 0, 0.08);
  --bg-active: rgba(0, 0, 0, 0.06);
  --sidebar-border: rgba(0, 0, 0, 0.12);
  --sidebar-bg: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.35) 0%,
    rgba(255, 255, 255, 0.18) 100%
  );
  --accent: #007aff;
  --accent-hover: #0062d1;
  --destructive: #ff3b30;
  --success: #34c759;
  --warning: #ff9500;
  --fill-toggle-off: rgba(120, 120, 128, 0.16);
  --fill-control: rgba(0, 0, 0, 0.04);
  --shadow-control: 0 0.5px 1px rgba(0, 0, 0, 0.1), 0 0 0 0.5px rgba(0, 0, 0, 0.05);
  --shadow-grouped: 0 0.5px 2px rgba(0, 0, 0, 0.06), 0 0 0 0.5px rgba(0, 0, 0, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-primary: rgba(10, 10, 12, 0.96);
    --bg-secondary: rgba(22, 22, 26, 0.7);
    --bg-tertiary: rgba(34, 34, 38, 0.6);
    --bg-grouped: rgba(20, 20, 24, 0.95);
    --bg-inset: rgba(255, 255, 255, 0.04);
    --text-primary: #f5f5f7;
    --text-secondary: #98989d;
    --text-tertiary: #636366;
    --border: rgba(255, 255, 255, 0.12);
    --border-row: rgba(255, 255, 255, 0.06);
    --bg-active: rgba(255, 255, 255, 0.1);
    --sidebar-border: rgba(255, 255, 255, 0.1);
    --sidebar-bg: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.1) 0%,
      rgba(255, 255, 255, 0.04) 100%
    );
    --accent: #0a84ff;
    --accent-hover: #409cff;
    --destructive: #ff453a;
    --success: #30d158;
    --warning: #ff9f0a;
    --fill-toggle-off: rgba(120, 120, 128, 0.32);
    --fill-control: rgba(255, 255, 255, 0.06);
    --shadow-control: 0 0.5px 1px rgba(0, 0, 0, 0.3), 0 0 0 0.5px rgba(255, 255, 255, 0.06);
    --shadow-grouped: 0 0.5px 2px rgba(0, 0, 0, 0.2), 0 0 0 0.5px rgba(255, 255, 255, 0.08);
  }
}

/* Explicit dark — wins over @media when user picks dark on a light system. */
:root[data-theme="dark"] {
  --bg-primary: rgba(10, 10, 12, 0.96);
  --bg-secondary: rgba(22, 22, 26, 0.7);
  --bg-tertiary: rgba(34, 34, 38, 0.6);
  --bg-grouped: rgba(20, 20, 24, 0.95);
  --bg-inset: rgba(255, 255, 255, 0.04);
  --text-primary: #f5f5f7;
  --text-secondary: #98989d;
  --text-tertiary: #636366;
  --border: rgba(255, 255, 255, 0.12);
  --border-row: rgba(255, 255, 255, 0.06);
  --bg-active: rgba(255, 255, 255, 0.1);
  --sidebar-border: rgba(255, 255, 255, 0.1);
  --sidebar-bg: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.04) 100%
  );
  --accent: #0a84ff;
  --accent-hover: #409cff;
  --destructive: #ff453a;
  --success: #30d158;
  --warning: #ff9f0a;
  --fill-toggle-off: rgba(120, 120, 128, 0.32);
  --fill-control: rgba(255, 255, 255, 0.06);
  --shadow-control: 0 0.5px 1px rgba(0, 0, 0, 0.3), 0 0 0 0.5px rgba(255, 255, 255, 0.06);
  --shadow-grouped: 0 0.5px 2px rgba(0, 0, 0, 0.2), 0 0 0 0.5px rgba(255, 255, 255, 0.08);
}

/* Tell the UA to render native form controls in the chosen mode. */
:root[data-theme="light"] {
  color-scheme: light;
}
:root[data-theme="dark"] {
  color-scheme: dark;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  font-size: 13px;
  color: var(--text-primary);
  background: transparent;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-app-region: no-drag;
  overflow: hidden;
}

/* Remove ugly focus rings, use subtle outline only on keyboard focus */
*:focus {
  outline: none;
}
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── macOS prominent button (filled, bezeled) ───────────────────── */
/* Used by UpdateBanner. Sized for the narrow sidebar (~24px tall). */
.btn-prominent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 24px;
  padding: 0 10px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 510;
  letter-spacing: -0.005em;
  color: #fff;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--accent) 92%, white 8%) 0%,
    var(--accent) 100%
  );
  border: none;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  /* Bezel: hairline edge, inner top highlight, soft drop shadow. */
  box-shadow:
    0 0 0 0.5px color-mix(in srgb, var(--accent) 70%, black 30%),
    inset 0 0.5px 0 rgba(255, 255, 255, 0.28),
    0 1px 1.5px rgba(0, 0, 0, 0.08);
  transition:
    filter 120ms ease,
    transform 80ms ease,
    box-shadow 120ms ease;
}
.btn-prominent:hover {
  filter: brightness(1.06);
}
.btn-prominent:active {
  filter: brightness(0.94);
  transform: translateY(0.5px);
  box-shadow:
    0 0 0 0.5px color-mix(in srgb, var(--accent) 70%, black 36%),
    inset 0 1px 2px rgba(0, 0, 0, 0.14);
}
.btn-prominent:disabled {
  opacity: 0.55;
  cursor: default;
  filter: none;
  transform: none;
}

/* Success-tinted variant — used for "Restart to install". */
.btn-prominent.success {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--success) 92%, white 8%) 0%,
    var(--success) 100%
  );
  box-shadow:
    0 0 0 0.5px color-mix(in srgb, var(--success) 70%, black 30%),
    inset 0 0.5px 0 rgba(255, 255, 255, 0.28),
    0 1px 1.5px rgba(0, 0, 0, 0.08);
}
.btn-prominent.success:active {
  box-shadow:
    0 0 0 0.5px color-mix(in srgb, var(--success) 70%, black 36%),
    inset 0 1px 2px rgba(0, 0, 0, 0.14);
}

/* ── Update banner: idle row vs notification card ───────────────── */
/* Idle: minimal sub-caption with status dot. No card, no border — */
/* must not compete with sidebar content when nothing is happening. */
.update-idle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 8px;
  margin: 0 2px;
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: -0.005em;
}
.update-idle .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0.5px color-mix(in srgb, var(--success) 60%, black 40%);
  flex-shrink: 0;
}
.update-idle.error .dot {
  background: var(--warning);
  box-shadow: 0 0 0 0.5px color-mix(in srgb, var(--warning) 60%, black 40%);
}
.update-idle .label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

/* Inline refresh icon — sits on the right of the status row / card title. */
.update-refresh {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: auto;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: var(--text-tertiary);
  cursor: pointer;
  flex-shrink: 0;
  transition:
    background 120ms ease,
    color 120ms ease;
}
.update-refresh:hover {
  background: var(--bg-active);
  color: var(--text-primary);
}
.update-refresh:active {
  background: var(--bg-hover);
}
.update-refresh:disabled {
  cursor: default;
  opacity: 0.7;
}
.update-refresh.spinning svg {
  animation: update-refresh-spin 800ms linear infinite;
}
@keyframes update-refresh-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Card: a translucent elevated tile that appears when there's something */
/* the user can act on. Spring-in for native feel. */
.update-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 4px 2px;
  padding: 10px;
  background: var(--bg-tertiary);
  border: 0.5px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-control);
  animation: update-card-in 260ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes update-card-in {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.update-card .title {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 590;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
.update-card .subtitle {
  font-size: 10.5px;
  color: var(--text-tertiary);
  line-height: 1.25;
  letter-spacing: -0.005em;
}
.update-card .subtitle.error {
  color: var(--warning);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.update-card .ready-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  height: 12px;
  color: var(--success);
}

/* ── Sidebar footer: settings button + icon-only theme toggle ───── */
.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 4px;
  margin-bottom: 2px;
}
.sidebar-footer .nav-button {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.005em;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition:
    background 120ms ease,
    color 120ms ease;
  -webkit-app-region: no-drag;
}
.sidebar-footer .nav-button:hover {
  background: var(--bg-active);
  color: var(--text-primary);
}
.sidebar-footer .nav-button.active {
  background: var(--bg-active);
  color: var(--text-primary);
}

/* Square icon button — used for the theme toggle. */
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  transition:
    background 120ms ease,
    color 120ms ease,
    transform 120ms ease;
  -webkit-app-region: no-drag;
}
.icon-button:hover {
  background: var(--bg-active);
  color: var(--text-primary);
}
.icon-button:active {
  transform: scale(0.92);
}
.icon-button svg {
  width: 14px;
  height: 14px;
  display: block;
}
