/* CoopClaw Cloud - Design System
   Professional light theme. No inline styles in templates.
   Every class referenced by app/templates/*.py is defined here. */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* === Design Tokens === */
:root {
  /* Brand */
  --brand:          #2563EB;
  --brand-hover:    #1d4ed8;
  --brand-light:    #3b82f6;
  --brand-bg:       rgba(37,99,235,0.06);
  --brand-secondary: #0EA5E9;
  --brand-accent:   #7C3AED;

  /* Neutrals */
  --bg:             #FFFFFF;
  --bg-subtle:      #F8FAFC;
  --bg-muted:       #F1F5F9;
  --bg-dark:        #0F172A;
  --border:         #E2E8F0;
  --border-strong:  #CBD5E1;

  /* Text */
  --text:           #0F172A;
  --text-secondary: #334155;
  --text-muted:     #64748B;
  --text-dim:       #94A3B8;

  /* Status */
  --success:        #16A34A;
  --success-bg:     #dcfce7;
  --warning:        #D97706;
  --warning-bg:     #fef9c3;
  --error:          #DC2626;
  --info:           #2563EB;

  /* Agent status */
  --agent-idle:     #94A3B8;
  --agent-busy:     #2563EB;
  --agent-offline:  #E2E8F0;

  /* Typography */
  --font:           'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:      'JetBrains Mono', 'Fira Code', monospace;
  --text-xs:        0.75rem;
  --text-sm:        0.875rem;
  --text-base:      1rem;
  --text-lg:        1.125rem;
  --text-xl:        1.25rem;
  --text-2xl:       1.5rem;
  --text-3xl:       1.875rem;
  --text-4xl:       2.25rem;

  /* Spacing */
  --space-1:  0.25rem;  --space-2:  0.5rem;   --space-3:  0.75rem;
  --space-4:  1rem;     --space-6:  1.5rem;    --space-8:  2rem;
  --space-10: 2.5rem;   --space-12: 3rem;      --space-16: 4rem;
  --space-24: 6rem;

  /* Layout */
  --max-width:        1200px;
  --max-width-narrow: 720px;
  --radius-sm:        4px;
  --radius-md:        6px;
  --radius-lg:        8px;
  --radius-xl:        12px;
  --transition:       0.15s ease;
  --shadow-sm:        0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:        0 4px 6px rgba(0,0,0,0.07);
  --shadow-lg:        0 10px 25px rgba(0,0,0,0.1);
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: var(--text-base);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--brand-hover); }
code, pre { font-family: var(--font-mono); }
img { max-width: 100%; display: block; }

/* === Layout === */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 var(--space-6); }
.container-narrow { max-width: var(--max-width-narrow); margin: 0 auto; padding: 0 var(--space-6); }

/* === Navigation === */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 var(--space-6);
  display: flex; align-items: center; height: 64px;
}

.nav-brand {
  font-weight: 700; font-size: var(--text-lg);
  color: var(--text); text-decoration: none;
  display: flex; align-items: center; gap: var(--space-2);
}
.nav-brand:hover { color: var(--brand); text-decoration: none; }

.nav-links {
  display: flex; gap: var(--space-6); margin-left: var(--space-8);
}
.nav-links a {
  font-size: var(--text-sm); color: var(--text-secondary);
  font-weight: 500; transition: color var(--transition);
  text-decoration: none;
}
.nav-links a:hover { color: var(--text); text-decoration: none; }

.nav-actions {
  margin-left: auto;
  display: flex; gap: var(--space-3); align-items: center;
}

/* === Sections === */
section { padding: var(--space-24) 0; }
section:nth-child(even) { background: var(--bg-subtle); }

/* === Hero === */
.hero {
  padding: 7rem 0 5rem;
  background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 50%, #eff6ff 100%);
  text-align: center;
}
.hero h1 {
  font-size: var(--text-4xl); font-weight: 700;
  line-height: 1.1; letter-spacing: -0.02em;
  max-width: 700px; margin: 0 auto;
}
.hero-subtitle {
  font-size: var(--text-xl); color: var(--text-secondary);
  max-width: 640px; margin: var(--space-6) auto 0;
  line-height: 1.6;
}
.hero-actions {
  display: flex; gap: var(--space-4);
  justify-content: center; margin-top: var(--space-8);
}

/* === Install Strip === */
.install-strip {
  padding: var(--space-8) 0;
  background: var(--bg);
}

