/* =========================================================
   IRRIGATION RECOMMENDATION PAGE — LAYOUT CONTRACT
   ---------------------------------------------------------
   Goals:
   1) The page must fill the available content area (parent),
      NOT force the browser window to scroll.
   2) The header stays at the top at natural height.
   3) Only the plant-units body scrolls vertically.
   4) Never create horizontal overflow (prevents sidebar X-scroll).
   5) Last element is fully visible (extra bottom padding).
   ---------------------------------------------------------
   Required parent behavior (in app.css):
   - #page-content / .sg-page-content should be display:flex (column)
     and overflow:hidden (no scroll there).
   ========================================================= */


/* ---------------------------------------------------------
   0) Minimal horizontal overflow guard (optional)
   NOTE: This prevents global X-scrollbars if something leaks.
   If you don't want any global effect, you can remove this block.
   --------------------------------------------------------- */
html, body {
  overflow-x: hidden !important;
}


/* ---------------------------------------------------------
   1) Page wrapper (fills available parent height)
   IMPORTANT: flex: 1 1 auto makes this element actually
   take the remaining height inside #page-content (flex column).
   Without it, inner scroll regions may not get a real height.
   --------------------------------------------------------- */
.irrigation-recommendation-page {
  flex: 1 1 auto;           /* ✅ CRITICAL: fill parent flex height */
  height: 100%;             /* ok to keep */
  width: 100%;

  display: flex;
  flex-direction: column;

  overflow: hidden;         /* no scrollbars on the page wrapper */
  min-height: 0;            /* allow children to scroll */
  min-width: 0;             /* prevent horizontal overflow */
}


/* ---------------------------------------------------------
   2) Header area (natural height, full width, no X overflow)
   --------------------------------------------------------- */
.irrigation-recommendation-header {
  flex: 0 0 auto;
  width: 100%;

  min-height: 0;
  min-width: 0;
  
  overflow-x: hidden;       /* ensure header never causes X scroll */
}


/* ---------------------------------------------------------
   3) Scrollable body (ONLY scrolling region)
   - Takes remaining height under header
   - Scrolls vertically
   - Never scrolls horizontally
   --------------------------------------------------------- */
.irrigation-recommendation-plant-units-body {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  height: 69vh;

  display: block;                 /* ✅ important */
  overflow-y: auto !important;
  overflow-x: hidden !important;

  padding-top: 6px;
  padding-bottom: 24px;
  scroll-padding-bottom: 24px;
  overscroll-behavior: contain;
}


/* ---------------------------------------------------------
   4) Flex/overflow safety: allow any children to shrink
   (Prevents Plotly / long text from forcing extra width)
   --------------------------------------------------------- */
.irrigation-recommendation-page *,
.irrigation-recommendation-header *,
.irrigation-recommendation-plant-units-body * {
  min-width: 0;
  box-sizing: border-box;
}


/* ---------------------------------------------------------
   5) Plotly clamps (Plotly can sometimes overflow containers)
   --------------------------------------------------------- */
.irrigation-recommendation-page .js-plotly-plot,
.irrigation-recommendation-page .plot-container {
  max-width: 100%;
  overflow: hidden;
}


.irrigation-recommendation-plant-unit-card-header {
    /* padding: 8px 12px; */
    background-color: #689cbe;
    border-bottom: 1px solid #c4c8cc;
    font-size: 1.1rem;
    font-weight: 600;
    gap: 5px;
}

.irrigation-recommendation-day-card-header{
    /* padding: 8px 12px; */
    background-color: #a4bbdb;
    border-bottom: 1px solid #c4c8cc;
    font-size: 1.1rem;
    font-weight: 600;
    gap: 5px;
}






/* =========================================================
   6) PROFESSIONAL SUMMARY / OPERATIONS HEADER
   ========================================================= */
