/* Sticky header for purchase recommendation lines tree view */
/* Make the tree container scrollable so position:sticky works inside */
.o_purchase_recommendation_tree.o_list_view, /* defensive if Odoo adds class */
.o_purchase_recommendation_tree { 
  max-height: 85vh; /* adjustable */
  overflow-y: auto;
  position: relative;
}

/* Target Odoo list table header cells */
.o_purchase_recommendation_tree table thead th,
.o_purchase_recommendation_tree .o_list_table thead th,
.o_purchase_recommendation_tree table thead th > div,
.o_purchase_recommendation_tree .o_list_table thead th > div {
  position: sticky !important;
  top: 0 !important;
  z-index: 7 !important; /* above possible indicators */
  background: var(--o-view-background-color, #f8f9fa) !important;
  line-height: 1.2rem;
  box-sizing: border-box;
}

/* Extra background for nested inner elements */
.o_purchase_recommendation_tree table thead th > div { 
  background: inherit;
}

/* Subtle bottom border / shadow */
.o_purchase_recommendation_tree table thead th::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: rgba(0,0,0,0.15);
  pointer-events: none;
}

/* Prevent collapse issues that sometimes break sticky in Firefox */
.o_purchase_recommendation_tree table { 
  border-collapse: separate !important;
  border-spacing: 0;
  width: 100%;
}

/* Row separators (avoid double borders) */
.o_purchase_recommendation_tree table tbody tr { 
  border-bottom: 1px solid #8f8d8d;
}
// .o_purchase_recommendation_tree table tbody tr:last-child { 
//   border-bottom: 0;
// }
// /* Remove previous cell-level borders */
// .o_purchase_recommendation_tree table td, 
// .o_purchase_recommendation_tree table th { 
//   border-bottom: none;
// }

/* Zebra striping: only apply to rows without state-driven bg (avoid overriding decoration-* classes) */
.o_purchase_recommendation_tree table tbody tr:nth-child(odd):not([class*='o_data_row_selected']):not(.o_list_view_group_header) td {
  background-color: #ebe6e6;
  border-bottom: 1px solid #8f8d8d;
}
.o_purchase_recommendation_tree table tbody tr:nth-child(even):not([class*='o_data_row_selected']):not(.o_list_view_group_header) td {
  background-color: #ffffff;
  border-bottom: 1px solid #8f8d8d;
}

/* Keep Odoo decoration colors dominant (info/success/danger/muted) */
.o_purchase_recommendation_tree table tbody tr[decoration-info] td,
.o_purchase_recommendation_tree table tbody tr[decoration-success] td,
.o_purchase_recommendation_tree table tbody tr[decoration-danger] td,
.o_purchase_recommendation_tree table tbody tr[decoration-muted] td {
  background-color: inherit;
}

/* Hover highlight (soft) */
.o_purchase_recommendation_tree table tbody tr:hover td { 
  background-color: #eef6ff;
}
.o_purchase_recommendation_tree table tbody tr.o_data_row_selected td { 
  background-color: #d9ecff !important;
}

/* Stronger text color for better contrast over zebra backgrounds */
/* Force stronger text color (override potential nested span styles) */
.o_purchase_recommendation_tree table tbody tr td,
.o_purchase_recommendation_tree table tbody tr td span,
.o_purchase_recommendation_tree table tbody tr td div {
  color: #1b1b1b !important;
}

/* Optional: indicate scroll with gradient at top when not at start */
.o_purchase_recommendation_tree.is-scrolled::before { 
  content: '';
  position: sticky;
  top: 0;
  height: 0.35rem;
  display: block;
  background: linear-gradient(var(--o-view-background-color, #f8f9fa), rgba(248,249,250,0));
  z-index: 6;
  pointer-events: none;
}
