/* Store pages (/Stores/{id}/...): the header, Overview, items and inventory forms, devices, options, shifts. */

/* Received / Counted / Lost / Damaged as one row of equal buttons */
.reason-choice .btn {
  flex: 1 1 0;
  padding-inline: .25rem;
}

/* Refunds: each item with a stepper (or a box, by weight) for how much comes back */
.refund-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

.refund-line-chosen {
  background: var(--bs-tertiary-bg);
}

.refund-line .min-w-0 {
  min-width: 0;
}

.refund-stepper {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: .25rem;
}

.refund-stepper .btn {
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
}

.refund-stepper .form-control {
  width: 3.25rem;
  height: 2.75rem;
  padding-inline: .25rem;
  -moz-appearance: textfield;
}

.refund-stepper .form-control::-webkit-outer-spin-button,
.refund-stepper .form-control::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.refund-weight {
  flex: 0 0 auto;
  width: 9.5rem;
}

/* Item form (Store > Items): its sections, the inventory it uses and the "More options" fold */
.item-form-section + .item-form-section {
  margin-top: 1.5rem;
}

.item-form-heading {
  margin-bottom: .75rem;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--bs-secondary-color);
}

/* What the item uses from inventory, set apart from the fields every item has */
.item-stock-panel {
  padding: 1rem;
  border-radius: .75rem;
  background-color: var(--bs-tertiary-bg);
}

/* One row per stock item the item uses. Phones leave out each row's cost; the item's total cost shows above. */
.item-component {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 9.5rem 4rem auto;
  align-items: center;
  gap: .5rem;
}

.item-component-name {
  font-size: .875rem;
  font-weight: 500;
}

/* A new one's unit (pcs, kg...) is picked in its row, beside the amount */
.input-group > .item-component-unit {
  flex: 0 0 4.75rem;
  width: 4.75rem;
  padding-right: 1.5rem;
  background-position: right .35rem center;
}

/* What the ingredient box finds, in the flow of the dialog so a scrolling dialog doesn't cut it off */
.ingredient-list {
  margin-top: .25rem;
  max-height: 16rem;
  overflow-y: auto;
  font-size: .875rem;
}

.ingredient-list .list-group-item {
  padding: .5rem .75rem;
}

.ingredient-list .list-group-item.active .text-body-secondary {
  color: inherit !important;
}

.item-component-cost {
  text-align: end;
}

/* "for every [5] sold" under a row's amount, for inventory one unit of which is enough for several sold */
.item-component-every {
  grid-column: 2 / -1;
  display: flex;
  align-items: center;
  gap: .375rem;
  font-size: .875rem;
  color: var(--bs-secondary-color);
}

.item-component-every .form-control {
  width: 4.5rem;
}

@media (max-width: 575.98px) {
  .item-component {
    grid-template-columns: minmax(0, 1fr) 9.5rem auto;
  }

  .item-component-cost {
    display: none;
  }

  .item-component-every {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}

/* Stock entered as "[3] tray + [4] pcs": whole packs and the units left over */
.pack-qty {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.pack-qty > .input-group {
  flex: 1 1 0;
  min-width: 0;
}

.pack-qty-plus {
  color: var(--bs-secondary-color);
}

/* The price paid for stock received */
.adjust-price-input {
  max-width: 18rem;
}

.adjust-price-indented {
  margin-top: .5rem;
  margin-left: 1.5rem;
}

.item-more {
  padding-top: 1rem;
  border-top: 1px solid var(--bs-border-color);
}

.item-more-toggle {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: start;
}

.item-more-toggle:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.item-more-chevron {
  transition: transform .15s ease;
}

.item-more-toggle:not(.collapsed) .item-more-chevron {
  transform: rotate(90deg);
}

/* The invoice editor: its lines, and the total with Save and Issue always in reach at the bottom */
.invoice-edit-lines > li {
  padding: .75rem 0;
  border-top: 1px solid var(--bs-border-color);
}

.invoice-edit-lines > li.invoice-edit-line-gone {
  border-left: 3px solid var(--bs-danger);
  padding-left: .75rem;
}

.invoice-edit-qty {
  width: 6.5rem;
}

.invoice-edit-price {
  width: 9rem;
}

.invoice-edit-footer {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin: 0 -.25rem;
  padding: .75rem 1rem;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius-lg);
  background: var(--bs-body-bg);
  box-shadow: 0 -4px 16px rgba(17, 24, 39, .08);
}

.invoice-edit-footer .btn,
#pay-modal .modal-footer .btn,
#issue-modal .modal-footer .btn {
  min-height: 2.75rem;
}

