/* ===================== FARMGUARD DESIGN SYSTEM ===================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --green-dark: #2D5016;
  --green-mid: #4A7C23;
  --green-light: #6B9B37;
  --gold: #D4A843;
  --gold-light: #F0D78C;
  --cream: #FAFAF5;
  --text-dark: #1A1A1A;
  --text-mid: #4A4A4A;
  --text-light: #6B6B6B;
  --white: #FFFFFF;
  --red-soft: #C0392B;
  --border: #E0E0D8;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text-dark);
  line-height: 1.6;
  background: var(--cream);
}

a { color: var(--green-mid); text-decoration: none; }
a:hover { color: var(--green-dark); }

/* ===================== TOPBAR ===================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--white);
  border-bottom: 1px solid #E5E5E5;
  box-shadow: var(--shadow-sm);
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 64px;
}
.topbar-logo { display: flex; align-items: center; text-decoration: none; }
.topbar-logo img, .topbar-logo svg { height: 40px; width: auto; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-user {
  font-size: 14px;
  color: var(--text-mid);
}
.topbar-user strong { color: var(--green-dark); }

/* ===================== BUTTONS ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-primary {
  background: var(--green-mid);
  color: var(--white);
}
.btn-primary:hover { background: var(--green-dark); color: var(--white); }
.btn-gold {
  background: var(--gold);
  color: var(--green-dark);
}
.btn-gold:hover { background: var(--gold-light); }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-mid);
}
.btn-outline:hover { background: var(--cream); border-color: #ccc; }
.btn-danger {
  background: var(--red-soft);
  color: var(--white);
}
.btn-danger:hover { background: #A93226; color: var(--white); }
.btn-sm { padding: 8px 16px; font-size: 14px; }
.btn-lg { padding: 16px 32px; font-size: 17px; }
.btn-block { display: flex; width: 100%; }
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===================== FORMS ===================== */
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  background: var(--white);
  transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--green-mid);
  box-shadow: 0 0 0 3px rgba(74,124,35,0.1);
}
.form-group textarea { resize: vertical; min-height: 100px; }
.form-hint {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 4px;
}
.form-error {
  font-size: 13px;
  color: var(--red-soft);
  margin-top: 4px;
}

/* ===================== CARDS ===================== */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 28px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.card-header h2 {
  font-size: 20px;
  color: var(--green-dark);
}

/* ===================== AUTH PAGES ===================== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: var(--cream);
}
.auth-box {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}
.auth-box .logo-wrap {
  text-align: center;
  margin-bottom: 28px;
}
.auth-box .logo-wrap img,
.auth-box .logo-wrap svg { height: 48px; }
.auth-box h1 {
  font-size: 24px;
  color: var(--green-dark);
  margin-bottom: 6px;
  text-align: center;
}
.auth-box .auth-sub {
  text-align: center;
  font-size: 15px;
  color: var(--text-mid);
  margin-bottom: 28px;
}
.auth-box .form-switch {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-mid);
}
.auth-box .form-switch a {
  color: var(--green-mid);
  font-weight: 600;
}

/* ===================== APP LAYOUT ===================== */
.app-layout {
  display: flex;
  min-height: calc(100vh - 64px);
}
.sidebar {
  width: 240px;
  background: var(--white);
  border-right: 1px solid #E5E5E5;
  padding: 24px 0;
  flex-shrink: 0;
}
.sidebar-nav { list-style: none; }
.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-mid);
  text-decoration: none;
  transition: all 0.1s;
}
.sidebar-nav li a:hover {
  background: rgba(45,80,22,0.05);
  color: var(--green-dark);
}
.sidebar-nav li a.active {
  background: rgba(45,80,22,0.08);
  color: var(--green-dark);
  font-weight: 600;
  border-right: 3px solid var(--green-mid);
}
.main-content {
  flex: 1;
  padding: 32px;
  max-width: 900px;
}
.main-content h1 {
  font-size: 28px;
  color: var(--green-dark);
  margin-bottom: 8px;
}
.main-content .page-subtitle {
  font-size: 16px;
  color: var(--text-mid);
  margin-bottom: 32px;
}

