/* ============================================
   AgroLink Africa — Global Styles
   ============================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

/* --- CSS Variables --- */
:root {
  /* Primary - Agriculture Green */
  --primary-50:  #E8F5E9;
  --primary-100: #C8E6C9;
  --primary-200: #A5D6A7;
  --primary-300: #81C784;
  --primary-400: #66BB6A;
  --primary-500: #4CAF50;
  --primary-600: #43A047;
  --primary-700: #1B5E20;
  --primary-800: #145218;
  --primary-900: #0D3B0F;

  /* Accent - Harvest Gold */
  --accent-300: #FFD54F;
  --accent-400: #FFCA28;
  --accent-500: #F9A825;
  --accent-600: #F57F17;
  --accent-700: #E65100;

  /* Earth - Warm Brown */
  --earth-100: #D7CCC8;
  --earth-300: #A1887F;
  --earth-500: #8D6E63;
  --earth-700: #5D4037;

  /* Trust Tiers */
  --tier-0: #9E9E9E;
  --tier-1: #42A5F5;
  --tier-2: #66BB6A;
  --tier-3: #FFA726;
  --tier-4: #F9A825;

  /* Neutral */
  --bg:        #FAFAF5;
  --bg-alt:    #F5F5F0;
  --surface:   #FFFFFF;
  --text:      #212121;
  --text-sec:  #757575;
  --text-light:#9E9E9E;
  --border:    #E0E0E0;
  --border-light: #F0F0EB;

  /* Semantic */
  --error:   #D32F2F;
  --error-bg:#FFEBEE;
  --success: #388E3C;
  --success-bg:#E8F5E9;
  --warning: #F57F17;
  --warning-bg:#FFF8E1;
  --info:    #1976D2;
  --info-bg: #E3F2FD;

  /* Typography */
  --font-heading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Font Sizes */
  --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;
  --text-5xl: 3rem;

  /* Spacing (8px grid) */
  --sp-0: 0;
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;
  --sp-16: 4rem;
  --sp-20: 5rem;
  --sp-24: 6rem;
  --sp-32: 8rem;

  /* Border Radius */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  20px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg:  0 10px 25px rgba(0,0,0,0.07), 0 4px 10px rgba(0,0,0,0.04);
  --shadow-xl:  0 20px 40px rgba(0,0,0,0.08), 0 8px 16px rgba(0,0,0,0.04);
  --shadow-card:0 2px 12px rgba(27,94,32,0.06);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Z-Index */
  --z-dropdown: 100;
  --z-sticky:   200;
  --z-overlay:  300;
  --z-modal:    400;
  --z-toast:    500;

  /* Container */
  --container-max: 1280px;
  --container-pad: 1.5rem;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

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

img, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

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

ul, ol {
  list-style: none;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
  border: none;
  outline: none;
  background: none;
}

button {
  cursor: pointer;
}

table {
  border-collapse: collapse;
  width: 100%;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

p {
  margin-bottom: var(--sp-4);
  color: var(--text-sec);
}

p:last-child {
  margin-bottom: 0;
}

strong { font-weight: 600; }

/* --- Layout --- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-pad);
}

.section {
  padding: var(--sp-24) 0;
}

.section--sm {
  padding: var(--sp-16) 0;
}

.section--lg {
  padding: var(--sp-32) 0;
}

.section--green {
  background: linear-gradient(135deg, var(--primary-700) 0%, var(--primary-900) 100%);
  color: white;
}

.section--green h1,
.section--green h2,
.section--green h3,
.section--green h4,
.section--green h5,
.section--green h6 {
  color: white;
}

.section--green p {
  color: var(--primary-100);
}

.section--alt {
  background-color: var(--bg-alt);
}

/* Grid */
.grid {
  display: grid;
  gap: var(--sp-6);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Flex */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: var(--sp-1); }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }
.gap-8 { gap: var(--sp-8); }

/* Text utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-sec { color: var(--text-sec); }
.text-green { color: var(--primary-700); }
.text-gold { color: var(--accent-500); }
.text-white { color: white; }
.font-heading { font-family: var(--font-heading); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.05em; }

/* Spacing utilities */
.mt-1 { margin-top: var(--sp-1); }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mt-8 { margin-top: var(--sp-8); }
.mb-1 { margin-bottom: var(--sp-1); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }
.mb-8 { margin-bottom: var(--sp-8); }
.p-4 { padding: var(--sp-4); }
.p-6 { padding: var(--sp-6); }
.p-8 { padding: var(--sp-8); }

/* Width */
.w-full { width: 100%; }
.max-w-sm { max-width: 24rem; }
.max-w-md { max-width: 28rem; }
.max-w-lg { max-width: 32rem; }
.max-w-xl { max-width: 36rem; }
.mx-auto { margin-left: auto; margin-right: auto; }

/* Overflow */
.overflow-hidden { overflow: hidden; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }

/* ============================================
   NAVBAR
   ============================================ */
.navbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  padding: var(--sp-3) 0;
  transition: box-shadow var(--transition-base);
}

