/* ========================================
   CASH REGISTER
======================================== */


/* ----------------------------------------
   Layout
---------------------------------------- */

.pos-page {
  min-height: 100vh;
}

.pos-layout {
  display: grid;
  grid-template-columns:
    minmax(0, 1fr)
    var(--cash-register-sidebar-width);

  min-height: 100vh;
}

.pos-main {
  min-width: 0;

  padding:
    var(--space-8)
    36px
    60px;
}


/* ----------------------------------------
   Header
---------------------------------------- */

.pos-header {
  margin-bottom: 34px;
}

.pos-back-link {
  display: inline-flex;

  margin-bottom: 22px;

  color: var(--color-text-muted);

  font-size: 14px;
  font-weight: 600;

  text-decoration: none;

  transition:
    color var(--transition-fast);
}

.pos-back-link:hover {
  color: var(--color-text);
}

.pos-header-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;

  gap: var(--space-6);
}

.pos-eyebrow {
  display: block;

  margin-bottom: 5px;

  color: var(--color-text-muted);

  font-size: 12px;
  font-weight: 700;

  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pos-header h1 {
  margin: 0;

  font-size: clamp(28px, 3vw, 42px);

  line-height: 1.1;
  letter-spacing: -0.04em;
}

.pos-header p {
  margin:
    var(--space-2)
    0
    0;

  color: var(--color-text-muted);
}

.pos-status {
  display: inline-flex;
  align-items: center;

  gap: var(--space-2);

  padding:
    9px
    13px;

  background: var(--color-success-light);
  color: var(--color-success);

  border-radius: var(--radius-pill);

  font-size: 13px;
  font-weight: 700;

  white-space: nowrap;
}

.pos-status-dot {
  width: 8px;
  height: 8px;

  background: var(--color-success);

  border-radius: 50%;
}


/* ----------------------------------------
   Alert
---------------------------------------- */

.pos-alert {
  display: flex;
  flex-direction: column;

  gap: var(--space-1);

  margin-bottom: var(--space-6);

  padding:
    var(--space-4)
    18px;

  background: var(--color-danger-light);

  border:
    1px
    solid
    var(--color-danger-border);

  border-radius: var(--radius-sm);

  color: var(--color-danger);
}


/* ----------------------------------------
   Payment success
---------------------------------------- */

.pos-payment-success {
  display: flex;
  align-items: center;

  gap: var(--space-3);

  margin-bottom: var(--space-6);

  padding:
    14px
    16px;

  background: var(--color-success-light);

  border:
    1px
    solid
    rgba(22, 130, 93, 0.18);

  border-radius: var(--radius-md);

  color: var(--color-success);
}

.pos-payment-success-icon {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 34px;
  height: 34px;

  flex-shrink: 0;

  background: var(--color-success);
  color: #ffffff;

  border-radius: 50%;

  font-size: 17px;
  font-weight: 800;
}

.pos-payment-success-content {
  display: flex;
  flex: 1;
  flex-direction: column;

  gap: 2px;

  min-width: 0;
}

.pos-payment-success-content strong {
  color: var(--color-text);

  font-size: 14px;
}

.pos-payment-success-content span {
  font-size: 12px;
  font-weight: 600;
}

.pos-payment-success-link {
  color: var(--color-success);

  font-size: 13px;
  font-weight: 700;

  text-decoration: none;
}

.pos-payment-success-link:hover {
  text-decoration: underline;
}


/* ----------------------------------------
   Section heading
---------------------------------------- */

.pos-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;

  gap: var(--space-5);

  margin-bottom: var(--space-5);
}

.pos-section-heading h2 {
  margin: 0;

  font-size: 22px;
  letter-spacing: -0.02em;
}

.pos-section-heading p {
  margin:
    6px
    0
    0;

  color: var(--color-text-muted);

  font-size: 14px;
}

.pos-product-count {
  color: var(--color-text-muted);

  font-size: 13px;
  font-weight: 600;

  white-space: nowrap;
}


