/*
 * Dialog positioning for the application-shell mobile drawer.
 * Feature screens use Tailwind utilities.
 *

 */

dialog.mobile-sidebar {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  border: none;
  background: transparent;
}

dialog.mobile-sidebar[open] {
  display: flex;
}

dialog.mobile-sidebar::backdrop {
  background-color: rgb(17 24 39 / 0.8);
}

dialog[data-confirm-target="dialog"] {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  border: none;
}

dialog.ui-drawer {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  border: none;
  background: transparent;
}

dialog.ui-drawer:not([open]) {
  display: none !important;
  pointer-events: none;
}

dialog.ui-drawer:not([open]) * {
  pointer-events: none;
}

dialog.ui-drawer[open] {
  display: block;
}

dialog.ui-drawer::backdrop {
  background-color: rgb(17 24 39 / 0.5);
}

.ui-drawer-panel {
  transform: translateX(100%);
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

dialog.ui-drawer.ui-drawer--visible .ui-drawer-panel {
  transform: translateX(0);
}

dialog.ui-drawer.ui-drawer--closing .ui-drawer-panel {
  transform: translateX(100%);
}

/* Formula version Components tab — scaled batch input highlight */
td.batch-scale-highlight,
th.batch-scale-column-active {
  background-color: rgb(238 242 255); /* indigo-50 */
  color: rgb(55 48 163); /* indigo-800 */
  font-weight: 600;
}

tr.batch-scale-active td.batch-scale-highlight {
  box-shadow: inset 0 0 0 1px rgb(165 180 252); /* indigo-300 */
}

@media (prefers-color-scheme: dark) {
  td.batch-scale-highlight,
  th.batch-scale-column-active {
    background-color: rgb(99 102 241 / 0.15);
    color: rgb(199 210 254); /* indigo-200 */
  }

  tr.batch-scale-active td.batch-scale-highlight {
    box-shadow: inset 0 0 0 1px rgb(129 140 248 / 0.5);
  }
}

/* Workbench BOM: hide number spinners; mark incomplete rows in amber. */
.workbench-proportion {
  -moz-appearance: textfield;
  appearance: textfield;
}

.workbench-proportion::-webkit-outer-spin-button,
.workbench-proportion::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

tr.workbench-row-incomplete > td {
  border-color: rgb(245 158 11); /* amber-500 */
  background-color: rgb(255 251 235 / 0.55); /* amber-50 */
}

@media (prefers-color-scheme: dark) {
  tr.workbench-row-incomplete > td {
    border-color: rgb(245 158 11 / 0.7);
    background-color: rgb(245 158 11 / 0.08);
  }
}

/* Soft cell focus highlight for the active BOM field */
#workbench-bom td.workbench-cell:focus-within {
  background-color: rgb(238 242 255); /* indigo-50 */
  box-shadow: inset 0 0 0 1px rgb(165 180 252); /* indigo-300 */
}

#workbench-bom td.workbench-cell:focus-within .workbench-cell-field {
  background-color: transparent;
}

@media (prefers-color-scheme: dark) {
  #workbench-bom td.workbench-cell:focus-within {
    background-color: rgb(99 102 241 / 0.16);
    box-shadow: inset 0 0 0 1px rgb(129 140 248 / 0.55);
  }
}

/* Collapsed live-summary rail: shrink the aside column itself (not only hide
   content). !important beats Tailwind lg:grid-cols-[…] on #workbench-main.
   3.25rem leaves modest padding on both sides of the size-7 toggle. */
@media (min-width: 64rem) {
  #workbench-main.workbench-aside-collapsed {
    grid-template-columns: minmax(0, 1fr) 3.25rem !important;
  }

  #workbench-main.workbench-aside-collapsed > aside {
    min-width: 0;
    width: 3.25rem;
    max-width: 3.25rem;
  }

  #workbench-main.workbench-aside-collapsed #workbench-outcomes > .workbench-aside-header {
    justify-content: center;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
}

#workbench-main.workbench-aside-collapsed .workbench-aside-body {
  display: none;
}

#workbench-main.workbench-aside-collapsed .workbench-aside-expand {
  display: inline-flex;
}

#workbench-main.workbench-aside-collapsed .workbench-aside-collapse {
  display: none;
}

#workbench-main:not(.workbench-aside-collapsed) .workbench-aside-expand {
  display: none;
}

#workbench-main:not(.workbench-aside-collapsed) .workbench-aside-collapse {
  display: inline-flex;
}

/* Native kind <select> popup: force readable dark-theme option colours.
   Tailwind classes on <select> do not style <option> in most browsers. */
#workbench-bom select.workbench-kind {
  color-scheme: light dark;
}

#workbench-bom select.workbench-kind option {
  background-color: #fff;
  color: #111827; /* gray-900 */
}

@media (prefers-color-scheme: dark) {
  #workbench-bom select.workbench-kind,
  #workbench-bom select.workbench-kind option {
    background-color: #1f2937; /* gray-800 */
    color: #d1d5db; /* gray-300 — lighter than heading white */
  }
}

/* Native checkboxes styled like Tailwind UI / Catalyst (appearance-none + fill). */
input[type="checkbox"].ui-cb {
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

input[type="checkbox"].ui-cb:checked,
input[type="checkbox"].ui-cb:indeterminate {
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 14 14' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 8L5.5 10.5L11 3.5' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

input[type="checkbox"].ui-cb:indeterminate {
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 14 14' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 7h8' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}
