:root {
  --primary-color: #2e7d32;
  --primary-dark: #1b5e20;
  --accent-color: #f57f17;
  --bg-color: #f4f6f8;
  --card-bg: #ffffff;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --border-color: #e5e7eb;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang TC", "Heiti TC", "Microsoft JhengHei", sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 16px;
}

/* Mobile Container for LIFF */
.liff-container {
  max-width: 540px;
  margin: 0 auto;
  min-height: 100vh;
  background-color: #ffffff;
  box-shadow: 0 0 20px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
  color: #ffffff;
  padding: 16px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.app-title h1 {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.network-badge {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 12px;
  background-color: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.network-badge.online {
  background-color: var(--success-color);
}

.network-badge.offline {
  background-color: var(--danger-color);
}

/* Farmer Identity Selector Bar */
.user-bar {
  background-color: #e8f5e9;
  padding: 12px 20px;
  border-bottom: 1px solid #c8e6c9;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.user-info {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary-dark);
}

.role-tag {
  font-size: 0.75rem;
  background-color: var(--primary-color);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

/* Main Content Area */
.app-content {
  padding: 20px;
  flex: 1;
}

/* Card Styles */
.form-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.form-card h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Big Button & Input UI for Farmers */
.big-select, .big-input, .big-textarea {
  width: 100%;
  font-size: 1.1rem;
  padding: 14px 16px;
  border: 2px solid #d1d5db;
  border-radius: 10px;
  background-color: #f9fafb;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s;
  margin-bottom: 10px;
}

.big-select:focus, .big-input:focus, .big-textarea:focus {
  border-color: var(--primary-color);
  background-color: #ffffff;
}

/* Field Location Status Box */
.location-box {
  background-color: #f3f4f6;
  border-radius: 10px;
  padding: 12px;
  margin-top: 8px;
  font-size: 0.9rem;
}

.location-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  margin-bottom: 4px;
}

.status-ok { color: var(--success-color); }
.status-warn { color: var(--warning-color); }
.status-err { color: var(--danger-color); }

/* Large Action Buttons */
.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.btn-camera {
  background-color: #e0f2fe;
  border: 2px dashed #0284c7;
  color: #0369a1;
  padding: 20px 10px;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.btn-audio {
  background-color: #fef3c7;
  border: 2px dashed #d97706;
  color: #b45309;
  padding: 20px 10px;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.btn-audio.recording {
  background-color: #fee2e2;
  border-color: #ef4444;
  color: #b91c1c;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(0.98); }
  100% { transform: scale(1); }
}

/* Previews */
.preview-container {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.photo-preview {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #d1d5db;
}

/* Primary Submit Button */
.btn-submit {
  width: 100%;
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 800;
  padding: 16px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(22, 163, 74, 0.3);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.btn-submit:active {
  transform: translateY(2px);
  box-shadow: 0 2px 5px rgba(22, 163, 74, 0.3);
}

.offline-queue-bar {
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 12px 16px;
  border-radius: 10px;
  margin-top: 14px;
  font-size: 0.9rem;
  color: #1e40af;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Admin Dashboard Styles */
.admin-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  border-bottom: 2px solid #e5e7eb;
  padding-bottom: 16px;
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.kanban-col {
  background-color: #f9fafb;
  border-radius: 12px;
  padding: 16px;
  border: 1px solid #e5e7eb;
  min-height: 500px;
}

.kanban-col-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.case-card {
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.case-badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  margin-bottom: 6px;
}

.badge-gps-ok { background-color: #d1fae5; color: #065f46; }
.badge-gps-warn { background-color: #fee2e2; color: #991b1b; }

.case-photo {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 8px;
  margin: 8px 0;
}

.case-btn-group {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.btn-approve {
  flex: 1;
  background-color: var(--success-color);
  color: white;
  border: none;
  padding: 8px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}

.btn-reject {
  flex: 1;
  background-color: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  padding: 8px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}