/* ===================== UPLOAD ZONE ===================== */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--white);
}
.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--green-mid);
  background: rgba(74,124,35,0.04);
}
.upload-zone.dragover {
  border-style: solid;
  box-shadow: 0 0 0 4px rgba(74,124,35,0.1);
}
.upload-icon {
  font-size: 48px;
  margin-bottom: 12px;
}
.upload-zone h3 {
  font-size: 18px;
  color: var(--green-dark);
  margin-bottom: 8px;
}
.upload-zone p {
  font-size: 15px;
  color: var(--text-mid);
  margin-bottom: 16px;
}
.upload-or {
  font-size: 13px;
  color: var(--text-light);
  margin: 12px 0;
}
.camera-btn {
  display: none; /* shown on mobile via JS */
  margin-top: 12px;
}

/* ===================== FILE LIST ===================== */
.file-list { margin-top: 20px; }
.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--cream);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.file-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.file-icon { font-size: 24px; }
.file-name { font-size: 14px; font-weight: 500; }
.file-size { font-size: 13px; color: var(--text-light); }
.file-remove {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 18px;
  padding: 4px 8px;
  border-radius: 4px;
}
.file-remove:hover { background: #fee; color: var(--red-soft); }
.file-progress {
  height: 3px;
  background: #E0E0D8;
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}
.file-progress-bar {
  height: 100%;
  background: var(--green-mid);
  border-radius: 2px;
  transition: width 0.3s;
}

/* ===================== STEPS / WIZARD ===================== */
.wizard-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 36px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}
.wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}
.wizard-dot {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
  z-index: 1;
}
.wizard-dot.done { background: var(--green-mid); color: var(--white); }
.wizard-dot.active { background: var(--gold); color: var(--green-dark); box-shadow: 0 0 0 4px rgba(212,168,67,0.25); }
.wizard-dot.pending { background: #E0E0D8; color: var(--text-light); }
.wizard-label { font-size: 12px; color: var(--text-mid); text-align: center; }
.wizard-line {
  flex: 1;
  height: 3px;
  background: #E0E0D8;
  margin-bottom: 28px;
}
.wizard-line.done { background: var(--green-mid); }

/* ===================== QUESTIONNAIRE ===================== */
.question-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.question-card h3 {
  font-size: 17px;
  color: var(--green-dark);
  margin-bottom: 6px;
}
.question-card .q-hint {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 16px;
}
.radio-group, .checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.radio-option, .checkbox-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}
.radio-option:hover, .checkbox-option:hover {
  border-color: var(--green-mid);
  background: rgba(74,124,35,0.03);
}
.radio-option.selected, .checkbox-option.selected {
  border-color: var(--green-mid);
  background: rgba(74,124,35,0.06);
}
.radio-option input, .checkbox-option input { accent-color: var(--green-mid); }