.navbar.scrolled {
  box-shadow: var(--shadow-md);
}

.navbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-8);
}

.navbar__logo {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: var(--text-xl);
  color: var(--primary-700);
  flex-shrink: 0;
}

.navbar__logo svg {
  width: 36px;
  height: 36px;
}

.navbar__logo span {
  color: var(--accent-500);
}

.navbar__nav {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

.navbar__link {
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-sec);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.navbar__link:hover,
.navbar__link--active {
  color: var(--primary-700);
  background: var(--primary-50);
}

.navbar__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}

.navbar__hamburger {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.navbar__hamburger:hover {
  background: var(--bg-alt);
}

.navbar__hamburger svg {
  width: 24px;
  height: 24px;
}

/* Mobile nav */
@media (max-width: 768px) {
  .navbar__hamburger {
    display: flex;
  }

  .navbar__nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    flex-direction: column;
    padding: var(--sp-4);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
  }

  .navbar__nav.active {
    display: flex;
  }

  .navbar__link {
    width: 100%;
    padding: var(--sp-3) var(--sp-4);
  }

  .navbar__actions .btn--outline,
  .navbar__actions .btn--primary {
    display: none;
  }
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
  background: var(--primary-900);
  color: white;
  padding: var(--sp-16) 0 var(--sp-8);
}

.footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--sp-12);
  margin-bottom: var(--sp-12);
}

.footer__brand p {
  color: var(--primary-200);
  font-size: var(--text-sm);
  margin-top: var(--sp-4);
  max-width: 320px;
}

.footer__heading {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-400);
  margin-bottom: var(--sp-4);
}

.footer__links li {
  margin-bottom: var(--sp-2);
}

.footer__links a {
  font-size: var(--text-sm);
  color: var(--primary-200);
  transition: color var(--transition-fast);
}

.footer__links a:hover {
  color: white;
}

.footer__bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: var(--sp-8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}

.footer__bottom p {
  font-size: var(--text-sm);
  color: var(--primary-300);
  margin: 0;
}

.footer__social {
  display: flex;
  gap: var(--sp-3);
}

.footer__social a {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.1);
  color: white;
  transition: all var(--transition-fast);
}

.footer__social a:hover {
  background: var(--accent-500);
  color: var(--primary-900);
}

.footer__social svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 768px) {
  .footer__grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-8);
  }

  .footer__brand {
    grid-column: 1 / -1;
  }

  .footer__bottom {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .footer__grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   AFRICAN PATTERN DIVIDER
   ============================================ */
.pattern-divider {
  height: 6px;
  background: repeating-linear-gradient(
    90deg,
    var(--accent-500) 0px,
    var(--accent-500) 12px,
    var(--primary-700) 12px,
    var(--primary-700) 24px,
    var(--earth-500) 24px,
    var(--earth-500) 36px
  );
  opacity: 0.8;
}

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */
.dashboard {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: var(--primary-900);
  color: white;
  padding: var(--sp-6) 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: var(--z-sticky);
  transition: transform var(--transition-base);
}

.sidebar__logo {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: var(--text-lg);
  padding: 0 var(--sp-6);
  margin-bottom: var(--sp-8);
  color: white;
}

.sidebar__logo span {
  color: var(--accent-400);
}

.sidebar__section {
  margin-bottom: var(--sp-6);
}

.sidebar__label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary-400);
  padding: 0 var(--sp-6);
  margin-bottom: var(--sp-2);
  font-weight: 600;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-6);
  font-size: var(--text-sm);
  color: var(--primary-200);
  transition: all var(--transition-fast);
  border-left: 3px solid transparent;
}

