/* ============================================
   CropIntel - Agricultural Investment Intelligence
   ============================================ */

:root {
  /* Colors - Earthy agricultural palette */
  --green-900: #14532d;
  --green-800: #166534;
  --green-700: #15803d;
  --green-600: #16a34a;
  --green-500: #22c55e;
  --green-400: #4ade80;
  --green-100: #dcfce7;
  --green-50: #f0fdf4;

  --amber-600: #d97706;
  --amber-500: #f59e0b;
  --amber-100: #fef3c7;

  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;

  /* Typography */
  --font-display: 'Instrument Serif', serif;
  --font-body: 'Satoshi', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Spacing */
  --section-padding: clamp(4rem, 10vw, 8rem);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--slate-50);
  color: var(--slate-800);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ============================================
   Typography
   ============================================ */

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.2;
}

h1 { font-size: clamp(2.5rem, 6vw, 4rem); }
h2 { font-size: clamp(2rem, 4vw, 3rem); }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); }

/* ============================================
   Navigation
   ============================================ */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 1rem 2rem;
  background: rgba(248, 250, 252, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--slate-200);
}

.nav-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--green-800);
  text-decoration: none;
}

.logo-icon {
  width: 28px;
  height: 28px;
  color: var(--green-600);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-links a {
  color: var(--slate-600);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--green-700);
}

/* ============================================
   Buttons
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--green-600);
  color: white;
}

.btn-primary:hover {
  background: var(--green-700);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.btn-outline {
  background: transparent;
  color: var(--slate-700);
  border: 1px solid var(--slate-300);
}

.btn-outline:hover {
  border-color: var(--green-600);
  color: var(--green-700);
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1rem;
}

.btn-block {
  width: 100%;
}

/* ============================================
   Hero Section
   ============================================ */

.hero {
  position: relative;
  min-height: 100vh;
  padding: 8rem 2rem 4rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(circle at 30% 20%, var(--green-100) 0%, transparent 50%),
    radial-gradient(circle at 70% 80%, var(--amber-100) 0%, transparent 40%);
  z-index: -1;
}

.hero-badge {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--green-100);
  color: var(--green-800);
  border-radius: 24px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.hero-title {
  color: var(--slate-900);
  margin-bottom: 1.5rem;
}

.hero-gradient {
  background: linear-gradient(135deg, var(--green-600) 0%, var(--green-800) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.2rem;
  color: var(--slate-600);
  max-width: 540px;
  margin-bottom: 2rem;
  line-height: 1.8;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  margin-bottom: 3rem;
}

.hero-stats {
  display: flex;
  gap: 3rem;
}

.stat {
  text-align: left;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--green-700);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--slate-500);
}

/* Hero Visual - Digest Preview */
.hero-visual {
  display: flex;
  justify-content: center;
}

.digest-preview {
  background: white;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
  max-width: 420px;
  width: 100%;
  transform: perspective(1000px) rotateY(-5deg) rotateX(2deg);
  transition: transform 0.3s ease;
}

.digest-preview:hover {
  transform: perspective(1000px) rotateY(0) rotateX(0);
}

.digest-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--slate-200);
}

.digest-date {
  font-weight: 600;
  color: var(--slate-800);
}