/* ===================== STATUS BADGES ===================== */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
}
.badge-pending { background: #FFF4D6; color: #8B6914; }
.badge-review { background: #DBEAFE; color: #1E40AF; }
.badge-complete { background: #E8F5E1; color: var(--green-mid); }
.badge-payment { background: #FDE8E8; color: var(--red-soft); }

/* ===================== REPORT VIEW ===================== */
.report-locked {
  text-align: center;
  padding: 60px 20px;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.report-locked .lock-icon { font-size: 64px; margin-bottom: 16px; }
.report-locked h2 { font-size: 24px; color: var(--green-dark); margin-bottom: 8px; }
.report-locked p { font-size: 16px; color: var(--text-mid); max-width: 400px; margin: 0 auto 24px; }

.report-section {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.report-section h2 {
  font-size: 22px;
  color: var(--green-dark);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--cream);
}

.finding-card {
  border-left: 4px solid var(--red-soft);
  background: #FFF8F6;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 20px;
  margin-bottom: 16px;
}
.finding-card.finding-warning {
  border-left-color: var(--gold);
  background: #FFFBF0;
}
.finding-card.finding-ok {
  border-left-color: var(--green-mid);
  background: #F6FBF3;
}
.finding-card h4 {
  font-size: 16px;
  margin-bottom: 6px;
}
.finding-card p {
  font-size: 15px;
  color: var(--text-mid);
  margin-bottom: 8px;
}
.finding-action {
  font-size: 14px;
  font-weight: 600;
  color: var(--green-dark);
  background: rgba(74,124,35,0.08);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-top: 8px;
}

/* Document annotation overlay */
.doc-viewer {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 16px 0;
}
.doc-viewer img {
  width: 100%;
  display: block;
}
.highlight-box {
  position: absolute;
  border: 3px solid var(--red-soft);
  background: rgba(192,57,43,0.1);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}
.highlight-box:hover {
  background: rgba(192,57,43,0.2);
  box-shadow: 0 0 0 4px rgba(192,57,43,0.15);
}
.highlight-box.warning {
  border-color: var(--gold);
  background: rgba(212,168,67,0.1);
}
.highlight-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-dark);
  color: var(--white);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  white-space: nowrap;
  display: none;
  z-index: 10;
}
.highlight-box:hover .highlight-tooltip { display: block; }

/* ===================== PAYMENT GATE ===================== */
.payment-gate {
  text-align: center;
  padding: 48px 24px;
  background: linear-gradient(135deg, var(--green-dark), var(--green-mid));
  border-radius: var(--radius-lg);
  color: var(--white);
  box-shadow: var(--shadow-lg);
}
.payment-gate h2 { font-size: 26px; margin-bottom: 8px; }
.payment-gate p { font-size: 16px; opacity: 0.9; max-width: 450px; margin: 0 auto 12px; }
.payment-price {
  font-size: 48px;
  font-weight: 800;
  margin: 16px 0 4px;
}
.payment-note {
  font-size: 14px;
  opacity: 0.7;
  margin-bottom: 24px;
}
.payment-features {
  list-style: none;
  text-align: left;
  max-width: 320px;
  margin: 0 auto 28px;
}
.payment-features li {
  padding: 6px 0;
  font-size: 15px;
  padding-left: 28px;
  position: relative;
}
.payment-features li::before {
  content: '\2713';
  position: absolute;
  left: 0;
  color: var(--gold-light);
  font-weight: 700;
}

/* ===================== ADMIN ===================== */
.audit-queue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--cream);
}
.audit-queue-item:last-child { border-bottom: none; }
.queue-info h4 { font-size: 15px; color: var(--text-dark); margin-bottom: 2px; }
.queue-info p { font-size: 13px; color: var(--text-light); }
.queue-actions { display: flex; gap: 8px; }

/* ===================== ALERTS ===================== */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
}
.alert-success { background: #E8F5E1; color: #2D5016; border: 1px solid #C5E1B5; }
.alert-error { background: #FDE8E8; color: #922; border: 1px solid #F5C5C5; }
.alert-info { background: #DBEAFE; color: #1E40AF; border: 1px solid #B5D0F5; }
.alert-warning { background: #FFF4D6; color: #8B6914; border: 1px solid #F0D78C; }

/* ===================== LOADING ===================== */
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.spinner-dark {
  border-color: rgba(0,0,0,0.1);
  border-top-color: var(--green-mid);
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(250,250,245,0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 5000;
}
.loading-overlay p { margin-top: 16px; color: var(--text-mid); font-size: 16px; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { padding: 20px 16px; }
  .auth-box { padding: 28px 20px; }
  .wizard-label { font-size: 11px; }
  .topbar-inner { padding: 0 16px; }
}