.irrigation-recommendation-header {
  padding-top: 4px;
  padding-bottom: 4px;
  background: linear-gradient(180deg, #f7faf8 0%, #eef4f0 100%);
  border-bottom: 1px solid var(--agro-border, #d0ddd5);
}

.ir-header-row {
  margin-left: -3px !important;
  margin-right: -3px !important;
}

.ir-header-col {
  padding-left: 3px !important;
  padding-right: 3px !important;
}

.ir-summary-card {
  border: 1px solid #d7e1da !important;
  border-radius: 9px !important;
  background: #ffffff;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(15, 43, 26, 0.07), 0 3px 10px rgba(15, 43, 26, 0.04);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.ir-summary-card:hover {
  border-color: #c3d3c8 !important;
  box-shadow: 0 3px 10px rgba(15, 43, 26, 0.10);
}

.ir-summary-card > .card-header {
  min-height: 31px;
  padding: 6px 9px;
  display: flex;
  align-items: center;
  background: linear-gradient(180deg, #f3f8f4 0%, #e9f2ec 100%);
  border-bottom: 1px solid #d7e1da;
  color: #234532;
}

.ir-header-title {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 0.79rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.01em;
}

.ir-header-title-icon {
  flex: 0 0 auto;
  color: #2d7a46;
  font-size: 0.82rem;
  opacity: 0.9;
}

/* Keep chart canvases visually integrated with the cards. */
.ir-summary-card .card-body {
  background: #ffffff;
}

.ir-summary-card .js-plotly-plot,
.ir-summary-card .plot-container,
.ir-summary-card .svg-container {
  border-radius: 0 0 8px 8px;
}

/* Info card */
.ir-info-card-body {
  padding: 7px 8px !important;
  overflow: hidden;
}

.ir-info-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.71rem;
  color: #33483c;
}

.ir-info-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  padding: 4px 5px;
  border: 1px solid #e1e9e4;
  border-radius: 6px;
  background: #f8fbf9;
}

.ir-info-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #60766a;
}

.ir-info-value {
  flex: 0 0 auto;
  font-weight: 700;
  color: #1f5c34;
}

.ir-info-section-title {
  margin-top: 2px;
  padding: 3px 2px 2px;
  color: #496458;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  border-bottom: 1px solid #e4ebe6;
}

.ir-info-pulse-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 1px 2px;
  color: #546c60;
  line-height: 1.2;
}

.ir-info-pulse-row strong {
  flex: 0 0 auto;
  color: #243d30;
  font-weight: 700;
}

/* Operations card */
.ir-operations-body {
  padding: 7px 8px !important;
  overflow: visible;
}

.ir-operations-stack {
  height: 100%;
  justify-content: space-between;
}

.ir-control-group {
  padding: 5px 6px;
  border: 1px solid #e0e8e3;
  border-radius: 7px;
  background: #fafcfb;
}

.ir-control-label {
  margin-bottom: 4px;
  color: #667b70;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.ir-square-action-btn {
  width: 32px !important;
  min-width: 32px !important;
  height: 31px !important;
  min-height: 31px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  border-radius: 6px !important;
  box-shadow: none !important;
}

.ir-square-action-btn i {
  font-size: 0.85rem;
}

.ir-program-dropdown .Select-control,
.ir-program-dropdown .select__control,
.ir-compact-select.form-select {
  min-height: 31px;
  height: 31px;
  border-color: #ccd8d0;
  border-radius: 6px;
  background: #ffffff;
  font-size: 0.73rem;
}

.ir-program-dropdown .Select-placeholder,
.ir-program-dropdown .Select-value-label,
.ir-program-dropdown .select__single-value,
.ir-program-dropdown .select__placeholder {
  font-size: 0.73rem;
}

.ir-compact-select.form-select {
  padding-top: 0.18rem;
  padding-bottom: 0.18rem;
  padding-left: 0.45rem;
  padding-right: 1.55rem;
}

.ir-compact-select.form-select:focus,
.ir-program-dropdown .Select-control:focus-within,
.ir-program-dropdown .select__control--is-focused {
  border-color: #7eaa8e !important;
  box-shadow: 0 0 0 2px rgba(45, 122, 70, 0.10) !important;
}

.ir-compact-select.form-select:disabled {
  color: #8a9990;
  background-color: #f0f3f1;
  border-color: #dde4df;
}

.ir-follower-checkbox {
  display: flex;
  align-items: center;
  min-height: 31px;
  padding: 0 3px;
  margin: 0 !important;
  white-space: nowrap;
  font-size: 0.72rem;
  color: #40584b;
}

.ir-follower-checkbox .form-check-input {
  position: static;
  float: none;
  margin: 0 0.35rem 0 0 !important;
  flex: 0 0 auto;
}

.ir-days-group {
  padding-bottom: 3px;
}

.ir-days-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1px;
}

.ir-days-value {
  min-width: 20px;
  padding: 2px 5px;
  border-radius: 999px;
  text-align: center;
  color: #ffffff;
  background: #2d7a46;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0;
}

.ir-days-slider {
  padding: 0 4px;
}

.ir-days-slider .rc-slider {
  margin-top: 1px;
}

.ir-days-slider .rc-slider-track {
  background-color: #52a86c;
}

.ir-days-slider .rc-slider-handle {
  border-color: #2d7a46;
}

.ir-days-slider .rc-slider-dot-active {
  border-color: #52a86c;
}

.ir-days-slider .rc-slider-mark-text {
  color: #6b7f74;
  font-size: 0.61rem;
}
