/* Fertilizer Calculator Styles */

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

.input-section {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.volume-input {
  margin-bottom: 20px;
}

.volume-input label {
  display: block;
  font-weight: bold;
  margin-bottom: 5px;
}

.volume-input input {
  padding: 8px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 4px;
  width: 200px;
}

.volume-control-row {
  display: flex;
  align-items: flex-end;
  gap: 15px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.volume-field {
  display: flex;
  flex-direction: column;
}

.button-group {
  display: flex;
  gap: 10px;
}

.btn {
  padding: 10px 20px;
  font-size: 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary {
  background: #007bff;
  color: white;
}

.btn-primary:hover {
  background: #0056b3;
}

.btn-danger {
  background: #dc3545;
  color: white;
}

.btn-danger:hover {
  background: #c82333;
}

.input-error {
  border-color: #dc3545 !important;
  background-color: #fff5f5 !important;
}

/* Progress bar styles */
.progress-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  justify-content: center;
  align-items: center;
}

.progress-overlay.active {
  display: flex;
}

.progress-container {
  background: white;
  padding: 30px 40px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  text-align: center;
  min-width: 300px;
  max-width: 400px;
}

.progress-container h3 {
  margin: 0 0 20px 0;
  color: #333;
  font-size: 18px;
}

.progress-bar-wrapper {
  background: #e9ecef;
  border-radius: 10px;
  height: 20px;
  overflow: hidden;
  margin-bottom: 15px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #28a745, #20c997);
  border-radius: 10px;
  width: 0%;
  transition: width 0.3s ease;
}

.progress-bar.indeterminate {
  width: 30%;
  animation: indeterminate 1.5s infinite ease-in-out;
}

@keyframes indeterminate {
  0% {
    transform: translateX(-100%);
  }
  50% {
    transform: translateX(200%);
  }
  100% {
    transform: translateX(-100%);
  }
}

.progress-text {
  color: #666;
  font-size: 14px;
  margin: 0;
}

.progress-cancel-btn {
  margin-top: 15px;
  padding: 8px 24px;
  font-size: 14px;
  color: #666;
  background: #f8f9fa;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.progress-cancel-btn:hover {
  background: #e9ecef;
  border-color: #adb5bd;
  color: #333;
}

.fertilizer-selector {
  margin-bottom: 20px;
}

.fertilizer-selector h3 {
  margin-bottom: 10px;
}

.fertilizer-item {
  background: white;
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.fertilizer-item.active {
  border-color: #007bff;
  background: #f0f8ff;
}

.fertilizer-checkbox {
  flex-shrink: 0;
}

.fertilizer-info {
  flex-grow: 1;
}

.fertilizer-name {
  font-weight: bold;
  margin-bottom: 5px;
}

.fertilizer-composition {
  font-size: 0.9em;
  color: #666;
}

.fertilizer-input {
  flex-shrink: 0;
}

.fertilizer-input input {
  padding: 6px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
  width: 100px;
}

.fertilizer-input label {
  display: inline-block;
  margin-left: 5px;
  font-size: 0.9em;
}

.results-section {
  background: white;
  padding: 20px;
  border-radius: 8px;
  border: 2px solid #007bff;
}

.results-section h2 {
  margin-top: 0;
  color: #007bff;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.result-card {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 4px;
  border-left: 4px solid #28a745;
}

.result-card.zero {
  opacity: 0.5;
  border-left-color: #ccc;
}

.result-label {
  font-size: 0.9em;
  color: #666;
  margin-bottom: 5px;
}

.result-value {
  font-size: 1.5em;
  font-weight: bold;
  color: #333;
}

.result-unit {
  font-size: 0.8em;
  color: #666;
  margin-left: 4px;
}

.search-box {
  margin-bottom: 15px;
}

.search-box input {
  width: 100%;
  padding: 10px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.conversion-note {
  background: #fff3cd;
  padding: 10px;
  border-radius: 4px;
  margin-top: 15px;
  font-size: 0.9em;
  color: #856404;
}

.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 2px solid #dee2e6;
}

.tab {
  padding: 12px 24px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  color: #6c757d;
  transition: all 0.3s;
}

.tab:hover {
  color: #007bff;
  background: #f8f9fa;
}

.tab.active {
  color: #007bff;
  border-bottom-color: #007bff;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Wizard Mode Selector */
.mode-selector {
  padding: 20px 0;
}

.mode-selector h2 {
  text-align: center;
  margin-bottom: 10px;
  color: #333;
}

.mode-selector > p {
  text-align: center;
  color: #666;
  margin-bottom: 30px;
}

.mode-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  max-width: 1000px;
  margin: 0 auto;
}

.mode-card {
  background: #fff;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 24px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.mode-card:hover {
  border-color: #007bff;
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
  transform: translateY(-2px);
}

.mode-card h3 {
  color: #007bff;
  margin: 0 0 12px 0;
  font-size: 1.2em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mode-card h3 svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.mode-card .description {
  color: #555;
  font-size: 0.95em;
  line-height: 1.5;
  margin-bottom: 15px;
}

.mode-card .use-case {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 12px;
  font-size: 0.85em;
}

.mode-card .use-case strong {
  color: #333;
  display: block;
  margin-bottom: 5px;
}

.mode-card .use-case span {
  color: #666;
}

.wizard-header {
  position: sticky;
  top: 0;
  background: #fff;
  padding: 15px 0;
  margin: -15px 0 15px 0;
  border-bottom: 1px solid #eee;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 15px;
}

.wizard-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f8f9fa;
  border: 1px solid #ddd;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  color: #555;
  font-size: 0.9em;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.wizard-back-btn:hover {
  background: #e9ecef;
  border-color: #ccc;
  color: #333;
}

.wizard-back-btn svg {
  width: 16px;
  height: 16px;
}

.wizard-current-mode {
  font-size: 0.9em;
  color: #666;
}

.wizard-current-mode strong {
  color: #007bff;
}

/* Step 2: Volume Selection */
.volume-step {
  display: none;
  max-width: 450px;
  margin: 40px auto;
  padding: 30px;
  background: #fff;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  text-align: center;
}

.volume-step.active {
  display: block;
}

.volume-step h3 {
  margin: 0 0 8px 0;
  color: #333;
  font-size: 1.3em;
}

.volume-step .step-indicator {
  color: #007bff;
  font-size: 0.85em;
  margin-bottom: 15px;
}

.volume-step p {
  color: #666;
  margin-bottom: 20px;
  font-size: 0.95em;
}

.volume-step-input {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 25px;
}

.volume-step-input input {
  width: 120px;
  padding: 12px 15px;
  font-size: 1.2em;
  text-align: center;
  border: 2px solid #ddd;
  border-radius: 8px;
  transition: border-color 0.2s;
}

.volume-step-input input:focus {
  outline: none;
  border-color: #007bff;
}

.volume-step-input span {
  font-size: 1.1em;
  color: #555;
}

.volume-step-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.volume-step-buttons button {
  padding: 10px 24px;
  border-radius: 6px;
  font-size: 0.95em;
  cursor: pointer;
  transition: all 0.2s;
}

.volume-step-buttons .btn-back {
  background: #f8f9fa;
  border: 1px solid #ddd;
  color: #555;
  order: 1;
}

.volume-step-buttons .btn-back:hover {
  background: #e9ecef;
}

.volume-step-buttons .btn-continue {
  background: #007bff;
  border: 1px solid #007bff;
  color: #fff;
  order: 2;
}

.volume-step-buttons .btn-continue:hover {
  background: #0056b3;
}

/* Step 3: Calculation Mode Selection */
.calc-mode-step {
  display: none;
  max-width: 500px;
  margin: 40px auto;
  padding: 30px;
  background: #fff;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  text-align: center;
}

.calc-mode-step.active {
  display: block;
}

.calc-mode-step h3 {
  margin: 0 0 8px 0;
  color: #333;
  font-size: 1.3em;
}

.calc-mode-step .step-indicator {
  color: #007bff;
  font-size: 0.85em;
  margin-bottom: 15px;
}

.calc-mode-step > p {
  color: #666;
  margin-bottom: 20px;
  font-size: 0.95em;
}

.calc-mode-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 25px;
  text-align: left;
}

.calc-mode-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 15px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.calc-mode-option:hover {
  border-color: #007bff;
  background: #f8f9ff;
}

.calc-mode-option.selected {
  border-color: #007bff;
  background: #f0f7ff;
}

.calc-mode-option input[type="radio"] {
  margin-top: 3px;
  accent-color: #007bff;
}

.calc-mode-option-content {
  flex: 1;
}

.calc-mode-option-content strong {
  display: block;
  color: #333;
  margin-bottom: 4px;
}

.calc-mode-option-content span {
  font-size: 0.85em;
  color: #666;
}

/* Step 4: Target EC Selection */
.ec-step {
  display: none;
  max-width: 500px;
  margin: 40px auto;
  padding: 30px;
  background: #fff;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  text-align: center;
}

.ec-step.active {
  display: block;
}

.ec-step h3 {
  margin: 0 0 8px 0;
  color: #333;
  font-size: 1.3em;
}

.ec-step .step-indicator {
  color: #007bff;
  font-size: 0.85em;
  margin-bottom: 15px;
}

.ec-step > p {
  color: #666;
  margin-bottom: 20px;
  font-size: 0.95em;
}

.ec-step-select {
  margin-bottom: 25px;
}

.ec-step-select select {
  width: 100%;
  max-width: 350px;
  padding: 12px 15px;
  font-size: 1em;
  border: 2px solid #ddd;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s;
}

.ec-step-select select:focus {
  outline: none;
  border-color: #007bff;
}

.ec-step .ec-description {
  font-size: 0.85em;
  color: #666;
  margin-top: 10px;
}

/* Wizard Input Steps (larger steps with form inputs) */
.wizard-input-step {
  display: none;
  max-width: 700px;
  margin: 30px auto;
  padding: 25px 30px;
  background: #fff;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
}

.wizard-input-step.active {
  display: block;
}

.wizard-input-step .step-indicator {
  color: #007bff;
  font-size: 0.85em;
  margin-bottom: 10px;
  text-align: center;
}

.wizard-input-step h3 {
  margin: 0 0 8px 0;
  color: #333;
  font-size: 1.3em;
  text-align: center;
}

.wizard-input-step > p {
  color: #666;
  margin-bottom: 20px;
  font-size: 0.95em;
  text-align: center;
}

.wizard-input-step .input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.wizard-input-step .input-field {
  display: flex;
  flex-direction: column;
}

.wizard-input-step .input-field label {
  font-weight: 600;
  margin-bottom: 5px;
  font-size: 0.85em;
  color: #444;
}

.wizard-input-step .input-field input {
  padding: 10px 12px;
  font-size: 1em;
  border: 2px solid #ddd;
  border-radius: 6px;
  transition: border-color 0.2s;
}

.wizard-input-step .input-field input:focus {
  outline: none;
  border-color: #007bff;
}

.wizard-input-step .input-field input::placeholder {
  color: #aaa;
}

/* Fertilizer selection in wizard */
.wizard-fertilizer-section {
  margin-bottom: 20px;
}

.wizard-fertilizer-section h4 {
  margin: 0 0 10px 0;
  font-size: 1em;
  color: #333;
}

.wizard-fertilizer-search {
  margin-bottom: 12px;
}

.wizard-fertilizer-search input {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.95em;
  border: 2px solid #ddd;
  border-radius: 6px;
  box-sizing: border-box;
}

.wizard-fertilizer-search input:focus {
  outline: none;
  border-color: #007bff;
}

.wizard-fertilizer-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 8px;
}

.wizard-fertilizer-item {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.wizard-fertilizer-item:hover {
  background: #f5f5f5;
}

.wizard-fertilizer-item.selected {
  background: #e8f4ff;
}

.wizard-fertilizer-item input[type="checkbox"],
.wizard-fert-checkbox {
  margin-right: 10px;
  accent-color: #007bff;
  flex-shrink: 0;
}

.wizard-fertilizer-item .fert-name,
.wizard-fert-label {
  flex: 1;
  font-size: 0.9em;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
}

.wizard-fert-name {
  font-weight: 500;
  color: #333;
}

.wizard-fert-aliases {
  font-size: 0.8em;
  color: #666;
}

.wizard-fertilizer-item .fert-grams,
.wizard-grams-input {
  width: 80px;
  padding: 6px 8px;
  font-size: 0.9em;
  border: 1px solid #ddd;
  border-radius: 4px;
  text-align: center;
  flex-shrink: 0;
}

.wizard-fertilizer-item .fert-grams:disabled,
.wizard-grams-input:disabled {
  background: #f5f5f5;
  color: #999;
}

.wizard-grams-input:focus {
  border-color: #007bff;
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.wizard-selection-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.wizard-selection-controls button {
  padding: 6px 12px;
  font-size: 0.8em;
  border: 1px solid #ddd;
  background: #f8f9fa;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.wizard-selection-controls button:hover {
  background: #e9ecef;
}

.wizard-step-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 25px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.wizard-step-buttons button {
  padding: 12px 28px;
  border-radius: 6px;
  font-size: 1em;
  cursor: pointer;
  transition: all 0.2s;
}

.wizard-step-buttons .btn-back {
  background: #f8f9fa;
  border: 1px solid #ddd;
  color: #555;
  order: 1;
}

.wizard-step-buttons .btn-back:hover {
  background: #e9ecef;
}

.wizard-step-buttons .btn-continue {
  background: #007bff;
  border: 1px solid #007bff;
  color: #fff;
  order: 2;
}

.wizard-step-buttons .btn-continue:hover {
  background: #0056b3;
}

.wizard-step-buttons .btn-calculate {
  background: #28a745;
  border: 1px solid #28a745;
  color: #fff;
  order: 2;
}

.wizard-step-buttons .btn-calculate:hover {
  background: #218838;
}

.calculator-content {
  display: none;
}

.calculator-content.active {
  display: block;
}

.wizard-results {
  display: none;
}

.wizard-results.active {
  display: block;
}

#wizard-results-container {
  margin-top: 20px;
}

/* Two-Tank Question Step Styles */
.two-tank-explanation {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 20px;
  margin: 20px 0;
}

.incompatibility-warning {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 6px;
  padding: 12px 15px;
  margin-bottom: 15px;
}

.incompatibility-warning svg {
  color: #856404;
  flex-shrink: 0;
}

.incompatibility-warning span {
  color: #856404;
  font-weight: 500;
}

.two-tank-explanation > p {
  color: #495057;
  line-height: 1.6;
  margin-bottom: 15px;
}

.two-tank-info {
  background: #e8f4f8;
  border-left: 4px solid #17a2b8;
  border-radius: 4px;
  padding: 15px;
  margin-top: 15px;
}

.two-tank-info h4 {
  color: #0c5460;
  margin: 0 0 10px 0;
  font-size: 1.05em;
}

.two-tank-info p {
  color: #495057;
  margin: 0 0 10px 0;
  line-height: 1.5;
}

.two-tank-info ul {
  margin: 10px 0;
  padding-left: 20px;
}

.two-tank-info li {
  color: #495057;
  margin-bottom: 8px;
  line-height: 1.5;
}

.two-tank-info li strong {
  color: #0c5460;
}

.two-tank-buttons {
  justify-content: center;
  gap: 15px;
}

.two-tank-buttons button {
  background: #fff !important;
  border: 2px solid #007bff !important;
  color: #007bff !important;
  flex: 0 1 auto;
  min-width: 180px;
}

.two-tank-buttons button:hover {
  background: #007bff !important;
  color: #fff !important;
}

#wizard-results-container .results-section {
  display: block !important;
}

.target-input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.target-input-field {
  display: flex;
  flex-direction: column;
}

.target-input-field label {
  font-weight: bold;
  margin-bottom: 5px;
  font-size: 0.9em;
}

.target-input-field input {
  padding: 8px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.formula-result {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 4px;
  margin-bottom: 15px;
}

.formula-fertilizer {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px;
  background: white;
  margin-bottom: 8px;
  border-radius: 4px;
  border-left: 4px solid #28a745;
  flex-wrap: wrap;
  gap: 5px;
}

.formula-fertilizer-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.formula-fertilizer-name {
  font-weight: bold;
  color: #333;
}

.formula-fertilizer-composition {
  font-size: 0.85em;
  color: #666;
  margin-top: 2px;
}

.formula-fertilizer-amount {
  font-weight: bold;
  white-space: nowrap;
  text-align: right;
}

.ion-balance-summary {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.ion-balance-card {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 4px;
  text-align: center;
}

.ion-balance-card.status {
  border: 2px solid;
}

.ion-balance-breakdown {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

.tank-nutrient-badge {
  padding: 4px 8px;
  background: white;
  border-radius: 4px;
  font-size: 0.85em;
}

.tank-status-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.85em;
}

.ion-list-item {
  display: flex;
  justify-content: space-between;
  padding: 8px;
  background: #f8f9fa;
  margin-bottom: 5px;
  border-radius: 4px;
}

.nutrient-ratio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 15px;
  margin-top: 10px;
}

.nutrient-ratio-card {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 4px;
  border-left: 4px solid #007bff;
}

.comparison-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 15px;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0;
}

.comparison-table th,
.comparison-table td {
  padding: 10px;
  text-align: left;
  border-bottom: 1px solid #dee2e6;
}

.comparison-table th {
  background: #f8f9fa;
  font-weight: bold;
}

.comparison-table .match {
  color: #28a745;
  font-weight: bold;
}

.comparison-table .close {
  color: #ffc107;
  font-weight: bold;
}

.comparison-table .miss {
  color: #dc3545;
  font-weight: bold;
}

.warning-box {
  background: #fff3cd;
  border-left: 4px solid #ffc107;
  padding: 15px;
  border-radius: 4px;
  margin-top: 15px;
}

.error-box {
  background: #f8d7da;
  border-left: 4px solid #dc3545;
  padding: 15px;
  border-radius: 4px;
  margin-top: 15px;
}

.fertilizer-selection {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 4px;
  margin-bottom: 20px;
}

.fertilizer-selection h4 {
  margin-top: 0;
  margin-bottom: 10px;
}

.fertilizer-search {
  margin-bottom: 10px;
}

.fertilizer-search input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  box-sizing: border-box;
}

.fertilizer-search input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.fertilizer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  padding: 10px;
  background: white;
  border-radius: 4px;
}

