/* ========================================
   FORECAST DASHBOARD - CSS Module
   ======================================== */

@import url(./../main.css);
@import url(./../layouts/dashboard-layout.css);
@import url(./../components/sidebar.css);
@import url(./../components/buttons.css);
@import url(./../components/cards.css);

/* ========== SIDEBAR FIX: Hide scrollbar on forecast page ========== */

/* ========== FORECAST CONTAINER ========== */
.forecast-container {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
  margin-block: var(--space-175); /* top + bottom */
}

/* ========== PREDICTION TABS (SEGMENTED CONTROL) ========== */
/* Tabs UI for switching between Water, Air, and Soil predictions */
.prediction-tabs {
  display: flex;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  background: #f8f9fa;
  border-radius: 12px;
  border-bottom: none;
}

.tab-btn {
  flex: 1;
  padding: var(--spacing-md) var(--spacing-lg);
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #666;
}

.tab-btn:hover {
  background: #f0f1f3;
  border-color: #6b9368;
}

.tab-btn.active {
  background: #6b9368;
  color: white;
  border-color: #6b9368;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

/* ========== FORECAST CARD ========== */
.forecast-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.forecast-card .card-header {
  background: #f8f9fa;
  padding: var(--spacing-lg);
  border-bottom: 1px solid #e9ecef;
}

.forecast-card .card-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #333;
}

/* ========== CARD CONTENT PADDING (IMPORTANT) ========== */
.prediction-form,
.prediction-content {
  padding: var(--spacing-xl);
}

/* ========== FORM INPUTS CONTAINER ========== */
/* Container for grouping different prediction type input sets */
.form-inputs-container {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

/* ========== FORM GROUPS (REDUCED SPACING) ========== */
/* Compact form layout with minimal gap between label and input */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(
    --spacing-025
  ); /* Reduced from var(--spacing-sm) for tighter spacing */
}

/* Labels */
.form-label {
  font-weight: 500;
  font-size: 0.95rem;
  color: #555;
  line-height: 1.2;
}

/* Inputs */
.form-input,
.form-select {
  width: 100%;
  padding: var(--spacing-md);
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  box-sizing: border-box;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ========== GRID LAYOUT ========== */
.grid {
  display: grid;
  align-items: stretch; /* force equal height items */
}

.grid.grid-2 {
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-lg);
}

/* ========== BUTTONS (NO MARGIN HACKS) ========== */
.btn {
  padding: 0.75rem var(--spacing-lg);
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: #6b9368;
  color: #fff;
}

.btn-lg {
  width: 100%;
  padding: var(--spacing-md) var(--spacing-lg);
  box-sizing: border-box; /* ensure padding doesn't cause overflow */
}

/* ========== RESULTS ========== */
.prediction-result {
  text-align: center;
}

.prediction-score {
  font-size: 4rem;
  font-weight: bold;
  line-height: 1;
  margin: var(--spacing-lg) 0;
}

.prediction-label {
  padding: var(--spacing-md);
  border-radius: 10px;
  margin-bottom: var(--spacing-xl);
  font-weight: 600;
  font-size: 1.2rem;
}

/* ========== METRICS ========== */
.prediction-metrics {
  margin-top: var(--spacing-xl);
}

.prediction-metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: var(--spacing-sm);
}

.metric-name {
  font-weight: 600;
  color: #333;
}

/* ========== ALERTS ========== */
.alert {
  padding: var(--spacing-md);
  border-radius: 6px;
  margin-bottom: var(--spacing-md);
}

.alert-error {
  background: #fee;
  color: #c33;
  border: 1px solid #fcc;
}

/* ========== LOADING ========== */
.loading {
  width: 20px;
  height: 20px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .grid.grid-2 {
    grid-template-columns: 1fr;
  }

  .prediction-metric-row {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Stack tabs vertically on mobile */
  .prediction-tabs {
    flex-direction: column;
  }

  .tab-btn {
    flex: none;
  }

  /* Reduce card padding on small screens to avoid overflow */
  .prediction-form,
  .prediction-content {
    padding: 12px;
  }

  /* Ensure large buttons don't overflow their container */
  .btn-lg {
    width: 100%;
    padding: 0.75rem 1rem;
    box-sizing: border-box;
  }

  /* Make forecast card full width and simpler spacing */
  .forecast-card {
    padding: 0;
  }
}

/* Ensure button doesn't overflow when inside padded containers */
.prediction-form .btn {
  box-sizing: border-box;
  max-width: 100%;
}

/* Labels */
.form-label {
  font-weight: 500;
  font-size: 0.95rem;
  color: #555;
  line-height: 1.2;
}

/* Inputs */
.form-input,
.form-select {
  width: 100%;
  padding: var(--spacing-md);
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  box-sizing: border-box;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ========== GRID LAYOUT ========== */
.grid {
  display: grid;
  align-items: stretch; /* force equal height items */
}

.grid.grid-2 {
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-lg);
}

/* ========== BUTTONS (NO MARGIN HACKS) ========== */
.btn {
  padding: 0.75rem var(--spacing-lg);
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: #6b9368;
  color: #fff;
}

.btn-lg {
  width: 100%;
  padding: var(--spacing-md) var(--spacing-lg);
}

/* ========== RESULTS ========== */
.prediction-result {
  text-align: center;
}

.prediction-score {
  font-size: 4rem;
  font-weight: bold;
  line-height: 1;
  margin: var(--spacing-lg) 0;
}

.prediction-label {
  padding: var(--spacing-md);
  border-radius: 10px;
  margin-bottom: var(--spacing-xl);
  font-weight: 600;
  font-size: 1.2rem;
}

/* ========== METRICS ========== */
.prediction-metrics {
  margin-top: var(--spacing-xl);
}

.prediction-metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: var(--spacing-sm);
}

.metric-name {
  font-weight: 600;
  color: #333;
}

/* ========== ALERTS ========== */
.alert {
  padding: var(--spacing-md);
  border-radius: 6px;
  margin-bottom: var(--spacing-md);
}

.alert-error {
  background: #fee;
  color: #c33;
  border: 1px solid #fcc;
}

/* ========== LOADING ========== */
.loading {
  width: 20px;
  height: 20px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .grid.grid-2 {
    grid-template-columns: 1fr;
  }

  .prediction-metric-row {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Stack tabs vertically on mobile */
  .prediction-tabs {
    flex-direction: column;
  }

  .tab-btn {
    flex: none;
  }
}
