/*
 * Styles for the BCP Simulator Javascript application
 */

/**
  * Sticky top menu classes
  */  

.top-menu {
  position: sticky;
  top: 0;
  z-index: 1200;      /* on top of body */
  padding: 0 16px 0 16px;
  background-color: #282828;
  margin: 0;
  height:40px;
}

.widget-menu {
  position: sticky;
  top: 41px;
  z-index: 1300;      /* on top of top-menu */
  padding: 0;
  background-color: inherit;
  margin: 0;
}

.form-select-sm {
  padding-top: 0px;
  padding-bottom: 0px;
  font-size: 0.875rem;
  border-radius: 0.2rem;
}

/*
.simulation {
  display: block;
  width: 100%;
  margin: 0;
}
*/

/* este es el contenedor que scrollea */
.simulation-body {
  display: block;
  width: 100%;
  margin: 0;
  overflow-x: auto;   /* clave */
  overflow-y: auto;
  padding: 0 0 32px 0; /* some extra bottom space */
}

/* el contenido puede ser más ancho que la pantalla */
.simulation-body > .simulation-body-inner {
  width: max-content; /* o min-width: max-content */
}


/*
 * Group styles
 */

.group-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin: 0;
  padding: 0;
  background-color: rgba(0, 0, 0, var(--bg-alpha));

}

.group-col-darker {
  --bg-alpha: 0.06;
}

.group-block {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  height: auto;

  margin:0;
  padding: 8px 8px 8px 8px;

  background-color: rgba(0, 0, 0, var(--bg-alpha));

  /* 40px is enough to avoid the pushing effect on height of inputs/selects inside the block increasing its height */
  height: 40px;
  overflow: hidden;
}

.h-auto {
  height: auto !important;
  overflow: visible !important;
}

.group-block-darker {
  --bg-alpha: 0.05;
}

.group-title {
  display: block;
  box-sizing: border-box;   /* height includes border and padding */
  width: 100%;
  margin: 0;
  padding: 0;

  text-align: center;
  font-size: 1.15em;
  font-family: HeadingFont;

  /* ellipsis if text is too long */
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;

  border-bottom: 1px solid rgba(0, 0, 0, 0.25);
}


.src {
  display: none;
  background-color: transparent;
  padding: 3px 2px 0px 0px;
  text-align: right;
  color: #999;
}

.cell,
.sep-cell,
.mid-cell,
.large-cell,
.extra-large-cell {
  padding: 0 8px 0 8px;
  margin: 0;
  box-sizing: border-box;
  white-space: nowrap;
}

.cell {
  width: 100px;
  max-width: 100px;
  min-width: 100px;
}

.sep-cell {
  width: 32px;
  max-width: 32px;
  min-width: 32px;
}

.mid-cell {
  width: 124px;
  max-width: 124px;
  min-width: 124px;
}

.large-cell {
  width: 152px;
  max-width: 152px;
  min-width: 152px;
}

.extra-large-cell {
  width: 360px;
  max-width: 360px;
  min-width: 360px;
  
  /* ellipsis if text is too long */
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.cell input {
  max-width: 85px;
  text-align: right;
  border: 1px solid #037380;
  border-radius: 0.15em;

  /* to avoid increasing the height of the group-block when inputs get focused */
  margin: 0;

  /* to vertically center the text inside the input and make all inputs have the same height */
  height: 20px;
  max-height: 20px;
  line-height: 20px;
  padding: 0 6px;
  box-sizing: border-box;
}


input:disabled {
  border-color: #b4eaed;
  background-color: #ebf8fa; /* opaco */
}

/**
  * FamilyWidget styles
  */  



.family-header {
  width: max-content;
  overflow: visible;
  display: block;
  margin: 40px 0 0 0; /* space for the sticky anchor */;
  position: relative;
  z-index: 1;
}

.family-anchor {
  position: sticky;
  left: 0;
  z-index: 90;

  display: flex;
  align-items: center;
  gap: 8px;

  width: 512px;              /* 152 + 360 */
  margin: 0;
  padding: 0 8px 6px 16px; 
  background-color: #ebf8fa; /* opaco */
}

.family-bar {
  display: flex;
  flex-direction: row;
  align-items: flex-start;

  margin: 0;
  padding: 0;
  width: auto;

  /* force product width to be larger than the browser visual width */
  width: max-content;

  /* prevent selection of text inside the product to make double clicks work fine */
  user-select: none;
  -webkit-user-select: none;
  /* safari */

  background-color: #b4eaed;
  color: #282828;
}

/* family header: the first group-col is the PRODUCTO header (código/nombre) */
.family-bar > .group-col:first-child {
  position: sticky;
  left: 0;
  z-index: 30;                 /* above the rest of the family-bar */
  border-right: 1px solid rgba(0, 0, 0, 0.25);
  background-color: #b4eaed;
  margin: 0;
}

/**
  * ProductWidget styles
  */  

.product-bar {
  display: flex;
  flex-direction: row;
  align-items: flex-start;

  padding: 0;
  margin: 0;
  width: auto;

  /* force product width to be larger than the browser visual width */
  width: max-content;

  /* prevent selection of text inside the product to make double clicks work fine */
  user-select: none;
  -webkit-user-select: none;
}

.product-bar:has(input:focus) {
  background-color: #ffff66;
}

/* product rows: the first group-block is the PRODUCTO block (código/nombre) */
.product-bar > .group-block:first-child {
  position: sticky;
  left: 0;
  z-index: 30;  /* above the rest of the product row */
  border-right: 1px solid rgba(0, 0, 0, 0.20);
  background-color: #ebf8fa;
  margin: 0;
}

/* optional: avoid weird overlaps when inputs/selects get focused */
.product-bar > .group-block:first-child,
.family-bar  > .group-col:first-child {
  isolation: isolate;
}

.exception-ink {
  color: blue;
}