/* ============================================================
   Community Platform — Design System
   Light theme + tech blue accent
   ============================================================ */

:root {
  /* Brand */
  --primary-50:  #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-300: #93c5fd;
  --primary-400: #60a5fa;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-800: #1e40af;
  --primary-900: #1e3a8a;

  /* Neutrals */
  --gray-0:   #ffffff;
  --gray-50:  #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* Semantic */
  --success: #10b981;
  --warning: #f59e0b;
  --danger:  #ef4444;
  --info:    var(--primary-500);

  /* Surface */
  --bg:            var(--gray-50);
  --bg-elevated:   var(--gray-0);
  --border:        var(--gray-200);
  --border-strong: var(--gray-300);
  --text:          var(--gray-900);
  --text-muted:    var(--gray-500);
  --text-subtle:   var(--gray-400);

  /* Effects */
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, .07), 0 2px 4px -2px rgba(15, 23, 42, .05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, .08), 0 4px 6px -4px rgba(15, 23, 42, .05);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, .10), 0 8px 10px -6px rgba(15, 23, 42, .05);
  --shadow-glow: 0 0 0 4px rgba(59, 130, 246, .12);

  --transition: 150ms cubic-bezier(.4, 0, .2, 1);
}

/* ============================================================
   Reset & base
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { font-size: 16px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary-600);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--primary-700); }

h1, h2, h3, h4 {
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
h1 { font-size: 2.25rem; }
h2 { font-size: 1.625rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.0625rem; }

p { color: var(--text-muted); }

::selection {
  background: var(--primary-200);
  color: var(--primary-900);
}

/* ============================================================
   Layout
   ============================================================ */

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

main { flex: 1; padding: 32px 0; }

/* ============================================================
   Header / nav
   ============================================================ */

.site-header {
  background: rgba(255, 255, 255, .85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.0625rem;
  color: var(--gray-900);
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--gray-900); }

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(37, 99, 235, .35);
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav a.nav-link {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--gray-600);
  font-weight: 500;
  font-size: 14px;
  transition: all var(--transition);
}
.nav a.nav-link:hover {
  color: var(--gray-900);
  background: var(--gray-100);
}

.nav .nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
}

.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: var(--primary-600);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--primary-700);
  color: #fff;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--gray-0);
  color: var(--gray-700);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  background: var(--gray-50);
  color: var(--gray-900);
  border-color: var(--gray-400);
}

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
}
.btn-ghost:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #dc2626; color: #fff; }

.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-sm { padding: 7px 12px; font-size: 13px; }

/* ============================================================
   Cards
   ============================================================ */

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}

.card-hover {
  transition: all var(--transition);
}
.card-hover:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

/* ============================================================
   Forms
   ============================================================ */

.form { display: grid; gap: 16px; }

.field { display: grid; gap: 6px; }

.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  letter-spacing: 0.01em;
}

.input,
input.input,
textarea.input {
  width: 100%;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--gray-0);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  outline: none;
}

.input::placeholder { color: var(--text-subtle); }

.input:hover { border-color: var(--gray-400); }

.input:focus {
  border-color: var(--primary-500);
  box-shadow: var(--shadow-glow);
  background: var(--gray-0);
}

.field-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  display: none;
}
.alert.show { display: block; }
.alert-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}
.alert-success {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

/* ============================================================
   Landing hero
   ============================================================ */

.hero {
  position: relative;
  overflow: hidden;
  padding: 80px 0 96px;
  background:
    radial-gradient(1200px 600px at 80% -10%, var(--primary-100), transparent 60%),
    radial-gradient(900px 500px at 0% 100%, #eef2ff, transparent 55%),
    var(--gray-0);
  border-bottom: 1px solid var(--border);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--gray-100) 1px, transparent 1px),
    linear-gradient(90deg, var(--gray-100) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  opacity: .6;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  max-width: 760px;
  text-align: center;
  margin: 0 auto;
}

.hero .badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--primary-50);
  color: var(--primary-700);
  border: 1px solid var(--primary-100);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 24px;
}

.hero .badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--primary-500);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, .2);
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: 20px;
  background: linear-gradient(180deg, var(--gray-900), var(--gray-700));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p.lead {
  font-size: 1.125rem;
  color: var(--gray-600);
  max-width: 620px;
  margin: 0 auto 32px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================================
   Features grid
   ============================================================ */

.section {
  padding: 80px 0;
}

.section-head {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 48px;
}
.section-head h2 { margin-bottom: 12px; }

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.feature {
  padding: 28px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  transition: all var(--transition);
}
.feature:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
  transform: translateY(-3px);
}

.feature-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary-50), var(--primary-100));
  color: var(--primary-600);
  margin-bottom: 16px;
  border: 1px solid var(--primary-100);
}
.feature-icon svg { width: 22px; height: 22px; }

.feature h3 { font-size: 1.0625rem; margin-bottom: 8px; }
.feature p { font-size: 14px; color: var(--text-muted); }

/* ============================================================
   Auth pages
   ============================================================ */

.auth-wrap {
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
  padding: 48px 24px;
  background:
    radial-gradient(800px 400px at 50% 0%, var(--primary-50), transparent 70%),
    var(--gray-50);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--gray-0);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
}

.auth-head { text-align: center; margin-bottom: 28px; }
.auth-head h1 { font-size: 1.5rem; margin-bottom: 6px; }
.auth-head p { font-size: 14px; color: var(--text-muted); }

.auth-foot {
  margin-top: 20px;
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
}
.auth-foot a { font-weight: 600; }

/* ============================================================
   Dashboard
   ============================================================ */

.dash-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.dash-head h1 { font-size: 1.75rem; margin-bottom: 4px; }
.dash-head .subtitle { color: var(--text-muted); font-size: 14px; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, var(--primary-500), var(--primary-700));
}
.stat-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.02em;
}
.stat-sub { font-size: 13px; color: var(--text-subtle); margin-top: 2px; }

.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.panel-head h2 { font-size: 1.0625rem; }
.panel-body { padding: 8px 0; }

.list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--gray-50); }

.list-item .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary-500);
  flex-shrink: 0;
}

.list-item .item-title {
  font-weight: 500;
  font-size: 14px;
  color: var(--gray-900);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item .item-meta {
  font-size: 13px;
  color: var(--text-muted);
}

.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-subtle);
  font-size: 14px;
}

.loading {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  font-size: 14px;
}

.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--primary-500);
  border-radius: 50%;
  display: inline-block;
  animation: spin .7s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.badge-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--primary-50);
  color: var(--primary-700);
  border: 1px solid var(--primary-100);
}

/* ============================================================
   Footer
   ============================================================ */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--gray-0);
  padding: 24px 0;
  margin-top: auto;
}
.site-footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-muted);
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 640px) {
  .hero { padding: 56px 0 64px; }
  .section { padding: 56px 0; }
  .auth-card { padding: 28px 22px; }
  .nav a.nav-link { display: none; }
  .site-header .container { height: 56px; }
  .dash-head h1 { font-size: 1.5rem; }
}