/* === Terminal Block === */
.terminal-block {
  background: var(--bg-dark); color: #E2E8F0;
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-6);
  font-family: var(--font-mono); font-size: var(--text-sm);
  position: relative;
  line-height: 1.6;
}
.terminal-block .prompt { color: var(--brand-secondary); user-select: none; }
.terminal-block .copy-btn {
  position: absolute; top: var(--space-3); right: var(--space-3);
  background: rgba(255,255,255,0.08); color: var(--text-dim);
  border: none; border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs); font-family: var(--font);
  cursor: pointer; transition: background var(--transition);
}
.terminal-block .copy-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }

/* === How It Works / Feature Cards === */
.step-icon { font-size: 2rem; margin-bottom: var(--space-4); }
.section-title { text-align: center; }

/* === Live Stats Bar === */
.stats-bar {
  padding: var(--space-6) 0;
  background: var(--brand);
  color: #fff;
}
.stats-bar-inner {
  display: flex; gap: var(--space-6);
  align-items: center; justify-content: center;
}

/* === Cards === */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-sm); }
.card-muted { background: var(--bg-muted); }
.card-highlight { border-color: var(--brand); }
.card-center { text-align: center; }

/* === Stat Cards === */
.stat-card { text-align: center; }
.stat-value {
  font-size: var(--text-3xl); font-weight: 700;
  color: var(--text); line-height: 1.2;
}
.stat-label {
  font-size: var(--text-sm); color: var(--text-muted);
  margin-top: var(--space-1);
}

/* === Status Dot === */
.status-dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; flex-shrink: 0;
}
.status-dot.idle    { background: var(--agent-idle); }
.status-dot.busy    { background: var(--agent-busy); }
.status-dot.offline { background: var(--agent-offline); border: 1px solid var(--border-strong); }

/* === Phase Badge === */
.phase-badge {
  display: inline-flex; align-items: center;
  padding: 0.2rem var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs); font-weight: 600;
}
.phase-badge.active { background: var(--success-bg); color: #15803d; }
.phase-badge.soon   { background: var(--warning-bg); color: #a16207; }
.phase-badge.future { background: #ede9fe; color: #6d28d9; }

/* === Buttons === */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-2);
  padding: 0.625rem var(--space-4);
  border: none; border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font); font-size: var(--text-sm); font-weight: 500;
  text-decoration: none;
  transition: opacity var(--transition), box-shadow var(--transition), background var(--transition);
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); }

.btn-secondary {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover { background: var(--bg-subtle); border-color: var(--text-dim); }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text); background: var(--bg-muted); }

.btn-sm { padding: 0.375rem var(--space-3); font-size: var(--text-xs); }
.btn-lg { padding: 0.75rem var(--space-6); font-size: var(--text-base); font-weight: 600; }
.btn-block { width: 100%; justify-content: center; }

/* === Data Tables === */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  font-size: var(--text-xs); font-weight: 700; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: var(--space-3) var(--space-4);
  border-bottom: 2px solid var(--border);
  text-align: left;
  background: var(--bg-subtle);
}
.data-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-subtle); }

.empty-row { text-align: center; color: var(--text-muted); padding: var(--space-12); }

/* === Pricing === */
.pricing-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6); max-width: 600px; margin: 0 auto;
}
.price-tag {
  font-size: var(--text-3xl); font-weight: 700;
  color: var(--text); margin: var(--space-4) 0;
}
.price-tag-accent { color: var(--brand); }
.feature-list {
  list-style: none; color: var(--text-secondary);
  line-height: 2;
}
.feature-list li::before {
  content: "✓ "; color: var(--success); font-weight: 600;
}

/* === Agent Profile === */
.profile-header { text-align: center; }
.profile-rep-ring { margin-bottom: var(--space-4); }
.profile-status {
  display: flex; align-items: center; gap: var(--space-2); justify-content: center;
}
.profile-platform {
  display: inline-block; padding: 0.2rem 0.5rem;
  background: var(--bg-muted); border-radius: var(--radius-sm);
  font-size: var(--text-xs);
}
.badge-snippet {
  background: var(--bg-muted); padding: var(--space-3);
  border-radius: var(--radius-md);
  display: block; word-break: break-all;
}
.spec-tag {
  display: inline-block; padding: 0.2rem 0.5rem;
  background: var(--bg-muted); border-radius: var(--radius-sm);
  font-size: var(--text-xs); margin: 0.2rem;
}

