/**
 * POS Register Touch-Optimized Layout & Receipt Styling
 */

.pos-container {
  display: flex;
  height: calc(100vh - 92px);
  overflow: hidden;
  position: relative;
}

/* ----------------------------------------------------
   LEFT SIDE: PRODUCT CATALOG & GRID (Touch Friendly)
   ---------------------------------------------------- */
.pos-catalog-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-subtle);
  background-color: var(--bg-app);
  overflow: hidden;
}

.pos-top-toolbar {
  padding: 14px 20px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.pos-search-wrap {
  flex: 1;
  min-width: 250px;
  position: relative;
}

.pos-search-wrap input {
  padding-left: 36px;
  height: 44px;
  font-size: 14.5px;
  border-radius: var(--radius-md);
}

.pos-search-wrap .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  font-size: 16px;
  pointer-events: none;
}

/* Category Pills Bar */
.category-pills-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background-color: var(--bg-surface-secondary);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: thin;
}

.category-pill {
  padding: 8px 16px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.category-pill:hover {
  background-color: #2f3238;
  color: var(--text-main);
}

.category-pill.active {
  background-color: var(--shopify-green);
  border-color: var(--shopify-green);
  color: #fff;
  font-weight: 600;
}

/* Product Grid */
.pos-grid-scroll {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.product-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  user-select: none;
  transition: transform 0.1s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  overflow: hidden;
  height: 220px;
}

.product-card:active {
  transform: scale(0.97);
}

.product-card:hover {
  border-color: var(--shopify-green);
  box-shadow: 0 4px 12px rgba(0, 128, 96, 0.15);
}

.product-card-image {
  width: 100%;
  height: 110px;
  border-radius: var(--radius-sm);
  background-color: #242629;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.product-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-between;
}

.product-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.product-card-price {
  font-size: 14.5px;
  font-weight: 700;
  color: #fff;
}

.product-stock-tag {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.product-stock-tag.in-stock {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.product-stock-tag.out-stock {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

/* ----------------------------------------------------
   RIGHT SIDE: BILL / CART PANEL (Touch Friendly)
   ---------------------------------------------------- */
.pos-cart-panel {
  width: 440px;
  background-color: var(--bg-surface);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: -4px 0 15px rgba(0,0,0,0.3);
}

@media (max-width: 980px) {
  .pos-cart-panel {
    width: 360px;
  }
}

.cart-header {
  padding: 16px 20px;
  background-color: var(--bg-surface-secondary);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cart-title {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-items-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}

.cart-empty-state {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  text-align: center;
  gap: 12px;
}

.cart-item-row {
  background-color: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cart-item-info {
  flex: 1;
}

.cart-item-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 2px;
}

.cart-item-unit-price {
  font-size: 12px;
  color: var(--text-muted);
}

.cart-qty-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}

.qty-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface-secondary);
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  font-size: 16px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.1s ease;
}

.qty-btn:active {
  background-color: var(--shopify-green);
  color: #fff;
}

.qty-number {
  font-size: 15px;
  font-weight: 700;
  min-width: 24px;
  text-align: center;
}

.cart-item-line-total {
  font-size: 14.5px;
  font-weight: 700;
  min-width: 70px;
  text-align: right;
  color: #fff;
}

.btn-remove-item {
  background: transparent;
  border: none;
  color: var(--text-faint);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
}

.btn-remove-item:hover {
  color: var(--danger);
}

/* Cart Summary & Checkout */
.cart-summary-footer {
  background-color: var(--bg-surface-secondary);
  border-top: 1px solid var(--border-subtle);
  padding: 16px 20px;
}

.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.summary-row.total-row {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  border-top: 1px dashed var(--border-strong);
  padding-top: 10px;
  margin-top: 10px;
  margin-bottom: 16px;
}

.checkout-btn-bar {
  display: flex;
  gap: 10px;
}

.btn-checkout {
  flex: 1;
  background-color: var(--shopify-green);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 16px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background-color 0.15s ease;
  box-shadow: 0 4px 14px rgba(0, 128, 96, 0.4);
}

.btn-checkout:hover {
  background-color: var(--shopify-green-hover);
}

.btn-checkout:disabled {
  background-color: #333;
  color: #666;
  cursor: not-allowed;
  box-shadow: none;
}

/* ----------------------------------------------------
   RECEIPT PRINT TEMPLATE (80mm Thermal Receipt Layout)
   ---------------------------------------------------- */
.thermal-receipt {
  background: #ffffff;
  color: #000000;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  padding: 16px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  line-height: 1.4;
  border-radius: 6px;
  border: 1px solid #ddd;
}

.thermal-receipt .r-header {
  text-align: center;
  border-bottom: 1px dashed #000;
  padding-bottom: 10px;
  margin-bottom: 10px;
}

.thermal-receipt .r-title {
  font-size: 16px;
  font-weight: bold;
}

.thermal-receipt .r-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
}

.thermal-receipt .r-table th, .thermal-receipt .r-table td {
  padding: 4px 0;
  text-align: left;
}

.thermal-receipt .r-table th.r-num, .thermal-receipt .r-table td.r-num {
  text-align: right;
}

.thermal-receipt .r-total-box {
  border-top: 1px dashed #000;
  border-bottom: 1px dashed #000;
  padding: 8px 0;
  margin: 8px 0;
}

.thermal-receipt .r-footer {
  text-align: center;
  font-size: 11px;
  margin-top: 10px;
  color: #333;
}
