/*
 * Theme derived from konghq.com: a near-black/deep-green dark theme with a
 * lime accent, and a light sage-grey counterpart. Defaults to the visitor's
 * OS preference (prefers-color-scheme) and can be overridden manually via
 * the theme toggle, persisted in localStorage, exactly like konghq.com.
 */

:root {
  --color-bg: #001408;
  --color-bg-100: #07090d;
  --color-bg-200: #0f1913;
  --color-surface: #10241a;
  --color-border: #2a3f33;
  --color-text: #ffffff;
  --color-text-muted: #a9b6ae;
  /* Kong's lime accent is constant across both themes (buttons, active
     tabs) - it never becomes a darker green, unlike our dark-mode-only
     logo accent below. */
  --color-primary: #ccff00;
  --color-primary-text: #000000;
  /* Brand "ink" accent used for the logo/wordmark: lime on dark
     backgrounds, black on light backgrounds (matches konghq.com). */
  --color-brand-ink: #ccff00;
  --color-danger: #e50000;
}

html[data-theme='light'] {
  --color-bg: #cdd4cb;
  --color-bg-100: #d7ded4;
  --color-bg-200: #edeff2;
  --color-surface: #d7ded4;
  --color-border: #aeb5a7;
  --color-text: #0b0c0f;
  --color-text-muted: #4a534c;
  --color-primary: #ccff00;
  --color-primary-text: #000000;
  --color-brand-ink: #000000;
  --color-danger: #e50000;
}

@media (prefers-color-scheme: light) {
  html:not([data-theme]) {
    --color-bg: #cdd4cb;
    --color-bg-100: #d7ded4;
    --color-bg-200: #edeff2;
    --color-surface: #d7ded4;
    --color-border: #aeb5a7;
    --color-text: #0b0c0f;
    --color-text-muted: #4a534c;
    --color-primary: #ccff00;
    --color-primary-text: #000000;
    --color-brand-ink: #000000;
    --color-danger: #e50000;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--color-bg);
  color: var(--color-text);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.hidden {
  display: none !important;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-100);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.kong-logo {
  height: 24px;
  width: auto;
  /* Bright yellow/lime in dark mode; black in light mode (see
     --color-brand-ink above). */
  color: var(--color-brand-ink);
}

.topbar__title {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn--primary {
  background: var(--color-primary);
  color: var(--color-primary-text);
}

.btn--primary:hover {
  filter: brightness(1.08);
}

.btn--ghost {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn--ghost:hover {
  background: var(--color-bg-200);
}

.btn--lg {
  padding: 12px 28px;
  font-size: 16px;
}

.content {
  flex: 1;
  padding: 48px 32px;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

.hero {
  text-align: center;
  padding: 64px 16px;
}

.hero h1 {
  font-size: 36px;
  margin: 0 0 12px;
}

.hero__subtitle {
  color: var(--color-text-muted);
  font-size: 16px;
  margin: 0 0 32px;
}

.dashboard h1 {
  margin-bottom: 4px;
}

.muted {
  color: var(--color-text-muted);
  margin-top: 0;
}

.period-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin: 8px 0 24px;
  background: var(--color-bg-200);
  border: 1px solid var(--color-border);
  border-radius: 999px;
}

.period-tab {
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.period-tab:hover {
  color: var(--color-text);
}

.period-tab[aria-selected='true'] {
  background: var(--color-primary);
  color: var(--color-primary-text);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 24px 0 40px;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card__label {
  font-size: 13px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.card__value {
  font-size: 28px;
  font-weight: 700;
}

.card__value--small {
  font-size: 15px;
  font-weight: 500;
}

.table-wrap {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
}

.usage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.usage-table th,
.usage-table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
}

.usage-table th {
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.usage-table tbody tr:last-child td {
  border-bottom: none;
}

.banner {
  border-radius: 10px;
  padding: 14px 18px;
  margin: 16px 0;
  font-size: 14px;
}

.banner--error {
  background: color-mix(in srgb, var(--color-danger) 15%, transparent);
  border: 1px solid var(--color-danger);
  color: var(--color-danger);
}

.loading {
  text-align: center;
  color: var(--color-text-muted);
  padding: 32px;
}

.footer {
  text-align: center;
  padding: 20px;
  color: var(--color-text-muted);
  font-size: 12px;
  border-top: 1px solid var(--color-border);
}