.digest-badge {
  background: var(--green-600);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.digest-item {
  padding: 1rem;
  background: var(--slate-50);
  border-radius: 8px;
  margin-bottom: 0.75rem;
  border-left: 3px solid var(--green-500);
}

.digest-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.digest-item-title {
  font-weight: 600;
  color: var(--slate-800);
  font-size: 0.9rem;
  flex: 1;
  margin-right: 0.5rem;
}

.digest-score {
  background: var(--green-600);
  color: white;
  padding: 0.125rem 0.5rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.digest-category {
  display: inline-block;
  background: var(--slate-200);
  color: var(--slate-600);
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  margin-bottom: 0.5rem;
}

.digest-summary {
  font-size: 0.8rem;
  color: var(--slate-600);
  line-height: 1.5;
}

.digest-more {
  text-align: center;
  color: var(--green-600);
  font-weight: 600;
  font-size: 0.85rem;
  padding-top: 0.5rem;
}

/* ============================================
   Features Section
   ============================================ */

.features {
  padding: var(--section-padding) 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.section-header {
  text-align: center;
  margin-bottom: 4rem;
}

.section-title {
  color: var(--slate-900);
  margin-bottom: 1rem;
}

.section-subtitle {
  color: var(--slate-500);
  font-size: 1.1rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2rem;
}

.feature-card {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  border: 1px solid var(--slate-200);
  transition: all 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
  border-color: var(--green-200);
}

.feature-icon {
  width: 48px;
  height: 48px;
  background: var(--green-100);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.feature-icon svg {
  width: 24px;
  height: 24px;
  color: var(--green-600);
}

.feature-card h3 {
  color: var(--slate-800);
  margin-bottom: 0.75rem;
  font-family: var(--font-body);
  font-weight: 600;
}

.feature-card p {
  color: var(--slate-600);
  font-size: 0.95rem;
}

/* ============================================
   Pricing Section
   ============================================ */

.pricing {
  padding: var(--section-padding) 2rem;
  background: var(--green-50);
}

.pricing-cards {
  display: flex;
  justify-content: center;
  gap: 2rem;
  max-width: 800px;
  margin: 0 auto;
  flex-wrap: wrap;
}

.pricing-card {
  background: white;
  border-radius: 16px;
  padding: 2.5rem;
  flex: 1;
  min-width: 300px;
  max-width: 380px;
  border: 1px solid var(--slate-200);
  position: relative;
}

.pricing-card.featured {
  border-color: var(--green-500);
  box-shadow: 0 20px 60px rgba(22, 163, 74, 0.15);
}

.pricing-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--green-600);
  color: white;
  padding: 0.25rem 1rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.pricing-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--slate-200);
}

.pricing-header h3 {
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--slate-800);
  margin-bottom: 0.5rem;
}

.pricing-amount {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.25rem;
}

.price {
  font-family: var(--font-display);
  font-size: 3rem;
  color: var(--slate-900);
}

.period {
  color: var(--slate-500);
}

.pricing-features {
  list-style: none;
  margin-bottom: 2rem;
}

.pricing-features li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  color: var(--slate-700);
  font-size: 0.95rem;
}

.pricing-features li svg {
  width: 20px;
  height: 20px;
  color: var(--green-500);
  flex-shrink: 0;
}

.pricing-features li.disabled {
  color: var(--slate-400);
}

.pricing-features li.disabled svg {
  color: var(--slate-300);
}

/* ============================================
   Auth Modal
   ============================================ */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: white;
  border-radius: 16px;
  padding: 2.5rem;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--slate-400);
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

.modal-close:hover {
  color: var(--slate-600);
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--slate-200);
}

.auth-tab {
  flex: 1;
  padding: 1rem;
  background: none;
  border: none;
  font-size: 1rem;
  font-weight: 500;
  color: var(--slate-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s;
}

.auth-tab:hover {
  color: var(--slate-700);
}

.auth-tab.active {
  color: var(--green-700);
  border-bottom-color: var(--green-600);
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--slate-700);
  font-size: 0.9rem;
}

.form-group input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 1px solid var(--slate-300);
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.2s;
  font-family: inherit;
}

.form-group input:focus {
  outline: none;
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.form-error {
  color: #dc2626;
  font-size: 0.85rem;
  margin-bottom: 1rem;
  min-height: 1.25rem;
}

/* ============================================
   Footer
   ============================================ */

.footer {
  background: var(--slate-900);
  color: var(--slate-400);
  padding: 4rem 2rem 2rem;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 2rem;
  margin-bottom: 3rem;
}

.footer-brand .logo {
  color: white;
  margin-bottom: 1rem;
}

.footer-brand .logo-icon {
  color: var(--green-400);
}

.footer-brand p {
  max-width: 300px;
}

.footer-links {
  display: flex;
  gap: 2rem;
}

.footer-links a {
  color: var(--slate-400);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: white;
}

.footer-bottom {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid var(--slate-800);
  font-size: 0.85rem;
}

/* ============================================
   Dashboard Page
   ============================================ */

.dashboard {
  padding-top: 5rem;
  min-height: 100vh;
}

.dashboard-header {
  background: linear-gradient(135deg, var(--green-800) 0%, var(--green-900) 100%);
  padding: 2rem;
  color: white;
}

.dashboard-header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dashboard-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
}