/* ----------------------------------------
   Product grid
---------------------------------------- */

.pos-products-grid {
  display: grid;

  grid-template-columns:
    repeat(
      auto-fill,
      minmax(190px, 1fr)
    );

  gap: 14px;
}


/* ----------------------------------------
   Product card
---------------------------------------- */

.pos-product-card {
  position: relative;

  min-height: 155px;

  background: var(--color-surface);

  border:
    2px
    solid
    transparent;

  border-radius: var(--radius-lg);

  box-shadow: var(--shadow-card);

  overflow: visible;

  transition:
    transform var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.pos-product-card:hover {
  transform: translateY(-2px);
}

.pos-product-card.is-selected {
  border-color: var(--color-primary);
}

.pos-product-button {
  width: 100%;
  height: 100%;

  min-height: 155px;

  display: flex;
  flex-direction: column;
  align-items: flex-start;

  padding: var(--space-5);

  background: transparent;

  border: 0;

  color: inherit;

  font: inherit;
  text-align: left;

  cursor: pointer;
}

.pos-product-button:focus-visible {
  outline:
    3px
    solid
    rgba(23, 32, 42, 0.2);

  outline-offset: 3px;

  border-radius: var(--radius-lg);
}

.pos-product-name {
  display: block;

  padding-right: 35px;

  font-size: 17px;
  font-weight: 750;

  line-height: 1.25;
}

.pos-product-price {
  display: block;

  margin-top: 7px;

  color: var(--color-text-muted);

  font-size: 15px;
  font-weight: 600;
}

.pos-product-add {
  width: 100%;

  display: flex;
  align-items: center;
  justify-content: space-between;

  margin-top: auto;
  padding-top: var(--space-6);

  color: var(--color-text-muted);

  font-size: 13px;
  font-weight: 700;
}

.pos-product-add span {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 30px;
  height: 30px;

  background: var(--color-primary);
  color: #ffffff;

  border-radius: var(--radius-xs);

  font-size: 20px;
  font-weight: 400;
}

.pos-product-quantity {
  position: absolute;

  top: -8px;
  right: -8px;

  display: none;
  align-items: center;
  justify-content: center;

  min-width: 30px;
  height: 30px;

  padding:
    0
    var(--space-2);

  background: var(--color-primary);
  color: #ffffff;

  border:
    3px
    solid
    var(--color-background);

  border-radius: var(--radius-pill);

  font-size: 13px;
  font-weight: 800;

  z-index: 2;
}

.pos-product-quantity.is-visible {
  display: flex;
}

.pos-hidden-quantity {
  position: absolute;

  width: 1px;
  height: 1px;

  opacity: 0;

  pointer-events: none;
}


/* ----------------------------------------
   Cart
---------------------------------------- */

.pos-cart {
  position: sticky;
  top: 0;

  display: flex;
  flex-direction: column;

  height: 100vh;

  padding:
    30px
    26px;

  background: var(--color-surface);

  border-left:
    1px
    solid
    var(--color-border);
}

.pos-cart-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;

  gap: var(--space-4);

  padding-bottom: 22px;

  border-bottom:
    1px
    solid
    var(--color-border);
}

.pos-cart-header h2 {
  margin: 0;

  font-size: 27px;
  letter-spacing: -0.03em;
}

.pos-cart-header-actions {
  display: flex;
  align-items: center;

  gap: var(--space-3);
}

.pos-cart-count {
  color: var(--color-text-muted);

  font-size: 13px;
  font-weight: 600;

  white-space: nowrap;
}

.pos-clear-button {
  padding:
    7px
    10px;

  background: transparent;

  color: var(--color-text-muted);

  border:
    1px
    solid
    var(--color-border);

  border-radius: var(--radius-xs);

  font-size: 12px;
  font-weight: 700;

  cursor: pointer;

  transition:
    color var(--transition-fast),
    border-color var(--transition-fast),
    background var(--transition-fast);
}

.pos-clear-button:hover {
  background: var(--color-surface-secondary);

  color: var(--color-text);

  border-color: #c5cad0;
}


