/* ============================================
   GLOBAL STYLES & RESET
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: linear-gradient(135deg, #5abd93 0%, #030406 100%);
  font-family: 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
  color: #333;
  line-height: 1.6;
  min-height: 100vh;
  padding: 20px 10px;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

/* ============================================
   HEADER STYLES
   ============================================ */
.header {
  background: linear-gradient(135deg, #22657a 0%, #369bd7 100%);
  color: white;
  padding: 40px 30px;
  text-align: center;
}

.header h1 {
  font-size: 2.2em;
  margin-bottom: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.subtitle {
  font-size: 1em;
  font-weight: 300;
  opacity: 0.95;
}

/* ============================================
   FORM SECTION STYLES
   ============================================ */
.form-section {
  padding: 40px;
  background: #f8fafb;
  border-bottom: 1px solid #e0e6ed;
}

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

label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: #22657a;
  font-size: 1em;
}

select, input[type="file"] {
  width: 100%;
  padding: 12px 15px;
  font-size: 1em;
  border: 2px solid #e0e6ed;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

select:hover, input[type="file"]:hover {
  border-color: #369bd7;
}

select:focus, input[type="file"]:focus {
  outline: none;
  border-color: #22657a;
  box-shadow: 0 0 0 3px rgba(34, 101, 122, 0.1);
}

.help-text {
  display: block;
  font-size: 0.85em;
  color: #666;
  margin-top: 5px;
  font-style: italic;
}

/* ============================================
   BUTTON STYLES
   ============================================ */
.btn-primary {
  width: 100%;
  padding: 14px 30px;
  font-size: 1.05em;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, #22657a 0%, #369bd7 100%);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(34, 101, 122, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(34, 101, 122, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-copy {
  padding: 8px 16px;
  font-size: 0.9em;
  background: #369bd7;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 15px;
  transition: all 0.3s ease;
}

.btn-copy:hover {
  background: #22657a;
}

/* ============================================
   RESULTS SECTION STYLES
   ============================================ */
.results-section {
  padding: 40px;
}

.results-section h2 {
  color: #22657a;
  margin-bottom: 25px;
  font-size: 1.8em;
}

#dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 20px;
}

/* ============================================
   SOIL CARD STYLES (COLOR-CODED)
   ============================================ */
.soil-card {
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-left: 5px solid;
  transition: all 0.3s ease;
  background: white;
}

.soil-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

/* Optimal Status */
.soil-card.optimal {
  background: linear-gradient(135deg, #e6fbf2 0%, #d4f7e8 100%);
  border-left-color: #17a87a;
}

.soil-card.optimal h3 {
  color: #17a87a;
}

.soil-card.optimal .health-badge {
  background: #17a87a;
}

/* Deficient Status */
.soil-card.deficient {
  background: linear-gradient(135deg, #fff8e4 0%, #ffefcc 100%);
  border-left-color: #eea930;
}

.soil-card.deficient h3 {
  color: #d4860d;
}

.soil-card.deficient .health-badge {
  background: #eea930;
}

/* Critical Status */
.soil-card.critical {
  background: linear-gradient(135deg, #ffe6e6 0%, #ffcccf 100%);
  border-left-color: #e15252;
}

.soil-card.critical h3 {
  color: #c2313a;
}

.soil-card.critical .health-badge {
  background: #e15252;
}

.soil-card h3 {
  margin-bottom: 15px;
  font-size: 1.3em;
  font-weight: 700;
}

.soil-card p {
  margin-bottom: 10px;
  font-size: 0.95em;
  line-height: 1.5;
}

.soil-card strong {
  color: #22657a;
  font-weight: 600;
}

.health-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  color: white;
  font-size: 0.85em;
  font-weight: 600;
  margin-top: 10px;
}

.deficiency-list {
  background: rgba(0, 0, 0, 0.05);
  padding: 10px 15px;
  border-radius: 6px;
  margin-top: 8px;
  font-size: 0.9em;
}

.deficiency-item {
  display: inline-block;
  background: rgba(255, 255, 255, 0.7);
  padding: 4px 8px;
  margin: 3px 3px 3px 0;
  border-radius: 4px;
  font-weight: 500;
}

.ai-box {
  background: rgba(255, 255, 255, 0.5);
  padding: 12px;
  border-radius: 6px;
  margin-top: 12px;
  font-style: italic;
  border-left: 3px solid currentColor;
}

/* ============================================
   JSON SECTION STYLES
   ============================================ */
.json-section {
  padding: 40px;
  background: #f8fafb;
  border-top: 1px solid #e0e6ed;
}

.json-section h2 {
  color: #22657a;
  margin-bottom: 15px;
  font-size: 1.6em;
}

#json-output {
  background: #1e1e1e;
  color: #e3f6ff;
  padding: 20px;
  border-radius: 8px;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  line-height: 1.4;
  overflow-x: auto;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ============================================
   FOOTER STYLES
   ============================================ */
.footer {
  padding: 20px;
  text-align: center;
  background: #f8fafb;
  border-top: 1px solid #e0e6ed;
  color: #666;
  font-size: 0.9em;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
  .header h1 {
    font-size: 1.6em;
  }

  .form-section, .results-section, .json-section {
    padding: 25px;
  }

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

  .soil-card {
    padding: 15px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 10px;
  }

  .container {
    border-radius: 12px;
  }

  .header {
    padding: 25px 15px;
  }

  .header h1 {
    font-size: 1.3em;
  }

  .subtitle {
    font-size: 0.9em;
  }

  .form-section, .results-section, .json-section {
    padding: 15px;
  }

  #json-output {
    font-size: 0.8em;
    padding: 15px;
  }
}

/* ============================================
   ANIMATIONS & TRANSITIONS
   ============================================ */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.soil-card {
  animation: fadeIn 0.4s ease-out;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.hidden {
  display: none;
}

.show {
  display: block;
}