.dashboard-user {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-email {
  font-size: 0.9rem;
  opacity: 0.9;
}

.dashboard-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
}

.digest-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--slate-200);
}

.digest-card-header {
  background: var(--green-50);
  padding: 1.5rem;
  border-bottom: 1px solid var(--slate-200);
}

.digest-card-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--slate-800);
  margin-bottom: 0.25rem;
}

.digest-card-date {
  font-size: 0.85rem;
  color: var(--slate-500);
}

.digest-card-body {
  padding: 1.5rem;
}

.market-context {
  background: var(--green-50);
  padding: 1rem 1.25rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  border-left: 3px solid var(--green-500);
}

.market-context-label {
  font-weight: 600;
  color: var(--green-800);
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.market-context p {
  color: var(--green-900);
  font-size: 0.9rem;
  line-height: 1.6;
}

.opportunity-item {
  padding: 1.25rem;
  background: var(--slate-50);
  border-radius: 8px;
  margin-bottom: 1rem;
  border-left: 3px solid var(--green-500);
  transition: all 0.2s;
}

.opportunity-item:hover {
  background: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.opportunity-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.opportunity-title {
  font-weight: 600;
  color: var(--slate-800);
  font-size: 1rem;
  flex: 1;
  margin-right: 1rem;
}

.opportunity-score {
  background: var(--green-600);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
}

.opportunity-category {
  display: inline-block;
  background: var(--slate-200);
  color: var(--slate-600);
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  margin-bottom: 0.75rem;
}

.opportunity-summary {
  color: var(--slate-600);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.opportunity-analysis {
  color: var(--slate-500);
  font-size: 0.85rem;
  font-style: italic;
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.opportunity-risks {
  background: var(--amber-100);
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

.opportunity-risks strong {
  color: var(--amber-600);
}

.opportunity-risks span {
  color: #78350f;
}

.upgrade-prompt {
  background: linear-gradient(135deg, var(--green-50) 0%, var(--green-100) 100%);
  padding: 2rem;
  border-radius: 12px;
  text-align: center;
  margin-top: 1rem;
}

.upgrade-prompt h3 {
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--green-800);
  margin-bottom: 0.75rem;
}

.upgrade-prompt p {
  color: var(--green-700);
  margin-bottom: 1.5rem;
}

/* Sidebar */
.sidebar-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  border: 1px solid var(--slate-200);
  margin-bottom: 1.5rem;
}

.sidebar-card h3 {
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--slate-800);
  margin-bottom: 1rem;
  font-size: 1rem;
}

.plan-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

.plan-badge.free {
  background: var(--slate-200);
  color: var(--slate-600);
}

.plan-badge.pro {
  background: var(--green-600);
  color: white;
}

.archive-list {
  list-style: none;
}

.archive-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--slate-100);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.archive-item:last-child {
  border-bottom: none;
}

.archive-item a {
  color: var(--slate-700);
  text-decoration: none;
  font-size: 0.9rem;
}

.archive-item a:hover {
  color: var(--green-700);
}

.archive-item span {
  font-size: 0.75rem;
  color: var(--slate-400);
}

.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--slate-500);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  color: var(--slate-300);
  margin-bottom: 1rem;
}

.empty-state h3 {
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--slate-700);
  margin-bottom: 0.5rem;
}

/* ============================================
   Loading States
   ============================================ */

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--slate-200);
  border-top-color: var(--green-600);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 1024px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 6rem 1.5rem 3rem;
  }

  .hero-subtitle {
    margin: 0 auto 2rem;
  }

  .hero-cta {
    justify-content: center;
  }

  .hero-stats {
    justify-content: center;
  }

  .hero-visual {
    order: -1;
  }

  .digest-preview {
    transform: none;
    max-width: 360px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .nav-links a:not(.btn) {
    display: none;
  }

  .hero-cta {
    flex-direction: column;
  }

  .hero-stats {
    flex-wrap: wrap;
    gap: 1.5rem;
  }

  .pricing-cards {
    flex-direction: column;
    align-items: center;
  }

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

  .footer-links {
    flex-direction: column;
    gap: 1rem;
  }
}