/* Item and inventory lists: a row opens when clicked; the chevron at its end says so */
.item-row-editable {
  cursor: pointer;
}

.row-open {
  padding: .25rem .5rem;
}

.item-cell {
  min-width: 11rem;
}

/* Store workspace: menu board */
.menu-board-section + .menu-board-section {
  margin-top: 1.5rem;
}

/* Overview's item board folds away: the whole header opens it, and the chevron turns. */
.menu-details > summary {
  cursor: pointer;
  list-style: none;
}

.menu-details > summary::-webkit-details-marker {
  display: none;
}

.menu-details > summary:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: -3px;
  border-radius: .75rem;
}

.menu-details-chevron {
  transition: transform .15s ease;
  color: var(--bs-secondary-color);
}

.menu-details[open] .menu-details-chevron {
  transform: rotate(90deg);
}

@media (prefers-reduced-motion: reduce) {
  .menu-details-chevron {
    transition: none;
  }
}

.menu-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .75rem;
}

.menu-tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: .5rem;
  min-height: 88px;
  padding: .75rem;
  border-radius: .6rem;
  border-left: 4px solid var(--category-color, #9ca3af);
  background-color: var(--bs-tertiary-bg);
}

/* Long names wrap inside the tile instead of running past its edge */
.menu-tile-name {
  min-width: 0;
  overflow-wrap: break-word;
}

.menu-tile-out {
  opacity: .6;
}

.store-card-link {
  color: inherit;
  text-decoration: none;
}

/* "My stores" card: how many devices and people the store has, each a tile that opens the page managing them. The strip sits
   between the details and the footer, so the rows line up across cards. Tiles are 44px tall or more. */
.store-stats {
  display: flex;
  border-top: 1px solid var(--bs-border-color-translucent);
}

.store-stat {
  display: flex;
  flex: 1 1 0;
  align-items: center;
  gap: .65rem;
  min-width: 0;
  min-height: 3.25rem;
  padding: .5rem .85rem;
  color: var(--bs-body-color);
  text-decoration: none;
  transition: background-color .12s ease;
}

.store-stat + .store-stat {
  border-left: 1px solid var(--bs-border-color-translucent);
}

.store-stat:hover {
  background-color: var(--bs-tertiary-bg);
  color: var(--bs-body-color);
}

.store-stat:active {
  background-color: var(--bs-secondary-bg);
}

.store-stat:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: -3px;
}

.store-stat-icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background-color: var(--console-accent-soft);
  color: var(--console-accent-text);
  font-size: 1rem;
}

.store-stat-text {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.2;
}

