:root {
  --primary-color: #2e7d32;
  --primary-hover: #1b5e20;
  --secondary-color: #455a64;
  --accent-color: #f9a825;

  --bg-color: #f4f7f6;
  --surface-color: #ffffff;
  --text-color: #2c3e50;
  --text-secondary: #607d8b;
  --border-color: #e0e0e0;

  --success-color: #43a047;
  --error-color: #e53935;
  --warning-color: #fb8c00;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;

  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.section {
  padding: 40px 0;
  display: none;
  animation: fadeIn 0.4s ease-in-out;
}

.section.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header */
.header {
  background-color: var(--surface-color);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 15px 0;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  text-decoration: none;
}

.header-actions {
  display: flex;
  gap: 15px;
  align-items: center;
}

.desktop-nav {
  display: none;
}

@media (min-width: 768px) {
  .desktop-nav {
    display: flex;
    gap: 20px;
  }

  .desktop-nav a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.2s;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
  }

  .desktop-nav a:hover,
  .desktop-nav a.active {
    color: var(--primary-color);
    background-color: rgba(46, 125, 50, 0.05);
  }
}

/* Typography */
h1,
h2,
h3 {
  color: var(--text-color);
  font-weight: 700;
  line-height: 1.3;
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}
h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}
h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.section-header {
  text-align: center;
  margin-bottom: 3rem;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  font-size: 1rem;
  text-decoration: none;
}

.btn--primary {
  background-color: var(--primary-color);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn--primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn--outline {
  background-color: transparent;
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
}

.btn--outline:hover {
  background-color: rgba(46, 125, 50, 0.05);
}

.btn--sm {
  padding: 8px 16px;
  font-size: 0.9rem;
}

.btn--full-width {
  width: 100%;
}

.btn-icon {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: background 0.2s;
}

.btn-icon:hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: var(--primary-color);
}

/* Cards */
.card,
.metric-card,
.weather-content,
.market-charts,
.recommendations-results,
.disease-ui-card,
.crop-card {
  background-color: var(--surface-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 25px;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid var(--border-color);
}

.card:hover,
.crop-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-color);
  font-size: 0.95rem;
}

.form-control {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s;
  background-color: #fafafa;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  background-color: white;
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}

/* Hero Section */
.hero-section {
  background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
  padding: 80px 0;
  min-height: 80vh;
  display: flex;
  align-items: center;
}

.hero-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
}

.hero-stats {
  display: flex;
  gap: 30px;
  margin: 30px 0;
}

.stat-number {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary-color);
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Feature Grid */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.feature-item {
  background: white;
  padding: 20px;
  border-radius: var(--radius-md);
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.feature-item i {
  font-size: 2rem;
  color: var(--primary-color);
  margin-bottom: 10px;
  display: block;
}

/* Crop Advisor */
.crop-advisor-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
}

@media (min-width: 992px) {
  .crop-advisor-container {
    grid-template-columns: 1fr 1fr;
  }
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
}

.recommendation-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.crop-name {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary-color);
}

/* Weather */
.weather-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.weather-stat {
  background: #f5f5f5;
  padding: 15px;
  border-radius: var(--radius-sm);
  text-align: center;
}

.weather-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-color);
}

/* Market Table */
.price-table {
  width: 100%;
  border-collapse: collapse;
}

.price-table th,
.price-table td {
  padding: 15px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.price-table th {
  font-weight: 600;
  color: var(--text-secondary);
  background-color: #fafafa;
}

.trend-positive {
  color: var(--success-color);
}
.trend-negative {
  color: var(--error-color);
}

/* Crop Library */
.crop-library {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 25px;
}

.crop-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.crop-card-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary-color);
}

.crop-season {
  background-color: rgba(46, 125, 50, 0.1);
  color: var(--primary-color);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
}

/* Analytics */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.metric-card {
  display: flex;
  align-items: center;
  gap: 20px;
}

.metric-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: rgba(46, 125, 50, 0.1);
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

/* Disease Detection */
.disease-ui-card {
  max-width: 500px;
  margin: 0 auto;
  background: white;
  padding: 30px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.disease-result {
  margin-top: 20px;
  padding: 20px;
  background-color: #f1f8e9;
  border-radius: var(--radius-sm);
  border: 1px solid #c5e1a5;
}

/* Bottom Nav (Mobile) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  padding: 10px 0;
  z-index: 1000;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.75rem;
  gap: 4px;
  cursor: pointer;
}

.bottom-nav-item i {
  font-size: 1.2rem;
}

.bottom-nav-item.active {
  color: var(--primary-color);
}

@media (min-width: 768px) {
  .bottom-nav {
    display: none;
  }
}

/* Utilities */
.hidden {
  display: none !important;
}
.text-center {
  text-align: center;
}

/* Location Display */
.location-display {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-16);
  margin: var(--space-20) 0;
  box-shadow: var(--shadow-sm);
  animation: slideIn 0.4s ease-out;
}

.location-info {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  margin-bottom: var(--space-8);
}

.location-info i {
  font-size: var(--font-size-xl);
  color: var(--color-primary);
}

.location-coords {
  margin-top: var(--space-8);
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
}

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

/* Modals */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal:not(.hidden) {
  opacity: 1;
  pointer-events: auto;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.modal-content {
  background: white;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: var(--radius-md);
  position: relative;
  z-index: 2001;
  box-shadow: var(--shadow-lg);
  padding: 0;
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: 20px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-secondary);
}

/* Loading Spinner */
.loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(46, 125, 50, 0.3);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  animation: spin 1s ease-in-out infinite;
  display: inline-block;
}

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

/* Responsive adjustments */
@media (max-width: 768px) {
  .hero-content {
    grid-template-columns: 1fr;
    text-align: center;
  }

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

  .header-content {
    justify-content: center;
  }

  .header-actions {
    position: absolute;
    right: 20px;
  }

  .logo span {
    display: inline;
  }
}