/* ----------------------------------------
   Empty cart
---------------------------------------- */

.pos-cart-empty {
  flex: 1;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  padding: 30px;

  color: var(--color-text-muted);

  text-align: center;
}

.pos-cart-empty.is-hidden {
  display: none;
}

.pos-cart-empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 58px;
  height: 58px;

  margin-bottom: var(--space-4);

  background:
    var(--color-surface-secondary);

  border-radius: 50%;

  font-size: 25px;
}

.pos-cart-empty strong {
  color: var(--color-text);

  font-size: 16px;
}

.pos-cart-empty p {
  max-width: 220px;

  margin:
    7px
    0
    0;

  font-size: 13px;
  line-height: 1.5;
}


/* ----------------------------------------
   Cart lines
---------------------------------------- */

.pos-cart-lines {
  flex: 1;

  overflow-y: auto;

  padding:
    var(--space-2)
    2px
    var(--space-5);
}

.pos-cart-line {
  padding:
    18px
    0;

  border-bottom:
    1px
    solid
    var(--color-border);
}

.pos-cart-line.is-hidden {
  display: none;
}

.pos-cart-line-main {
  display: flex;
  justify-content: space-between;

  gap: 15px;
}

.pos-cart-product {
  display: flex;
  flex-direction: column;

  gap: 3px;

  min-width: 0;
}

.pos-cart-product strong {
  font-size: 15px;
}

.pos-cart-product span {
  color: var(--color-text-muted);

  font-size: 12px;
}

.pos-cart-line-total {
  flex-shrink: 0;

  font-size: 15px;

  white-space: nowrap;
}


/* ----------------------------------------
   Quantity controls
---------------------------------------- */

.pos-quantity-control {
  display: inline-grid;

  grid-template-columns:
    36px
    42px
    36px;

  align-items: center;

  margin-top: 14px;

  background:
    var(--color-surface-secondary);

  border-radius: 9px;
}

.pos-quantity-button {
  width: 36px;
  height: 36px;

  background: transparent;

  border: 0;

  color: var(--color-text);

  font-size: 20px;

  cursor: pointer;

  transition:
    background var(--transition-fast),
    transform var(--transition-fast);
}

.pos-quantity-button:hover {
  background: #e9ecef;

  border-radius: var(--radius-xs);
}

.pos-quantity-button:active {
  transform: scale(0.96);
}

.pos-quantity-value {
  text-align: center;

  font-size: 14px;
  font-weight: 800;
}


/* ----------------------------------------
   Checkout
---------------------------------------- */

.pos-cart-footer {
  padding-top: var(--space-5);

  border-top:
    1px
    solid
    var(--color-border);
}

.pos-total {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;

  gap: var(--space-5);

  margin-bottom: var(--space-6);
}

.pos-total span {
  color: var(--color-text-muted);

  font-size: 14px;
  font-weight: 600;
}

.pos-total strong {
  font-size: 30px;

  line-height: 1;

  letter-spacing: -0.04em;

  white-space: nowrap;
}

.pos-payment-title {
  margin-bottom: 10px;

  font-size: 13px;
  font-weight: 700;
}

.pos-payment-buttons {
  display: grid;

  gap: 10px;
}

.pos-payment-button {
  display: flex;
  align-items: center;

  gap: 13px;

  width: 100%;

  padding: 14px;

  background: var(--color-surface);
  color: var(--color-text);

  border:
    1px
    solid
    var(--color-border);

  border-radius: var(--radius-md);

  text-align: left;
  font: inherit;

  cursor: pointer;

  transition:
    border-color var(--transition-fast),
    transform var(--transition-fast),
    background var(--transition-fast),
    opacity var(--transition-fast);
}

.pos-payment-button:hover:not(:disabled) {
  border-color: #aeb5bd;

  transform: translateY(-1px);
}

.pos-payment-button:active:not(:disabled) {
  transform: translateY(0);
}