.sidebar__link:hover {
  background: rgba(255,255,255,0.05);
  color: white;
}

.sidebar__link--active {
  background: rgba(255,255,255,0.08);
  color: white;
  border-left-color: var(--accent-400);
}

.sidebar__link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar__link--active svg {
  opacity: 1;
}

.sidebar__badge {
  margin-left: auto;
  background: var(--accent-500);
  color: var(--primary-900);
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.dashboard__main {
  flex: 1;
  margin-left: 260px;
  min-height: 100vh;
}

.dashboard__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-8);
  background: white;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

.dashboard__topbar-left {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

.dashboard__topbar-right {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

.dashboard__content {
  padding: var(--sp-8);
}

.sidebar__toggle {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .dashboard__main {
    margin-left: 0;
  }

  .sidebar__toggle {
    display: flex;
  }
}

/* ============================================
   SCROLL ANIMATIONS
   ============================================ */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

.animate-on-scroll.animate-left {
  transform: translateX(-40px);
}

.animate-on-scroll.animate-left.visible {
  transform: translateX(0);
}

.animate-on-scroll.animate-right {
  transform: translateX(40px);
}

.animate-on-scroll.animate-right.visible {
  transform: translateX(0);
}

.animate-on-scroll.animate-scale {
  transform: scale(0.9);
}

.animate-on-scroll.animate-scale.visible {
  transform: scale(1);
}

/* Stagger delays for grid children */
.stagger-1 { transition-delay: 0.1s; }
.stagger-2 { transition-delay: 0.2s; }
.stagger-3 { transition-delay: 0.3s; }
.stagger-4 { transition-delay: 0.4s; }
.stagger-5 { transition-delay: 0.5s; }
.stagger-6 { transition-delay: 0.6s; }
.stagger-7 { transition-delay: 0.7s; }
.stagger-8 { transition-delay: 0.8s; }
.stagger-9 { transition-delay: 0.9s; }

/* ============================================
   AFRICAN PATTERN DIVIDERS
   ============================================ */
.african-divider {
  height: 8px;
  background: repeating-linear-gradient(
    90deg,
    var(--accent-500) 0px,
    var(--accent-500) 16px,
    var(--primary-700) 16px,
    var(--primary-700) 32px,
    var(--earth-500) 32px,
    var(--earth-500) 48px
  );
}

.african-divider--thin {
  height: 4px;
}

.african-pattern-bg {
  position: relative;
}

.african-pattern-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.03;
  background-image:
    repeating-linear-gradient(
      45deg,
      var(--primary-700) 0px,
      var(--primary-700) 1px,
      transparent 1px,
      transparent 8px
    ),
    repeating-linear-gradient(
      -45deg,
      var(--primary-700) 0px,
      var(--primary-700) 1px,
      transparent 1px,
      transparent 8px
    );
  pointer-events: none;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.btn--full {
  width: 100%;
}

.relative { position: relative; }
.z-1 { z-index: 1; }
.overflow-hidden { overflow: hidden; }

/* Gradient text */
.gradient-text {
  background: linear-gradient(135deg, var(--primary-700), var(--accent-500));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Pulse animation for badges */
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(76,175,80,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(76,175,80,0); }
}

.pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* Shimmer loading effect */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-alt) 25%, var(--border-light) 50%, var(--bg-alt) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

/* Glow effect */
.glow-green {
  box-shadow: 0 0 20px rgba(76,175,80,0.15);
}

.glow-gold {
  box-shadow: 0 0 20px rgba(249,168,37,0.15);
}
