/* ================================================================
   Coffee Entrepreneurship Platform — Global Design System
   Palette: warm cream base, copper accent, sage-green secondary
   Direction: Human / approachable (Airbnb-grade tactility)
   ================================================================ */

:root {
  /* Core palette */
  --bg:             oklch(96.5% 0.006 75);
  --surface:        oklch(100% 0 0);
  --fg:             oklch(22% 0.025 55);
  --fg-secondary:   oklch(38% 0.02 60);
  --muted:          oklch(56% 0.016 65);
  --border:         oklch(90% 0.008 75);
  --accent:         oklch(52% 0.13 40);
  --accent-hover:   oklch(48% 0.15 38);
  --accent-light:   oklch(93% 0.035 40);
  --accent-subtle:  oklch(96% 0.015 40);

  /* Secondary — growth / success */
  --green:          oklch(52% 0.1 155);
  --green-light:    oklch(94% 0.04 155);

  /* Status */
  --amber:          oklch(72% 0.14 75);
  --amber-light:    oklch(95% 0.04 75);
  --red:            oklch(55% 0.15 25);
  --red-light:      oklch(95% 0.04 25);

  /* Typography */
  --font-display: 'Söhne', 'Avenir Next', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-body:    -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
  --font-mono:    ui-monospace, 'SF Mono', 'Menlo', monospace;

  /* Spacing scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-20: 80px;

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px oklch(0% 0 0 / 6%), 0 1px 2px oklch(0% 0 0 / 4%);
  --shadow-md: 0 4px 12px oklch(0% 0 0 / 8%), 0 2px 4px oklch(0% 0 0 / 4%);
  --shadow-lg: 0 12px 40px oklch(0% 0 0 / 10%), 0 4px 12px oklch(0% 0 0 / 5%);
  --shadow-xl: 0 24px 64px oklch(0% 0 0 / 12%);

  /* Layout */
  --max-width: 1200px;
  --nav-height: 64px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  color: var(--fg);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
}

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* ---- Navigation ---- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: oklch(100% 0.003 75 / 92%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-6);
}

.nav-inner {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--fg);
  text-decoration: none;
}

.nav-logo svg {
  width: 28px;
  height: 28px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--sp-6);
  list-style: none;
}

.nav-links a {
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.15s;
  text-decoration: none;
}

.nav-links a:hover { color: var(--fg); }
.nav-links a.active { color: var(--accent); font-weight: 600; }

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 0.875rem;
  color: var(--fg);
  font-weight: 500;
  text-decoration: none;
}
.nav-user:hover { text-decoration: none; }
.nav-user.active .nav-avatar { box-shadow: 0 0 0 2px var(--accent); }

.nav-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-5);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  transition: all 0.15s;
  white-space: nowrap;
  line-height: 1.5;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
  text-decoration: none;
}

.btn-secondary {
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  border-color: oklch(80% 0.01 75);
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}
.btn-ghost:hover {
  color: var(--fg);
  background: oklch(0% 0 0 / 4%);
  text-decoration: none;
}

.btn-lg {
  padding: var(--sp-3) var(--sp-8);
  font-size: 1rem;
  border-radius: var(--radius-lg);
}

.btn-sm {
  padding: var(--sp-1) var(--sp-3);
  font-size: 0.8125rem;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
}

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  transition: box-shadow 0.2s, border-color 0.2s;
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: oklch(85% 0.01 75);
}

.card-flat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
}

/* ---- Tags / Badges ---- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 2px var(--sp-2);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  line-height: 1.6;
}

.tag-accent {
  background: var(--accent-light);
  color: var(--accent);
}

.tag-green {
  background: var(--green-light);
  color: var(--green);
}

.tag-amber {
  background: var(--amber-light);
  color: oklch(45% 0.1 75);
}

/* ---- Section layout ---- */
.section {
  padding: var(--sp-16) var(--sp-6);
}

.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.section-header {
  margin-bottom: var(--sp-10);
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: var(--sp-2);
}

.section-desc {
  color: var(--muted);
  font-size: 0.9375rem;
  max-width: 56ch;
}

/* ---- Grid helpers ---- */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-6);
}

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

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

/* ---- AI floating button ---- */
.ai-fab {
  position: fixed;
  bottom: var(--sp-8);
  right: var(--sp-8);
  z-index: 200;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.ai-fab:hover {
  transform: scale(1.08);
  box-shadow: var(--shadow-xl);
}

.ai-fab-tooltip {
  position: fixed;
  bottom: calc(var(--sp-8) + 64px);
  right: var(--sp-8);
  z-index: 201;
  background: var(--fg);
  color: #fff;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.ai-fab:hover + .ai-fab-tooltip {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Progress bar ---- */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--accent);
  transition: width 0.4s ease;
}

/* ---- Rating stars ---- */
.stars {
  display: flex;
  gap: 2px;
  color: var(--amber);
}

/* ---- Form elements ---- */
.input {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  background: var(--surface);
  color: var(--fg);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px oklch(52% 0.13 40 / 12%);
}

.input::placeholder {
  color: oklch(70% 0.01 75);
}

/* ---- Tabs ---- */
.tabs {
  display: flex;
  gap: var(--sp-1);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.tab {
  padding: var(--sp-3) var(--sp-4);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.tab:hover { color: var(--fg); }

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---- Level badge ---- */
.level-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 2px var(--sp-3);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}

.level-bronze {
  background: oklch(88% 0.04 65);
  color: oklch(40% 0.06 55);
}

.level-silver {
  background: oklch(92% 0.005 250);
  color: oklch(45% 0.01 250);
}

.level-gold {
  background: oklch(90% 0.05 85);
  color: oklch(48% 0.08 75);
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .grid-4 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .section { padding: var(--sp-10) var(--sp-4); }
  .section-title { font-size: 1.25rem; }
}

/* ---- Animations ---- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-in {
  animation: fadeInUp 0.5s ease forwards;
}

.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