.pos-payment-button:disabled {
  opacity: 0.35;

  cursor: not-allowed;
}

.pos-payment-card:not(:disabled) {
  background: var(--color-primary);

  border-color: var(--color-primary);

  color: #ffffff;
}

.pos-payment-icon {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 42px;
  height: 42px;

  flex-shrink: 0;

  background:
    var(--color-surface-secondary);

  color: var(--color-text);

  border-radius: 9px;

  font-size: 13px;
  font-weight: 800;
}

.pos-payment-button > span:last-child {
  display: flex;
  flex-direction: column;

  gap: 2px;
}

.pos-payment-button strong {
  font-size: 14px;
}

.pos-payment-button small {
  opacity: 0.7;

  font-size: 11px;
}

.pos-payment-help {
  margin:
    11px
    var(--space-1)
    0;

  color: var(--color-text-muted);

  font-size: 11px;
  line-height: 1.4;
}


/* ----------------------------------------
   No products state
---------------------------------------- */

.pos-empty-products {
  max-width: 500px;

  padding: 50px;

  background: var(--color-surface);

  border-radius: var(--radius-lg);

  box-shadow: var(--shadow-card);

  text-align: center;
}

.pos-empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 55px;
  height: 55px;

  margin:
    0
    auto
    18px;

  background:
    var(--color-surface-secondary);

  border-radius: 50%;

  font-size: 25px;
}

.pos-empty-products h2 {
  margin: 0;
}

.pos-empty-products p {
  margin:
    10px
    auto
    var(--space-6);

  color: var(--color-text-muted);

  line-height: 1.5;
}

.pos-primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-height: 44px;

  padding:
    0
    18px;

  background: var(--color-primary);

  color: #ffffff;

  border-radius: var(--radius-sm);

  text-decoration: none;
  font-weight: 700;

  transition:
    background var(--transition-fast),
    transform var(--transition-fast);
}

.pos-primary-link:hover {
  background:
    var(--color-primary-hover);

  transform: translateY(-1px);
}


/* ----------------------------------------
   Tablet
---------------------------------------- */

@media (max-width: 1100px) {
  .pos-layout {
    grid-template-columns:
      minmax(0, 1fr)
      340px;
  }

  .pos-main {
    padding: 26px;
  }

  .pos-products-grid {
    grid-template-columns:
      repeat(
        auto-fill,
        minmax(165px, 1fr)
      );
  }
}


/* ----------------------------------------
   Mobile / small tablet
---------------------------------------- */

@media (max-width: 800px) {
  .pos-layout {
    display: block;
  }

  .pos-main {
    padding:
      22px
      var(--space-4)
      30px;
  }

  .pos-header-title {
    display: block;
  }

  .pos-status {
    margin-top: var(--space-4);
  }

  .pos-section-heading {
    align-items: flex-start;
  }

  .pos-products-grid {
    grid-template-columns:
      repeat(
        2,
        minmax(0, 1fr)
      );

    gap: 10px;
  }

  .pos-product-card,
  .pos-product-button {
    min-height: 140px;
  }

  .pos-product-button {
    padding: var(--space-4);
  }

  .pos-cart {
    position: static;

    height: auto;
    min-height: 500px;

    padding:
      25px
      18px;

    border-left: 0;

    border-top:
      1px
      solid
      var(--color-border);
  }

  .pos-cart-lines {
    overflow: visible;
  }

  .pos-payment-success {
    align-items: flex-start;
  }
}


/* ----------------------------------------
   Small mobile
---------------------------------------- */

@media (max-width: 450px) {
  .pos-products-grid {
    grid-template-columns:
      1fr
      1fr;
  }

  .pos-product-name {
    font-size: 15px;
  }

  .pos-product-button {
    padding: 14px;
  }

  .pos-total strong {
    font-size: 26px;
  }

  .pos-cart-header {
    align-items: flex-start;
  }

  .pos-cart-header-actions {
    flex-direction: column;
    align-items: flex-end;

    gap: 6px;
  }
}