.store-stat-count {
  font-size: 1.125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.store-stat-label {
  font-size: .875rem;
}

/* "of 3" next to the count: the same size as the label, so the number stays the one thing that stands out */
.store-stat-of {
  font-size: .875rem;
  color: var(--bs-secondary-color);
}

/* None yet: a quieter number, so a store that has nothing connected reads as waiting rather than as a count */
.store-stat-zero {
  color: var(--bs-secondary-color);
}

/* A second, quieter line under the count (the business's manager seats); wraps rather than being cut */
.store-stat-sub {
  display: block;
  text-wrap: balance;
  margin-top: .1rem;
  font-size: .75rem;
  color: var(--bs-secondary-color);
}

/* At the plan's limit: words, in the warning-text colour that passes contrast in both themes */
.store-stat-note {
  display: block;
  text-wrap: balance;
  margin-top: .1rem;
  font-size: .75rem;
  font-weight: 600;
  color: var(--warn-text);
}

.store-stat-go {
  flex-shrink: 0;
  font-size: .75rem;
  color: var(--bs-secondary-color);
}

@media (prefers-reduced-motion: reduce) {
  .store-stat {
    transition: none;
  }
}

/* Two tiles are tight on a narrow card: less padding, but the arrows stay, since they're what says "this opens something" */
@media (max-width: 399.98px) {
  .store-stat {
    padding-inline: .6rem;
    gap: .5rem;
  }
}

/* A page that isn't Overview gets a slim header: a smaller logo and title, without the type and address lines. */
.store-header-compact .store-header-logo {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: .6rem;
}

.store-header-compact .store-header-name {
  font-size: 1.375rem;
}

.store-header-compact .store-header-kind,
.store-header-compact .store-header-address {
  display: none;
}

@media (max-width: 575.98px) {
  .store-header-logo {
    width: 2.75rem;
    height: 2.75rem;
  }

  .store-header-name {
    font-size: 1.25rem;
  }

  .store-header-actions {
    width: 100%;
  }

  /* The store system button takes the row; the "more" menu beside it keeps its own size. */
  .store-header-actions > .btn {
    flex: 1 1 0;
    padding: .375rem .5rem;
    font-size: .9rem;
    white-space: nowrap;
  }
}

/* Store > Receipts on a phone: what was bought, cut to two lines */
.receipt-items-short {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ...which takes the room the hidden columns leave, so it isn't squeezed into a few words a line */
@media (max-width: 767.98px) {
  .receipt-when {
    width: 100%;
  }
}

/* Inventory */
.stock-change-up { color: var(--bs-success-text-emphasis); }
.stock-change-down { color: var(--bs-danger-text-emphasis); }

/* A device pairing code (Store > Settings): big enough to read out across the counter, with its QR code. */
.pairing-code {
  font: 700 2rem/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .12em;
}

.pairing-qr {
  width: min(11rem, 60vw);
  margin: 0 auto;
  padding: .5rem;
  border-radius: .75rem;
  background-color: #fff;
}

.pairing-qr svg {
  display: block;
  width: 100%;
  height: auto;
}

.pairing-done-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background-color: rgba(var(--bs-success-rgb), .15);
  color: var(--bs-success);
  font-size: 1.25rem;
  font-weight: 700;
}

/* Store > Devices: each device with a phone-shaped icon, and the numbered steps to connect one. */
.device-icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: .5rem;
  background-color: rgba(var(--bs-primary-rgb), .1);
  color: var(--bs-primary);
}

.device-icon .icon {
  --icon-size: 1.25rem;
}

.device-icon-lg {
  display: flex;
  width: 3.25rem;
  height: 3.25rem;
}

.device-steps {
  padding-left: 1.25rem;
}

.device-steps li + li {
  margin-top: .75rem;
}

/* A new store's "Getting started" steps (store Overview): a number, or a green tick once done */
.getting-started-step {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.getting-started-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 50%;
  font-size: .8125rem;
  font-weight: 700;
  color: var(--bs-secondary-color);
}

.getting-started-step.is-done .getting-started-mark {
  border-color: transparent;
  background-color: rgba(var(--bs-success-rgb), .15);
  color: var(--bs-success);
}

.getting-started-step.is-done .fw-semibold {
  color: var(--bs-secondary-color);
}

/* Items > Import: each row's line number in a narrow column of its own. */
.import-line {
  flex: 0 0 3.75rem;
  white-space: nowrap;
}

#import-rows .min-w-0 {
  min-width: 0;
}

/* Focus moves here when the preview opens, for screen readers; it is not something to click. */
#import-summary:focus {
  outline: none;
}

/* ---------------- Store > Options: one row per option, its name and what it adds ---------------- */

.option-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 9.5rem auto;
  gap: .5rem;
  align-items: center;
}

.option-row-remove {
  min-width: 44px;
  min-height: 44px;
}

@media (max-width: 400px) {
  .option-row {
    grid-template-columns: minmax(0, 1fr) 7.5rem auto;
  }
}

.option-set-summary {
  overflow-wrap: anywhere;
}
