/* PREVENT TEXT SELECTION */
body,
button,
table,
tr,
td,
th,
div,
span,
h1,
h2,
h3,
h4,
h5,
h6,
p {
  -webkit-user-select: none;
  user-select: none;
}

/* ALLOW INPUT SELECTION */
input,
textarea {
  -webkit-user-select: text;
  user-select: text;
}

* {
  box-sizing: border-box;
}

.login-screen {
  min-height: 100vh;
  background: #eef1f6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.12);
  text-align: center;
}

.login-card h1 {
  margin: 10px 0 6px;
  font-size: 28px;
  font-weight: 950;
}

.login-card p {
  margin: 0 0 18px;
  color: #6b7280;
  font-size: 14px;
}

.google-login-btn {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 16px;
  background: #111827;
  color: #ffffff;
  font-size: 15px;
  font-weight: 950;
  cursor: pointer;
}

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background: #eef1f6;
  color: #111827;
}

.pos-app {
  display: grid;
  grid-template-columns: 1fr 380px;
  height: 100vh;
  overflow: hidden;
}

/* LEFT */
.pos-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  padding: 14px;
  gap: 12px;
}

.pos-top {
  flex-shrink: 0;
}



.search-box {
  margin-top: 12px;
  height: 58px;
  background: #ffffff;
  border: 2px solid #111827;
  border-radius: 18px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 12px 35px rgba(15, 23, 42, 0.08);
}

.search-icon {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: #111827;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 900;
}

.search-box input {
  flex: 1;
  height: 100%;
  border: none;
  outline: none;
  font-size: 17px;
  font-weight: 800;
  min-width: 0;
}

.search-box button {
  border: none;
  background: #f3f4f6;
  color: #111827;
  height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  font-weight: 900;
  cursor: pointer;
}

.products-panel {
  flex: 1;
  min-height: 0;
  background: #ffffff;
  border: 1px solid #e7eaf0;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 12px 35px rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
}

.panel-title {
  padding: 14px 16px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.panel-title h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 950;
}

.panel-title p {
  margin: 4px 0 0;
  font-size: 12px;
  color: #6b7280;
}