.fertilizer-checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px;
}

.fertilizer-checkbox-item input[type="checkbox"] {
  cursor: pointer;
  margin-top: 3px;
}

.fertilizer-checkbox-item label {
  cursor: pointer;
  font-size: 0.9em;
  margin: 0;
  display: flex;
  flex-direction: column;
}

.fertilizer-label-name {
  font-weight: bold;
}

.fertilizer-label-aliases {
  font-size: 0.85em;
  color: #666;
  margin-top: 2px;
}

.fertilizer-priority {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.fertilizer-priority input {
  width: 45px;
  padding: 2px 4px;
  font-size: 0.85em;
  border: 1px solid #ccc;
  border-radius: 3px;
  text-align: center;
}

.fertilizer-priority label {
  font-size: 0.75em;
  color: #666;
  white-space: nowrap;
}

.selection-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.selection-controls button {
  padding: 5px 10px;
  font-size: 0.85em;
  background: #6c757d;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.selection-controls button:hover {
  background: #5a6268;
}

.selected-fertilizer-item {
  background: #f8f9fa;
  padding: 12px 15px;
  border-radius: 4px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-left: 4px solid #007bff;
  flex-wrap: wrap;
  gap: 5px;
}

.selected-fertilizer-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.selected-fertilizer-name {
  font-weight: bold;
  color: #333;
}

.selected-fertilizer-composition {
  font-size: 0.85em;
  color: #666;
  margin-top: 2px;
}

.selected-fertilizer-amount {
  color: #007bff;
  font-weight: bold;
  font-size: 1.1em;
  white-space: nowrap;
}

.selected-fertilizer-total {
  background: #e8f5e9;
  border-left: 4px solid #4caf50;
  margin-top: 10px;
}

.selected-fertilizer-total .selected-fertilizer-name {
  color: #2e7d32;
}

.selected-fertilizer-total .selected-fertilizer-amount {
  color: #2e7d32;
  font-size: 1.2em;
}

.fertilizer-number {
  color: #007bff;
  margin-right: 5px;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
  .calculator-container {
    padding: 10px;
  }

  h1 {
    font-size: 1.5em;
  }

  h2 {
    font-size: 1.3em;
  }

  h3 {
    font-size: 1.1em;
  }

  .input-section {
    padding: 15px;
  }

  .volume-control-row {
    flex-direction: column;
    align-items: stretch;
  }

  .volume-field {
    width: 100%;
  }

  .volume-field input {
    width: 100%;
  }

  .button-group {
    width: 100%;
    flex-direction: column;
  }

  .btn {
    width: 100%;
    padding: 12px;
    font-size: 14px;
  }

  .fertilizer-item {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
  }

  .fertilizer-info {
    width: 100%;
  }

  .fertilizer-input {
    width: 100%;
  }

  .fertilizer-input input {
    width: 100%;
    padding: 10px;
    font-size: 16px;
  }

  .search-box input {
    width: 100%;
    font-size: 16px;
    padding: 10px;
  }

  .results-section {
    padding: 15px;
  }

  .results-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .result-card {
    padding: 12px;
  }

  .result-value {
    font-size: 1.3em;
  }

  .tabs {
    flex-direction: column;
  }

  .tab {
    width: 100%;
    text-align: center;
  }

  .comparison-table {
    font-size: 14px;
  }

  .comparison-table th,
  .comparison-table td {
    padding: 8px 4px;
    font-size: 12px;
  }

  .comparison-table th:first-child,
  .comparison-table td:first-child {
    position: sticky;
    left: 0;
    background: white;
    z-index: 1;
  }

  .comparison-table th:first-child {
    background: #f8f9fa;
  }

  .ion-balance-summary {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .ion-balance-card {
    padding: 12px;
  }

  .ion-balance-breakdown {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .ion-list-item {
    flex-direction: column;
    gap: 5px;
    text-align: left;
  }

  .nutrient-ratio-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .nutrient-ratio-card {
    padding: 12px;
  }

  .selected-fertilizer-item {
    padding: 10px;
    font-size: 0.9em;
  }

  .selected-fertilizer-amount {
    font-size: 1em;
  }

  .selected-fertilizer-composition,
  .formula-fertilizer-composition {
    font-size: 0.8em;
    word-break: break-word;
  }

  .formula-fertilizer {
    padding: 8px;
  }

  /* Formula Builder Mobile Styles */
  .target-inputs {
    grid-template-columns: 1fr !important;
  }

  .target-input-group {
    width: 100%;
  }

  .target-input-group input {
    width: 100%;
    font-size: 16px;
    padding: 10px;
  }

  .fertilizer-selection-grid {
    grid-template-columns: 1fr !important;
  }

  .available-fert-item {
    padding: 10px;
  }

  /* Ratio and Balance Tables */
  .ratio-table, .balance-table {
    font-size: 0.85em;
    overflow-x: auto;
    display: block;
  }

  .ratio-table td, .ratio-table th,
  .balance-table td, .balance-table th {
    padding: 6px;
  }

  .conversion-note {
    font-size: 0.85em;
    padding: 8px;
  }

  .warning-box {
    font-size: 0.85em;
    padding: 8px;
  }
}

@media (max-width: 480px) {
  .calculator-container {
    padding: 5px;
  }

  h1 {
    font-size: 1.3em;
  }

  h2 {
    font-size: 1.1em;
  }

  .input-section, .results-section {
    padding: 10px;
  }

  .btn {
    font-size: 13px;
    padding: 10px;
  }

  .fertilizer-item {
    padding: 10px;
  }

  .fertilizer-name {
    font-size: 0.95em;
  }

  .fertilizer-composition {
    font-size: 0.8em;
  }

  .result-card {
    padding: 10px;
  }

  .result-label {
    font-size: 0.85em;
  }

  .result-value {
    font-size: 1.2em;
  }
}

/* Educational Modal Styles */
.info-icon {
  display: inline-block;
  width: 24px;
  height: 24px;
  background: #007bff;
  color: white;
  border-radius: 50%;
  text-align: center;
  line-height: 24px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  margin-left: 10px;
  transition: all 0.3s;
  vertical-align: middle;
}

.info-icon:hover {
  background: #0056b3;
  transform: scale(1.1);
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #28a745;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.copy-btn:hover {
  background: #218838;
  transform: translateY(-1px);
}

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

.copy-btn.copied {
  background: #17a2b8;
}

.copy-btn svg {
  width: 16px;
  height: 16px;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 15px;
}

.results-header h2,
.results-header h3 {
  margin: 0;
}

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  overflow-y: auto;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: white;
  border-radius: 12px;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease-out;
}

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

.modal-header {
  background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
  color: white;
  padding: 25px;
  border-radius: 12px 12px 0 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.modal-header h2 {
  margin: 0;
  color: white;
  font-size: 1.5em;
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 20px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

.modal-body {
  padding: 30px;
}

.explanation-section {
  margin-bottom: 30px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #007bff;
}

.explanation-section h3 {
  color: #007bff;
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 1.2em;
}

.explanation-section p {
  margin-bottom: 10px;
  line-height: 1.6;
}

.formula-box {
  background: white;
  padding: 20px;
  border-radius: 8px;
  border: 2px solid #007bff;
  margin: 15px 0;
  font-family: 'Courier New', monospace;
  text-align: center;
}

.formula-box .formula {
  font-size: 1.2em;
  font-weight: bold;
  color: #007bff;
  margin-bottom: 10px;
}

.formula-box .description {
  font-size: 0.9em;
  color: #666;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.example-box {
  background: #e8f4f8;
  padding: 20px;
  border-radius: 8px;
  margin: 15px 0;
  border-left: 4px solid #17a2b8;
}

.example-box h4 {
  color: #17a2b8;
  margin-top: 0;
  margin-bottom: 10px;
}

.step {
  padding: 15px;
  margin: 10px 0;
  background: white;
  border-radius: 6px;
  border-left: 3px solid #28a745;
}

.step-number {
  display: inline-block;
  background: #28a745;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  text-align: center;
  line-height: 28px;
  margin-right: 10px;
  font-weight: bold;
}

.conversion-table {
  width: 100%;
  border-collapse: collapse;
  margin: 15px 0;
  background: white;
}

.conversion-table th,
.conversion-table td {
  padding: 12px;
  text-align: left;
  border: 1px solid #dee2e6;
}

.conversion-table th {
  background: #007bff;
  color: white;
  font-weight: bold;
}

.conversion-table tr:nth-child(even) {
  background: #f8f9fa;
}

.highlight {
  background: #fff3cd;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: bold;
}

@media (max-width: 768px) {
  .modal-content {
    margin: 10px;
    max-height: 95vh;
  }

  .modal-header {
    padding: 20px;
  }

  .modal-header h2 {
    font-size: 1.2em;
  }

  .modal-body {
    padding: 20px;
  }

  .explanation-section {
    padding: 15px;
  }

  .formula-box .formula {
    font-size: 1em;
  }

  /* Mobile-friendly tables */
  .conversion-table {
    display: block;
    overflow-x: auto;
  }

  .conversion-table thead {
    display: none;
  }

  .conversion-table tbody {
    display: block;
  }

  .conversion-table tr {
    display: block;
    margin-bottom: 12px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 10px;
    background: #f8f9fa;
  }

  .conversion-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    border: none;
    border-bottom: 1px solid #eee;
    text-align: right;
  }

  .conversion-table td:last-child {
    border-bottom: none;
  }

  .conversion-table td::before {
    content: attr(data-label);
    font-weight: bold;
    color: #007bff;
    text-align: left;
    flex: 1;
    margin-right: 10px;
  }

  .conversion-table td[style*="monospace"] {
    font-size: 0.8em !important;
    word-break: break-all;
  }

  /* Step section adjustments for mobile */
  .step > div[style*="margin-left: 38px"] {
    margin-left: 0 !important;
  }

  .step p[style*="margin: 10px 0 10px 38px"] {
    margin-left: 0 !important;
  }
}
