/* CSS Variables for Premium Design */
:root {
  --primary-color: #2F835A; /* Deep green for agriculture */
  --primary-hover: #216041;
  --secondary-color: #F8B400; /* Sunny yellow for contrast */
  --bg-color: #f7fafc;
  --surface-color: #ffffff;
  --text-dark: #1a202c;
  --text-muted: #718096;
  --border-color: #e2e8f0;
  --danger-color: #e53e3e;
  --danger-bg: #fff5f5;
  --success-color: #38a169;
  --success-bg: #f0fff4;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius: 12px;
  --transition: all 0.3s ease;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-dark);
}

#app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

h1, h2, h3, h4, p { margin: 0; }

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

/* Sidebar */
.sidebar {
  width: 260px;
  background-color: var(--surface-color);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  z-index: 10;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-header h1 {
  font-size: 1.25rem;
  color: var(--primary-color);
  font-weight: 700;
  letter-spacing: -0.025em;
}

.sidebar-header p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.sidebar-nav {
  padding: 20px 0;
  flex-grow: 1;
}

.sidebar-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav li a {
  display: block;
  padding: 12px 24px;
  color: var(--text-muted);
  font-weight: 500;
  transition: var(--transition);
  border-left: 4px solid transparent;
}

.sidebar-nav li a:hover {
  background-color: #f1f5f9;
  color: var(--primary-color);
}

.sidebar-nav li a.active {
  background-color: #f0fdf4;
  color: var(--primary-color);
  border-left-color: var(--primary-color);
}

/* Main Content */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.top-header {
  height: 72px;
  background-color: var(--surface-color);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  box-shadow: var(--shadow-sm);
  z-index: 5;
}

.header-title {
  font-size: 1.5rem;
  font-weight: 600;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--transition);
}

.btn-outline:hover {
  background: var(--bg-color);
  color: var(--text-dark);
}

.content-body {
  padding: 32px;
  overflow-y: auto;
  flex-grow: 1;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.card {
  background: var(--surface-color);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(0,0,0,0.02);
  transition: var(--transition);
}

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

.card h3 {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.stat-value {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--text-dark);
}

.error-text {
  color: var(--danger-color);
}

/* Loading animations */
@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

.loading {
  animation: pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--surface-color);
  width: 90%;
  max-width: 500px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform 0.3s ease;
  overflow: hidden;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

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

.modal-header h2 {
  font-size: 1.25rem;
  color: var(--text-dark);
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-body {
  padding: 24px;
}

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

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  box-sizing: border-box;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(47, 131, 90, 0.1);
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.modal-footer {
  padding: 16px 24px;
  background: var(--bg-color);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}