.table-container {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f9fafb;
  color: #6b7280;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

tbody td {
  padding: 13px 14px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 14px;
  vertical-align: middle;
}

tbody tr {
  cursor: pointer;
  transition: 0.16s ease;
}

tbody tr:hover {
  background: #f8fafc;
}

tbody tr:nth-child(odd) {
  background: #ffffff;
}

tbody tr:nth-child(even) {
  background: #f8fafc;
}

tbody tr:hover {
  background: #eef6ff;
}

tbody td {
  padding: 10px 14px;
  font-size: 13px;
}

thead th {
  padding: 10px 14px;
  position: sticky;
  top: 0;
  z-index: 5;
}

tbody tr.selected-row {
  background: #dbeafe !important;
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}

.search-box {
  border: 1px solid #d7dce5;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

.stock-pill {
  padding: 4px 8px;
  font-size: 11px;
}

.checkout.disabled,
.checkout:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  opacity: 0.7;
}

.stock-pill.medium {
  background: #fff7ed;
  color: #c2410c;
}

.payment-btn {
  height: 34px;
}

.checkout {
  height: 40px;
}

.product-cell {
  font-weight: 950;
  color: #111827;
}

.muted-cell {
  color: #4b5563;
}

.stock-pill {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  background: #ecfdf5;
  color: #047857;
}

.stock-pill.low {
  background: #fff7ed;
  color: #c2410c;
}

.stock-pill.unlimited {
  background: #eff6ff;
  color: #1d4ed8;
}

.price-cell {
  font-weight: 950;
}

.empty-row {
  text-align: center;
  padding: 38px !important;
  color: #6b7280;
  font-weight: 800;
}

/* RIGHT CART */
.pos-cart {
  height: 100vh;
  background: #ffffff;
  border-left: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cart-header {
  flex-shrink: 0;
  padding: 14px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-header h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 950;
}

.cart-header p {
  margin: 3px 0 0;
  color: #6b7280;
  font-size: 12px;
}

.clear-btn {
  border: none;
  background: #fee2e2;
  color: #991b1b;
  padding: 9px 13px;
  border-radius: 12px;
  font-weight: 900;
  cursor: pointer;
}

.cart-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  scroll-behavior: smooth;
}

.empty-cart {
  height: 100%;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #6b7280;
  font-weight: 800;
}

.cart-item {
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 11px;
  margin-bottom: 10px;
  background: #ffffff;
}

.cart-item-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.cart-name {
  font-weight: 950;
  font-size: 14px;
}

.cart-meta {
  color: #6b7280;
  font-size: 12px;
  margin-top: 3px;
}

.cart-price {
  font-weight: 950;
  white-space: nowrap;
}

.qty-line {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.qty-controls {
  display: flex;
  align-items: center;
  gap: 7px;
}

.qty-controls button {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 10px;
  background: #f3f4f6;
  font-size: 17px;
  font-weight: 950;
  cursor: pointer;
}

.qty-controls strong {
  min-width: 24px;
  text-align: center;
}

.remove-btn {
  border: none;
  background: transparent;
  color: #dc2626;
  font-weight: 900;
  cursor: pointer;
}

.summary {
  flex-shrink: 0;
  border-top: 1px solid #e5e7eb;
  padding: 11px 12px 12px;
  background: #ffffff;
}

.summary-row,
.vat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
  font-size: 13px;
  color: #374151;
}

.summary-row strong {
  color: #111827;
}

.input-row input {
  width: 90px;
  height: 30px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 0 8px;
  text-align: right;
  font-weight: 900;
}

.vat-row {
  cursor: pointer;
  user-select: none;
}

.vat-row input {
  width: 18px;
  height: 18px;
}

.summary-row.total {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px dashed #d1d5db;
  font-size: 20px;
  font-weight: 950;
}

.payments {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-top: 8px;
}

.payment-btn {
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #111827;
  border-radius: 12px;
  height: 38px;
  font-size: 13px;
  font-weight: 950;
  cursor: pointer;
}

.payment-btn.active {
  background: #111827;
  color: #ffffff;
  border-color: #111827;
}

.checkout {
  width: 100%;
  height: 44px;
  margin-top: 8px;
  border: none;
  border-radius: 14px;
  background: #16a34a;
  color: #ffffff;
  font-size: 15px;
  font-weight: 950;
  cursor: pointer;
}

/* MODALS */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.hidden {
  display: none !important;
}

.modal-box {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border-radius: 22px;
  padding: 16px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 950;
}

.modal-header p {
  margin: 4px 0 0;
  color: #6b7280;
  font-size: 13px;
}

.modal-close {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 12px;
  background: #f3f4f6;
  font-weight: 950;
  cursor: pointer;
}

.confirm-total {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  margin-bottom: 13px;
}

.confirm-total span {
  color: #6b7280;
  font-size: 13px;
  font-weight: 800;
}

.confirm-total strong {
  font-size: 18px;
  font-weight: 950;
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 900;
  color: #374151;
  margin-bottom: 6px;
}

.phone-input {
  width: 100%;
  height: 46px;
  border: 1px solid #d1d5db;
  border-radius: 14px;
  padding: 0 12px;
  font-size: 15px;
  font-weight: 800;
  outline: none;
}

.phone-input:focus {
  border-color: #111827;
}

.bh-phone-box {
  display: flex;
  height: 46px;
  border: 1px solid #d1d5db;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}

.bh-prefix {
  width: 115px;
  background: #f3f4f6;
  border-right: 1px solid #d1d5db;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
}

.bh-phone-box .phone-input {
  border: none;
  border-radius: 0;
  flex: 1;
  height: 100%;
}

.bh-phone-box:focus-within {
  border-color: #111827;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 14px;
}

.modal-actions.single {
  grid-template-columns: 1fr;
}

.back-btn,
.confirm-btn {
  height: 42px;
  border: none;
  border-radius: 14px;
  font-weight: 950;
  cursor: pointer;
}

.back-btn {
  background: #f3f4f6;
  color: #111827;
}

.confirm-btn {
  background: #111827;
  color: #ffffff;
}

.success-total {
  background: #ecfdf5;
  color: #047857;
  border-radius: 16px;
  padding: 14px;
  text-align: center;
  font-size: 22px;
  font-weight: 950;
}

/* PRINT */
.receipt-area {
  display: none;
}

@media print {
  body * {
    visibility: hidden;
  }

  #receiptArea,
  #receiptArea * {
    visibility: visible;
  }

  #receiptArea {
    display: block;
    position: absolute;
    left: 0;
    top: 0;
    width: 80mm;
    padding: 10px;
    font-family: Arial, sans-serif;
    color: #000;
  }

  .receipt-title {
    text-align: center;
    font-weight: 900;
    font-size: 16px;
  }

  .receipt-line {
    border-top: 1px dashed #000;
    margin: 8px 0;
  }

  .receipt-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin: 4px 0;
  }

  .receipt-total {
    font-weight: 900;
    font-size: 14px;
  }
}

/* MOBILE */
@media (max-width: 900px) {
  .pos-app {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .pos-main {
    height: auto;
    min-height: 60vh;
  }

  .pos-cart {
    height: 70vh;
    border-left: none;
    border-top: 1px solid #e5e7eb;
  }

  .pos-header {
    align-items: flex-start;
    gap: 10px;
  }

  .cashier-box {
    min-width: 105px;
  }
}


.top-header {
  height: 54px;
  background: #ffffff;
  border-bottom: 1px solid #ececec;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-back-btn,
.header-refresh-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 11px;
  background: #f3f4f6;
  color: #111827;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.header-back-btn i,
.header-refresh-btn i {
  font-size: 15px;
}

.header-title {
  font-size: 17px;
  font-weight: 900;
  color: #111827;
}

/* FINAL POS GRID HEADER FIX */

.top-header {
  grid-column: 1 / -1;
  grid-row: 1;
}

.pos-main {
  grid-column: 1;
  grid-row: 2;
  height: calc(100vh - 54px);
}

.pos-cart {
  grid-column: 2;
  grid-row: 2;
  height: calc(100vh - 54px);
}

.pos-app {
  grid-template-rows: 54px 1fr;
}

/* MOBILE FIX */
@media (max-width: 900px) {
  .top-header {
    grid-column: 1;
    grid-row: auto;
  }

  .pos-main,
  .pos-cart {
    grid-column: 1;
    grid-row: auto;
    height: auto;
  }

  .pos-cart {
    min-height: 70vh;
  }
}




