/* ---------------------------------------------------------------
   Mirror AI — developer portal shared stylesheet

   Used by: index.html, login.html, register.html, dashboard.html,
   billing.html, docs.html.

   Design tokens are surfaced as CSS variables so per-page tweaks
   (e.g. wider docs sidebar) can override them in a <style> block
   without touching this file.
   --------------------------------------------------------------- */

:root {
  /* palette: neutral surface + single indigo accent */
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --soft: #94a3b8;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --ok: #16a34a;
  --ok-soft: #dcfce7;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;

  /* spacing scale */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 48px;
  --s-16: 64px;

  /* radii */
  --r-1: 6px;
  --r-2: 10px;
  --r-3: 14px;

  /* shadows (subtle — this is a B2B tool, not a marketing site) */
  --shadow-1: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-2: 0 4px 12px rgba(15, 23, 42, 0.06);

  /* typography */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono",
    "JetBrains Mono", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}
h1 {
  font-size: 28px;
  line-height: 1.25;
}
h2 {
  font-size: 22px;
  line-height: 1.3;
}
h3 {
  font-size: 17px;
  line-height: 1.4;
}
h4 {
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink-2);
}

p {
  margin: 0 0 var(--s-3) 0;
  color: var(--ink-2);
}

small,
.text-muted {
  color: var(--muted);
  font-size: 13px;
}

code,
kbd {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

pre {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  background: #0f172a;
  color: #e2e8f0;
  padding: var(--s-4);
  border-radius: var(--r-2);
  overflow-x: auto;
  margin: 0;
}
pre code {
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

/* ---------------- top navigation (used by dashboard / billing / docs) */

.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 var(--s-6);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topnav .brand {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-weight: 600;
  color: var(--ink);
  font-size: 16px;
}
.topnav .brand:hover {
  text-decoration: none;
}

.topnav .brand-dot {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: linear-gradient(135deg, var(--accent), #6366f1);
}

.topnav nav {
  display: flex;
  align-items: center;
  gap: var(--s-5);
}
.topnav nav a {
  color: var(--ink-2);
  font-weight: 500;
  font-size: 14px;
}
.topnav nav a:hover {
  color: var(--ink);
  text-decoration: none;
}
.topnav nav a.active {
  color: var(--accent);
}

.topnav .user-block {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-size: 13px;
  color: var(--muted);
}

/* ---------------- containers / cards */

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--s-8) var(--s-6);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  padding: var(--s-6);
  box-shadow: var(--shadow-1);
}

.card + .card {
  margin-top: var(--s-5);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}

.card-title {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.card-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: var(--s-1);
}

.grid {
  display: grid;
  gap: var(--s-5);
}
.grid.cols-2 {
  grid-template-columns: 1fr 1fr;
}
.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 720px) {
  .grid.cols-2,
  .grid.cols-3 {
    grid-template-columns: 1fr;
  }
}

/* ---------------- forms */

.form-row {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin-bottom: var(--s-4);
}

label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-2);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.1s, box-shadow 0.1s;
}

input:focus,
textarea:focus,
select:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

input::placeholder,
textarea::placeholder {
  color: var(--soft);
}

/* ---------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 9px 16px;
  border-radius: var(--r-2);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s, color 0.1s, transform 0.05s;
  text-decoration: none;
}
.btn:hover {
  text-decoration: none;
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border-strong);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--ink);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--ink);
}

.btn-danger {
  background: var(--surface);
  color: var(--danger);
  border-color: var(--border-strong);
}
.btn-danger:hover:not(:disabled) {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 13px;
}

/* ---------------- banners / alerts */

.banner {
  padding: 10px 14px;
  border-radius: var(--r-2);
  font-size: 14px;
  border: 1px solid transparent;
  margin-bottom: var(--s-4);
}
.banner-info {
  background: var(--accent-soft);
  border-color: #c7d2fe;
  color: #3730a3;
}
.banner-ok {
  background: var(--ok-soft);
  border-color: #bbf7d0;
  color: #166534;
}
.banner-warn {
  background: var(--warn-soft);
  border-color: #fde68a;
  color: #92400e;
}
.banner-error {
  background: var(--danger-soft);
  border-color: #fecaca;
  color: #991b1b;
}

/* ---------------- tables */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th,
.table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.table th {
  font-weight: 500;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--surface-2);
}
.table tbody tr:last-child td {
  border-bottom: 0;
}
.table-empty {
  text-align: center;
  padding: var(--s-8);
  color: var(--muted);
  font-size: 14px;
}

/* ---------------- code field (api key etc.) */

.code-field {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 8px 8px 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
}
.code-field code {
  background: transparent;
  border: 0;
  padding: 0;
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ---------------- centred auth card layout */

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-8) var(--s-4);
  background: var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  padding: var(--s-8);
  box-shadow: var(--shadow-2);
}
.auth-card h1 {
  text-align: center;
  font-size: 22px;
  margin-bottom: var(--s-2);
}
.auth-card .auth-sub {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: var(--s-6);
}
.auth-card .auth-footer {
  margin-top: var(--s-5);
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

/* small util */

.row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
}
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}
.spacer {
  flex: 1;
}
.muted {
  color: var(--muted);
}
.mono {
  font-family: var(--font-mono);
}
.nowrap {
  white-space: nowrap;
}
.hidden {
  display: none !important;
}
.mt-2 {
  margin-top: var(--s-2);
}
.mt-4 {
  margin-top: var(--s-4);
}
.mt-6 {
  margin-top: var(--s-6);
}
.mb-2 {
  margin-bottom: var(--s-2);
}
.mb-4 {
  margin-bottom: var(--s-4);
}