/* === Leaderboard === */
.rep-bar-inline {
  display: flex; align-items: center; gap: var(--space-2);
}
.rep-bar-track {
  width: 80px; background: var(--bg-muted); border-radius: 3px;
}
.rep-bar-fill {
  height: 6px; background: var(--brand); border-radius: 3px;
}

/* === Onboarding === */
.onboarding { padding: var(--space-16) 0; text-align: center; }

.step-indicator {
  display: flex; gap: var(--space-8);
  justify-content: center; margin-bottom: var(--space-12);
}
.step-dot {
  display: flex; flex-direction: column;
  align-items: center; gap: var(--space-1);
}
.step-number {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-xs); font-weight: 600;
  background: var(--bg-muted); color: var(--text-muted);
}
.step-number.active { background: var(--brand); color: #fff; }
.step-name { font-size: var(--text-xs); color: var(--text-muted); }

.spinner {
  width: 40px; height: 40px;
  border: 4px solid var(--bg-muted);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: var(--space-8) auto;
}
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.reveal-key {
  display: flex; align-items: center;
  gap: var(--space-3);
}

/* === Portal Dashboard === */
.dashboard-hero { margin-bottom: var(--space-8); }
.dashboard-greeting {
  font-size: var(--text-3xl); font-weight: 700;
  line-height: 1.2;
}

.usage-meter-bar {
  background: var(--bg-muted); border-radius: var(--radius-sm);
}
.usage-meter-fill {
  height: 8px; background: var(--brand); border-radius: var(--radius-sm);
}

.portal-section { padding: var(--space-12) 0; }

/* === Forms === */
label {
  display: block; font-size: var(--text-sm); font-weight: 500;
  color: var(--text-secondary); margin-bottom: var(--space-1);
}
input[type="text"], input[type="email"], input[type="password"], textarea {
  display: block; width: 100%;
  padding: 0.5rem var(--space-3);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  font-family: var(--font); font-size: var(--text-sm);
  color: var(--text); background: var(--bg);
  transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
input[readonly] { background: var(--bg-muted); color: var(--text-muted); cursor: not-allowed; }

/* === Footer === */
.footer {
  border-top: 1px solid var(--border);
  padding: var(--space-12) 0;
  background: var(--bg-subtle);
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-8);
}
.footer-col h4 {
  font-size: var(--text-sm); font-weight: 600;
  margin-bottom: var(--space-3); color: var(--text);
}
.footer-col a {
  display: block; font-size: var(--text-sm);
  color: var(--text-muted); margin-bottom: var(--space-2);
  transition: color var(--transition);
}
.footer-col a:hover { color: var(--text-secondary); text-decoration: none; }
.footer-legal {
  margin-top: var(--space-8); padding-top: var(--space-6);
  border-top: 1px solid var(--border);
  font-size: var(--text-xs); color: var(--text-muted);
}

/* === Utility === */
.text-center  { text-align: center; }
.text-muted   { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-sm      { font-size: var(--text-sm); }
.text-xs      { font-size: var(--text-xs); }
.font-mono    { font-family: var(--font-mono); }

.flex         { display: flex; }
.flex-col     { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.flex-wrap    { flex-wrap: wrap; }

.gap-2  { gap: var(--space-2); }
.gap-3  { gap: var(--space-3); }
.gap-4  { gap: var(--space-4); }
.gap-6  { gap: var(--space-6); }
.gap-8  { gap: var(--space-8); }
.gap-12 { gap: var(--space-12); }

.mt-4   { margin-top: var(--space-4); }
.mt-8   { margin-top: var(--space-8); }
.mt-12  { margin-top: var(--space-12); }
.mb-4   { margin-bottom: var(--space-4); }
.mb-8   { margin-bottom: var(--space-8); }
.mb-12  { margin-bottom: var(--space-12); }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-6); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-6); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-6); }

.hidden { display: none; }

/* === Responsive === */
@media (max-width: 768px) {
  h1 { font-size: var(--text-3xl); }
  .hero { padding: 4rem 0 3rem; }
  .hero h1 { font-size: var(--text-3xl); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: 1fr; }
  section { padding: var(--space-12) 0; }
  .nav-links { display: none; }
  .step-indicator { gap: var(--space-4); }
  .hero-actions { flex-direction: column; align-items: center; }
}
