/* ─── Infinigate Dark Theme ─────────────────────────────────────────────────── */
:root {
  --bg-primary:    #0d1117;
  --bg-secondary:  #161b22;
  --bg-card:       #1c2333;
  --bg-card-hover: #21293a;
  --bg-input:      #0d1117;
  --bg-modal:      #161b22;

  --border:        #30363d;
  --border-focus:  #58a6ff;

  --text-primary:  #e6edf3;
  --text-secondary:#8b949e;
  --text-muted:    #6e7681;

  --accent-blue:   #58a6ff;
  --accent-green:  #3fb950;
  --accent-orange: #f0883e;
  --accent-red:    #f85149;
  --accent-purple: #bc8cff;

  /* Infinigate brand */
  --brand-primary: #e8612c;
  --brand-hover:   #f07040;

  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  16px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,.4);
  --shadow-md:  0 4px 16px rgba(0,0,0,.5);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.6);

  --font-sans:  'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:  'Fira Code', 'Cascadia Code', 'Consolas', monospace;

  --transition: 150ms ease;
}

/* ─── Reset / Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Header ────────────────────────────────────────────────────────────────── */
.site-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.site-header .inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.site-logo img, .site-logo svg { height: 32px; width: auto; }

.site-logo .site-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.header-spacer { flex: 1; }

.header-nav { display: flex; align-items: center; gap: 12px; }

/* ─── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition), opacity var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--brand-primary);
  color: #fff;
  border-color: var(--brand-primary);
}
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--border-focus); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-card); color: var(--text-primary); }

.btn-danger {
  background: transparent;
  color: var(--accent-red);
  border-color: var(--accent-red);
}
.btn-danger:hover { background: rgba(248,81,73,.1); }

.btn-sm { padding: 5px 10px; font-size: .8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn:disabled { opacity: .5; pointer-events: none; }

/* ─── Badges ────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.badge-amp { background: rgba(188,140,255,.15); color: var(--accent-purple); }
.badge-ps1 { background: rgba(63,185,80,.15);  color: var(--accent-green); }
.badge-draft { background: rgba(240,136,62,.15); color: var(--accent-orange); }
.badge-published { background: rgba(63,185,80,.15); color: var(--accent-green); }

/* ─── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.card:hover {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-md);
  background: var(--bg-card-hover);
}

/* ─── Form elements ─────────────────────────────────────────────────────────── */
.input, .textarea, .select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: .9rem;
  padding: 8px 12px;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(88,166,255,.15);
}
.textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
.select { appearance: none; cursor: pointer; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: .85rem; font-weight: 500; color: var(--text-secondary); }

/* ─── Tag pills ─────────────────────────────────────────────────────────────── */
.tag-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
}
.tag-pill:hover { opacity: .85; transform: translateY(-1px); }
.tag-pill.active { box-shadow: 0 0 0 2px currentColor; }

/* ─── Loading spinner ───────────────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Toast notifications ───────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-size: .9rem;
  box-shadow: var(--shadow-lg);
  animation: slideIn .2s ease;
  max-width: 360px;
}
.toast.success { border-left: 3px solid var(--accent-green); }
.toast.error   { border-left: 3px solid var(--accent-red); }
.toast.info    { border-left: 3px solid var(--accent-blue); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: none; opacity: 1; } }

/* ─── Modal ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1.1rem; font-weight: 600; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-secondary); font-size: 1.4rem; line-height: 1;
  padding: 4px; border-radius: var(--radius-sm);
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text-primary); }

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ─── Empty state ───────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-muted);
}
.empty-state svg { margin-bottom: 16px; opacity: .4; }
.empty-state h3 { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 8px; }

/* ─── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Utilities ─────────────────────────────────────────────────────────────── */
.hidden   { display: none !important; }
.sr-only  { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flex     { display: flex; }
.flex-col { flex-direction: column; }
.gap-2    { gap: 8px; }
.gap-3    { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.text-sm { font-size: .875rem; }
.text-xs { font-size: .78rem; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.font-mono { font-family: var(--font-mono); }
