/* ------------------------------------------------------------------ *
 * Blogger design system — shadcn/ui-inspired tokens + components.
 * Default tokens here are the light "zinc" palette; the public site
 * overrides them per blog via an injected :root block (ThemeCssBuilder).
 * ------------------------------------------------------------------ */

:root {
  --background: #ffffff;
  --foreground: #09090b;
  --card: #ffffff;
  --card-foreground: #09090b;
  --primary: #18181b;
  --primary-foreground: #fafafa;
  --secondary: #f4f4f5;
  --secondary-foreground: #18181b;
  --muted: #f4f4f5;
  --muted-foreground: #71717a;
  --accent: #f4f4f5;
  --accent-foreground: #18181b;
  --destructive: #ef4444;
  --destructive-foreground: #fafafa;
  --border: #e4e4e7;
  --input: #e4e4e7;
  --ring: #18181b;
  --radius: 0.5rem;
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg, video { display: block; max-width: 100%; height: auto; }

h1, h2, h3, h4 { line-height: 1.2; font-weight: 600; letter-spacing: -0.02em; }

/* ---------- Layout helpers ---------- */
.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }
.container-narrow { max-width: 720px; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; align-items: center; gap: 0.75rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; }
.muted { color: var(--muted-foreground); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-4 { margin-top: 2rem; }
.mb-2 { margin-bottom: 1rem; }
.hidden { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  height: 2.5rem; padding: 0 1rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 0.875rem; font-weight: 500; line-height: 1;
  cursor: pointer; white-space: nowrap; user-select: none;
  transition: background-color .15s, color .15s, border-color .15s, opacity .15s, box-shadow .15s;
}
.btn:hover { text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-sm { height: 2.125rem; padding: 0 0.75rem; font-size: 0.8125rem; }
.btn-lg { height: 2.75rem; padding: 0 1.5rem; font-size: 0.95rem; }
.btn-block { width: 100%; }

.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { opacity: .9; }
.btn-outline { background: var(--background); color: var(--foreground); border-color: var(--border); }
.btn-outline:hover { background: var(--accent); color: var(--accent-foreground); }
.btn-ghost { background: transparent; color: var(--foreground); }
.btn-ghost:hover { background: var(--accent); color: var(--accent-foreground); }
.btn-secondary { background: var(--secondary); color: var(--secondary-foreground); }
.btn-secondary:hover { opacity: .85; }
.btn-destructive { background: var(--destructive); color: var(--destructive-foreground); }
.btn-destructive:hover { opacity: .9; }

/* ---------- Cards ---------- */
.card {
  background: var(--card); color: var(--card-foreground);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.04);
}
.card-header { padding: 1.25rem 1.5rem 0.75rem; }
.card-content { padding: 1.25rem 1.5rem; }
.card-footer { padding: 0.75rem 1.5rem 1.25rem; display: flex; gap: 0.5rem; }
.card-title { font-size: 1.125rem; font-weight: 600; }
.card-description { color: var(--muted-foreground); font-size: 0.875rem; margin-top: 0.25rem; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1rem; }
.label { font-size: 0.875rem; font-weight: 500; }
.input, .textarea, .select {
  width: 100%; font: inherit; font-size: 0.875rem; color: var(--foreground);
  background: var(--background);
  border: 1px solid var(--input); border-radius: var(--radius);
  padding: 0.5rem 0.75rem; min-height: 2.5rem;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 9rem; resize: vertical; line-height: 1.5; }
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 25%, transparent);
}
.input-color { padding: 0.25rem; height: 2.5rem; width: 100%; cursor: pointer; }
.checkbox-row { display: flex; align-items: center; gap: 0.5rem; }
.checkbox-row input { width: 1rem; height: 1rem; accent-color: var(--primary); }
.field-hint { font-size: 0.75rem; color: var(--muted-foreground); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1rem; }

.validation-summary-errors, .text-danger, .field-validation-error {
  color: var(--destructive); font-size: 0.8125rem;
}
.validation-summary-errors ul { margin: 0; padding-left: 1.1rem; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  border-radius: 9999px; padding: 0.15rem 0.6rem;
  font-size: 0.72rem; font-weight: 600; line-height: 1.4;
  border: 1px solid transparent;
}
.badge-primary { background: var(--primary); color: var(--primary-foreground); }
.badge-secondary { background: var(--secondary); color: var(--secondary-foreground); }
.badge-outline { border-color: var(--border); color: var(--muted-foreground); }
.badge-success { background: #16a34a; color: #fff; }
.badge-warning { background: #f59e0b; color: #1f1300; }

/* ---------- Alerts ---------- */
.alert {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.75rem 1rem; font-size: 0.875rem; background: var(--muted);
}
.alert-destructive {
  border-color: color-mix(in srgb, var(--destructive) 40%, var(--border));
  background: color-mix(in srgb, var(--destructive) 10%, var(--background));
  color: var(--destructive);
}
.alert-success {
  border-color: color-mix(in srgb, #16a34a 40%, var(--border));
  background: color-mix(in srgb, #16a34a 10%, var(--background));
  color: #15803d;
}

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th, .table td { text-align: left; padding: 0.75rem 0.75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { color: var(--muted-foreground); font-weight: 500; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
.table tbody tr:hover { background: var(--muted); }
.table-actions { display: flex; gap: 0.4rem; justify-content: flex-end; }

/* ---------- Separator ---------- */
.separator { height: 1px; background: var(--border); border: 0; margin: 1.5rem 0; }

/* ---------- Empty state ---------- */
.empty {
  text-align: center; padding: 3rem 1rem; color: var(--muted-foreground);
  border: 1px dashed var(--border); border-radius: var(--radius);
}
