/* ==========================================================
   PARTNERSHUB AI — DESIGN SYSTEM
   Apple-grade clarity + Stripe-grade polish + Notion-grade calm
   ========================================================== */

:root {
  --bg-0: #0a0a0f;
  --bg-1: #111117;
  --bg-2: #16161d;
  --bg-3: #1c1c26;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);

  --text-primary: rgba(255, 255, 255, 0.94);
  --text-secondary: rgba(255, 255, 255, 0.62);
  --text-tertiary: rgba(255, 255, 255, 0.38);

  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --accent-glow: rgba(99, 102, 241, 0.35);
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --info: #38bdf8;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;

  --shadow-soft: 0 8px 30px rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 20px 60px rgba(0, 0, 0, 0.45);

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-snap: cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-theme='light'] {
  --bg-0: #f5f5f7;
  --bg-1: #ffffff;
  --bg-2: #fafafc;
  --bg-3: #f0f0f4;
  --surface: rgba(0, 0, 0, 0.03);
  --surface-hover: rgba(0, 0, 0, 0.05);
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.14);
  --text-primary: rgba(0, 0, 0, 0.92);
  --text-secondary: rgba(0, 0, 0, 0.6);
  --text-tertiary: rgba(0, 0, 0, 0.38);
  --shadow-soft: 0 8px 30px rgba(0, 0, 0, 0.08);
  --shadow-lift: 0 20px 60px rgba(0, 0, 0, 0.12);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
  background: radial-gradient(circle at 20% -10%, rgba(99, 102, 241, 0.18), transparent 45%),
              radial-gradient(circle at 90% 10%, rgba(139, 92, 246, 0.14), transparent 40%),
              var(--bg-0);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  transition: background 0.4s var(--ease), color 0.4s var(--ease);
  min-height: 100vh;
}

::selection { background: var(--accent-glow); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

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

/* ---------- Glass surfaces ---------- */
.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease), transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.glass:hover { background: var(--surface-hover); }

.glass-card {
  padding: 24px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  font-size: 14.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.18s var(--ease-snap), box-shadow 0.25s var(--ease), background 0.25s var(--ease), opacity 0.2s;
  user-select: none;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 8px 24px var(--accent-glow);
}
.btn-primary:hover { box-shadow: 0 12px 32px var(--accent-glow); transform: translateY(-1px); }

.btn-ghost {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-hover); border-color: var(--border-strong); }

.btn-block { width: 100%; }

/* ---------- Inputs ---------- */
.field { margin-bottom: 18px; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: 0.01em;
}

.field input, .field select, .field textarea {
  width: 100%;
  padding: 13px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14.5px;
  font-family: inherit;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-hover);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.field .error-text {
  color: var(--danger);
  font-size: 12.5px;
  margin-top: 6px;
  display: none;
}

.field.has-error input { border-color: var(--danger); }
.field.has-error .error-text { display: block; }

/* ---------- Fade/slide-in animation for page content ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeUp 0.6s var(--ease) both; }
.delay-1 { animation-delay: 0.05s; }
.delay-2 { animation-delay: 0.1s; }
.delay-3 { animation-delay: 0.15s; }
.delay-4 { animation-delay: 0.2s; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.float { animation: float 6s ease-in-out infinite; }

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { box-shadow: 0 0 0 10px transparent; }
}

@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
}
.badge-success { background: rgba(52, 211, 153, 0.14); color: var(--success); }
.badge-warning { background: rgba(251, 191, 36, 0.14); color: var(--warning); }
.badge-danger { background: rgba(248, 113, 113, 0.14); color: var(--danger); }
.badge-info { background: rgba(56, 189, 248, 0.14); color: var(--info); }

/* ---------- Toast ---------- */
#toast-stack {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  min-width: 280px;
  max-width: 360px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  box-shadow: var(--shadow-lift);
  animation: fadeUp 0.35s var(--ease) both;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast-success { background: linear-gradient(135deg, #10b981, #34d399); }
.toast-error { background: linear-gradient(135deg, #ef4444, #f87171); }
.toast-info { background: linear-gradient(135deg, #6366f1, #8b5cf6); }

/* ---------- Layout helpers ---------- */
.container { max-width: 1320px; margin: 0 auto; padding: 0 24px; }
.grid { display: grid; gap: 20px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 680px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
