﻿/*
 * MARUTI POS — CHECKOUT PAGE — Professional Responsive v4.0
 * Designed with mobile-first principles, professional grid breakpoints,
 * and clean component-level separation.
 *
 * Breakpoints:
 *   Mobile:  < 640px   â†’ single column, fixed bottom action bar
 *   Tablet:  640â€“1023px â†’ two column (60/40 split)
 *   Desktop: â‰¥ 1024px  â†’ two column (wider left, sticky right)
 */

/*  Design Tokens  */
:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-glow: rgba(37, 99, 235, 0.22);
  --brand-light: #eff6ff;
  --brand-mid: rgba(37, 99, 235, 0.10);

  --surface: #ffffff;
  --bg: #f0f4f8;
  --bg-card: #f8fafc;
  --border: #e2e8f0;
  --border-md: #cbd5e1;

  --text-1: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;

  --green: #10b981;
  --red: #ef4444;
  --blue: #3b82f6;
  --amber: #f59e0b;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --r-2xl: 24px;

  --sh-xs: 0 1px 3px rgba(0, 0, 0, 0.07);
  --sh-sm: 0 2px 10px rgba(0, 0, 0, 0.08);
  --sh-md: 0 4px 24px rgba(0, 0, 0, 0.10);
  --sh-brand: 0 6px 20px var(--brand-glow);

  --header-h: 56px;
  --bar-h: 76px;
  /* mobile bottom bar */
}

/*  Reset â”€ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-1);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

/*  Notification  */
.notification {
  position: fixed;
  top: calc(var(--header-h) + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  background: var(--text-1);
  color: #fff;
  padding: 9px 20px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  box-shadow: var(--sh-md);
  opacity: 0;
  z-index: 9999;
  transition: all 0.3s cubic-bezier(0.34, 1.2, 0.64, 1);
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
  white-space: normal;
}

.notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.notification.success {
  background: var(--green);
}

.notification.error {
  background: var(--red);
}

/* 
   â¶  HEADER — Sticky, frosted glass
    */
.pos-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 var(--border);
}

.header-left .back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-2);
  text-decoration: none;
  padding: 6px 13px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  transition: all 0.2s;
  white-space: nowrap;
}

.header-left .back-link:hover {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  text-decoration: none;
}

.header-center .logo {
  font-size: 1rem;
  font-weight: 900;
  color: var(--brand);
  letter-spacing: -0.02em;
}

.header-right .user-profile {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-2);
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px 5px 8px;
  white-space: nowrap;
}

.user-profile i {
  font-size: 1rem;
  color: var(--brand);
}

/* 
   â·  MAIN GRID LAYOUT
   

   Mobile  (<640px):  1 column, bottom-bar for Place Order
   Tablet  (640-1023): 2 columns 58% / 42%
   Desktop (â‰¥1024px): 2 columns 1fr / 420px
   Wide    (â‰¥1440px): 2 columns 1fr / 460px, bigger padding
    */

.checkout-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 14px 12px;
  /* Clear: bottom-nav (~64px) + placement-area (~70px) + safe-area */
  padding-bottom: calc(144px + env(safe-area-inset-bottom));
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

/*  Tablet: â‰¥ 640px â”€ */
@media (min-width: 640px) {
  .checkout-container {
    grid-template-columns: 58fr 42fr;
    align-items: start;
    padding: 20px 20px;
    padding-bottom: 20px;
    /* no bottom bar on tablet+ */
    gap: 16px;
  }
}

/*  Desktop: â‰¥ 1024px â”€ */
@media (min-width: 1024px) {
  .checkout-container {
    grid-template-columns: 1fr 420px;
    padding: 28px 28px;
    gap: 22px;
  }
}

/*  Wide: â‰¥ 1440px  */
@media (min-width: 1440px) {
  .checkout-container {
    grid-template-columns: 1fr 460px;
    padding: 36px 40px;
    gap: 28px;
  }
}

/* 
   â¸  PANEL CARDS — shared shell
    */
.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}

/*  Order Summary: left panel â”€ */
.order-details-panel {
  display: flex;
  flex-direction: column;
}

.order-details-panel .panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, #fff 60%, var(--brand-light));
  flex-shrink: 0;
}

.panel-header h2 {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-1);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.panel-header h2::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 16px;
  background: linear-gradient(to bottom, var(--brand), #3b82f6);
  border-radius: 999px;
  flex-shrink: 0;
}

.panel-header h2 i {
  font-size: 0.82rem;
  color: var(--brand);
}

#cart-count {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-2);
  background: var(--bg);
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

/*  Actions Panel: right panel  */
.actions-panel {
  display: flex;
  flex-direction: column;
}

/* On tablet+, actions panel sticks to top as you scroll */
@media (min-width: 640px) {
  .actions-panel {
    position: sticky;
    top: calc(var(--header-h) + 12px);
    max-height: calc(100dvh - var(--header-h) - 24px);
    overflow-y: auto;
    scrollbar-width: none;
  }

  .actions-panel::-webkit-scrollbar {
    display: none;
  }
}

/* Actions panel header */
.actions-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, #fff 60%, var(--brand-light));
  flex-shrink: 0;
}

.actions-panel-header h2 {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-1);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.actions-panel-header h2::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 16px;
  background: linear-gradient(to bottom, var(--brand), #3b82f6);
  border-radius: 999px;
  flex-shrink: 0;
}

.panel-body {
  padding: 16px;
}

.panel-section {
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.panel-section:last-of-type {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: none;
}

.panel-section>h3 {
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin-bottom: 10px;
}

/* 
   â¹  CART ITEMS LIST
    */
.cart-items-list {
  padding: 12px;
  background: var(--bg-card);
  flex: 1;
  /* stretch to fill panel height */
}

/* On desktop, cap height and add scroll */
@media (min-width: 1024px) {
  .cart-items-list {
    max-height: 55vh;
    min-height: 200px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
  }

  .cart-items-list::-webkit-scrollbar {
    width: 4px;
  }

  .cart-items-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 999px;
  }
}

/*  Cart Item Row  */
.cart-item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 8px;
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
}

.cart-item:last-child {
  margin-bottom: 0;
}

.cart-item:hover {
  box-shadow: var(--sh-sm);
  border-color: rgba(37, 99, 235, 0.28);
  transform: translateY(-1px);
}

.cart-item img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: var(--r-md);
  background: var(--bg);
  padding: 6px;
  flex-shrink: 0;
}

/* Fallback when no image */
.cart-item img[src=""],
.cart-item img:not([src]),
.cart-item img[src*="placeholder"] {
  content: '';
  background: linear-gradient(135deg, var(--bg), var(--border));
}

.item-info {
  min-width: 0;
}

.item-info h3 {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-1);
  margin: 0 0 2px;
  line-height: 1.3;
  /* Single line on mobile, wrap on bigger screens */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 640px) {
  .item-info h3 {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
}

.item-info .item-price-meta {
  font-size: 0.72rem;
  color: var(--text-3);
  font-weight: 500;
  margin-bottom: 6px;
}

.item-controls {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg);
}

.item-controls .qty-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  color: var(--text-2);
  transition: background 0.15s, color 0.15s;
}

.item-controls .qty-btn:hover {
  background: var(--brand);
  color: #fff;
}

.item-controls .quantity {
  font-weight: 700;
  font-size: 0.82rem;
  min-width: 26px;
  text-align: center;
  color: var(--text-1);
}

.item-total {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.item-total-price {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--text-1);
  white-space: nowrap;
}

.delete-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--red);
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.delete-btn:hover {
  background: var(--red);
  color: #fff;
  transform: scale(1.1);
}

/*  Empty Cart â”€ */
.empty-cart-placeholder {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-3);
}

.empty-cart-placeholder i {
  font-size: 2.8rem;
  margin-bottom: 10px;
  display: block;
  color: #cbd5e1;
}

.empty-cart-placeholder p {
  font-size: 0.82rem;
}

/* 
   âº  CUSTOMER SECTION
    */
#customer-selection {
  position: relative;
}

.customer-search-wrapper {
  display: flex;
  align-items: center;
  gap: 7px;
  position: relative;
}

.customer-search-wrapper>i {
  position: absolute;
  left: 11px;
  color: var(--text-3);
  pointer-events: none;
  font-size: 0.78rem;
}

#customer-search {
  flex: 1;
  min-width: 0;
  padding: 10px 12px 10px 32px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  font-family: inherit;
  font-size: 0.82rem;
  outline: none;
  background: var(--bg-card);
  transition: border-color 0.2s, box-shadow 0.2s;
  color: var(--text-1);
}

#customer-search::placeholder {
  color: var(--text-3);
  font-size: 0.8rem;
}

#customer-search:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px var(--brand-glow);
}

.add-btn {
  width: 40px;
  height: 40px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  background: #fff;
  color: var(--brand);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}

.add-btn:hover {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  transform: translateY(-1px);
  box-shadow: var(--sh-brand);
}

/* Search Results Dropdown */
.search-results {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  z-index: 200;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-md);
  max-height: 220px;
  overflow-y: auto;
  animation: dd-open 0.12s ease-out;
}

@keyframes dd-open {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 13px;
  cursor: pointer;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.result-item:last-child {
  border-bottom: none;
}

.result-item::before {
  content: '\f007';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  color: var(--text-3);
  font-size: 0.75rem;
  flex-shrink: 0;
}

.result-item:hover {
  background: var(--brand-mid);
}

.result-item.muted {
  color: var(--text-3);
  cursor: default;
}

/* Selected Customer Chip */
.selected-customer-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f0fdf4;
  border: 1.5px solid #bbf7d0;
  padding: 9px 12px;
  border-radius: var(--r-lg);
  margin-top: 8px;
  gap: 8px;
  flex-wrap: wrap;
}

.customer-info {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.customer-info i {
  font-size: 1rem;
  color: var(--green);
  flex-shrink: 0;
}

#customer-name-display {
  font-weight: 700;
  font-size: 0.83rem;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#verify-identity-btn {
  background: var(--green);
  color: #fff;
  border: none;
  padding: 5px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
  transition: filter 0.15s;
  font-family: inherit;
}

#view-profile-btn {
  background: var(--blue);
  color: #fff;
  border: none;
  padding: 5px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
  transition: filter 0.15s;
  font-family: inherit;
}

#change-customer-btn {
  background: var(--bg);
  color: var(--text-2);
  border: 1.5px solid var(--border);
  padding: 5px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
  transition: background 0.15s;
  font-family: inherit;
}

#verify-identity-btn:hover {
  filter: brightness(1.1);
}

#view-profile-btn:hover {
  filter: brightness(1.1);
}

#change-customer-btn:hover {
  background: var(--border);
}

/* 
   â»  PRICE DETAILS
    */
.price-details {
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  overflow: hidden;
}

.price-details .summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  font-size: 0.8rem;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.price-details .summary-row:nth-child(even) {
  background: #fff;
}

.price-details .summary-row:last-child {
  border-bottom: none;
}

.price-details .summary-row label {
  color: var(--text-2);
  font-size: 0.8rem;
}

.price-details .summary-row.muted {
  color: var(--text-3);
  font-size: 0.75rem;
}

.price-details .summary-row input {
  max-width: 78px;
  padding: 4px 9px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  font-family: inherit;
  font-size: 0.8rem;
  text-align: right;
  outline: none;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.price-details .summary-row input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-glow);
}

.tax-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid rgba(37, 99, 235, 0.25);
  border-radius: 999px;
  background: var(--brand-light);
  color: var(--brand-dark);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.tax-fields[hidden] { display: none; }

.tax-fields .summary-row select {
  min-width: 112px;
  padding: 6px 9px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--text-1);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  outline: none;
}

.tax-fields .summary-row select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-glow);
}

/* Grand Total row */
.price-details .total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--brand), #3b82f6);
  border-bottom: none;
}

.price-details .total strong {
  font-weight: 900;
  font-size: 1.1rem;
  color: #fff;
  letter-spacing: -0.02em;
}

/* 
   â¼  PAYMENT BUTTONS
    */
.payment-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.payment-options .payment-btn:nth-child(3) {
  grid-column: 1 / -1;
}

.payment-btn {
  padding: 11px 12px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-2);
  transition: all 0.18s;
}

.payment-btn i {
  font-size: 0.95rem;
  color: var(--text-3);
  width: 18px;
  text-align: center;
  transition: color 0.15s;
}

.payment-btn:hover {
  border-color: rgba(37, 99, 235, 0.35);
  color: var(--text-1);
  transform: translateY(-1px);
  box-shadow: var(--sh-xs);
}

.payment-btn.active {
  background: var(--brand-light);
  border-color: var(--brand);
  color: var(--brand-dark);
  box-shadow: 0 3px 12px var(--brand-glow);
}

.payment-btn.active i {
  color: var(--brand);
}

/* method Breakdown */
.method-breakdown {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 10px;
}

.remaining-due-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1.5px dashed var(--border);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text-1);
}

#remaining-due {
  color: var(--red);
  font-size: 0.98rem;
}

/* 
   â½  PLACE ORDER — TWO BEHAVIOURS
   Mobile  (<640px): fixed bottom bar (always visible)
   Tablet+ (â‰¥640px): normal button inside panel
    */

/*  Tablet+ desktop: normal placement inside panel â”€ */
.placement-area {
  margin-top: 14px;
}

.place-order-button {
  width: 100%;
  padding: 14px;
  font-size: 0.92rem;
  font-family: inherit;
  font-weight: 900;
  letter-spacing: 0.06em;
  background: linear-gradient(135deg, var(--brand), #3b82f6);
  color: #fff;
  border: none;
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 50px;
  box-shadow: var(--sh-brand);
}

.place-order-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px var(--brand-glow);
}

.place-order-button:active:not(:disabled) {
  transform: translateY(0);
}

.place-order-button:disabled {
  background: linear-gradient(135deg, #cbd5e1, #94a3b8);
  color: #fff;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.75;
}

.credit-warning {
  text-align: center;
  color: var(--red);
  font-size: 0.72rem;
  margin-top: 7px;
  font-weight: 600;
}

/*  Mobile (<640px): fixed bottom bar â”€ */
@media (max-width: 639px) {
  .placement-area {
    position: fixed;
    /* Sits directly above the bottom-nav (~64px tall) */
    bottom: calc(64px + env(safe-area-inset-bottom));
    left: 0;
    right: 0;
    z-index: 90;
    /* Below bottom-nav (z-index: 999) but above content */
    margin: 0;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.10);
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .placement-area .place-order-button {
    flex: 1;
    padding: 13px;
    font-size: 0.88rem;
    min-height: 48px;
    border-radius: var(--r-lg);
  }

  .credit-warning {
    position: absolute;
    top: -28px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    background: rgba(239, 68, 68, 0.1);
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.68rem;
  }
}

/*  Mobile total chip (only in bottom bar)  */
.mobile-total-display {
  display: none;
  /* hidden on tablet+ */
}

@media (max-width: 639px) {
  .mobile-total-display {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    line-height: 1.2;
  }

  .mobile-total-display .label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-3);
  }

  .mobile-total-display .amount {
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--text-1);
    letter-spacing: -0.02em;
  }
}

/* 
   â¾  SPINNER
    */
.spinner-container {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: inherit;
  border-radius: inherit;
}

.spinner {
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-left-color: #fff;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 
   â¿  MODALS
   Bottom-sheet on mobile (<640px), centered card on tablet+
    */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  z-index: 1000;
  animation: bd-in 0.2s ease;

  /* Mobile: sheet from bottom */
  align-items: flex-end;
  justify-content: stretch;
}

@keyframes bd-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Mobile bottom sheet */
.modal-content {
  background: #fff;
  padding: 12px 18px 24px;
  border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  width: 100%;
  max-height: 90dvh;
  overflow-y: auto;
  box-shadow: 0 -6px 40px rgba(0, 0, 0, 0.18);
  animation: sheet-up 0.28s cubic-bezier(0.34, 1.2, 0.64, 1);
}

@keyframes sheet-up {
  from {
    transform: translateY(40px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Sheet grab handle */
.modal-content::before {
  content: '';
  display: block;
  width: 36px;
  height: 4px;
  background: var(--border-md);
  border-radius: 999px;
  margin: 0 auto 14px;
}

/* Tablet+: centered card */
@media (min-width: 640px) {
  .modal-overlay {
    align-items: center;
    justify-content: center;
    padding: 20px;
  }

  .modal-content {
    border-radius: var(--r-xl);
    max-width: 460px;
    padding: 24px;
    animation: card-up 0.24s cubic-bezier(0.34, 1.2, 0.64, 1);
    box-shadow: var(--sh-md);
  }

  .modal-content::before {
    display: none;
  }
}

@keyframes card-up {
  from {
    transform: translateY(14px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Modal Header */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-1);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.close-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--text-2);
  transition: all 0.15s;
  flex-shrink: 0;
}

.close-btn:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

/*  Add Customer Form  */
#add-customer-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#add-customer-form label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
  margin-bottom: -5px;
}

#add-customer-form input {
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  background: var(--bg-card);
  color: var(--text-1);
  transition: border-color 0.2s, box-shadow 0.2s;
}

#add-customer-form input:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px var(--brand-glow);
}

#add-customer-form input::placeholder {
  color: var(--text-3);
  font-size: 0.8rem;
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--brand), #3b82f6);
  color: #fff;
  border: none;
  border-radius: var(--r-lg);
  font-family: inherit;
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
  position: relative;
  min-height: 46px;
  box-shadow: var(--sh-brand);
  transition: all 0.2s;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px var(--brand-glow);
}

/*  Confirmation Modal â”€ */
.modal-content.confirmation {
  text-align: center;
}

#confirmation-icon {
  font-size: 3.2rem;
  color: var(--green);
  margin-bottom: 12px;
  display: block;
}

#confirmation-title {
  font-size: 1.3rem;
  font-weight: 900;
  margin-bottom: 6px;
}

#confirmation-message {
  color: var(--text-2);
  margin-bottom: 20px;
  font-size: 0.85rem;
}

#confirmation-ok-btn {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--green), #059669);
  color: #fff;
  border: none;
  border-radius: var(--r-lg);
  font-family: inherit;
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
  transition: all 0.2s;
}

#confirmation-ok-btn:hover {
  transform: translateY(-1px);
}

/*  OTP Inputs â”€ */
#udhar-otp-input,
#add-customer-otp-input {
  font-size: 1.7rem;
  text-align: center;
  letter-spacing: 12px;
  padding: 12px;
  width: 68%;
  margin: 0 auto 14px;
  display: block;
  border-radius: var(--r-lg);
  border: 2px solid var(--border);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
  font-weight: 800;
  background: var(--bg-card);
  color: var(--text-1);
}

#udhar-otp-input:focus,
#add-customer-otp-input:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px var(--brand-glow);
}

#verify-otp-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--brand), #3b82f6);
  color: #fff;
  border: none;
  border-radius: var(--r-lg);
  font-family: inherit;
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
  position: relative;
  min-height: 48px;
  box-shadow: var(--sh-brand);
  transition: all 0.2s;
}

#verify-otp-btn:hover {
  transform: translateY(-1px);
}

#otp-error,
#add-customer-otp-error {
  color: var(--red);
  margin-top: 8px;
  font-weight: 600;
  font-size: 0.8rem;
  display: none;
}

/*  SR Only  */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* 
   FINE-TUNING EDGE CASES
    */

/* Very small phone (360px) */
@media (max-width: 380px) {
  .pos-header {
    padding: 0 10px;
  }

  .header-center .logo {
    font-size: 0.88rem;
  }

  .header-left .back-link {
    font-size: 0.72rem;
    padding: 5px 10px;
  }

  .header-right .user-profile {
    font-size: 0.68rem;
    padding: 4px 9px;
  }

  .cart-item {
    grid-template-columns: 46px 1fr auto;
    padding: 10px;
    gap: 9px;
  }

  .cart-item img {
    width: 46px;
    height: 46px;
  }

  .item-total-price {
    font-size: 0.82rem;
  }

  .payment-options {
    grid-template-columns: 1fr;
  }

  .payment-options .payment-btn:nth-child(3) {
    grid-column: auto;
  }

  #customer-search {
    font-size: 0.75rem;
  }

  .add-btn {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }
}

/* Landscape phone / small tablet without two-column (640-767 range is already 2-col) */
@media (min-width: 640px) and (max-width: 767px) {
  .panel-body {
    padding: 13px;
  }

  .panel-section {
    padding-bottom: 13px;
    margin-bottom: 13px;
  }
}

/* Large desktop comfort margins */
@media (min-width: 1600px) {
  .checkout-container {
    max-width: 1600px;
  }
}
@media print {
  body * {
  visibility: hidden;
}
#thermal-receipt, #thermal-receipt * {
       visibility: visible;
  }
 #thermal-receipt {
  position: absolute;
      left: 0;
      top: 0;
      width: 100%;
      margin:0;
      padding:0;
      background:white;
      color:black;
      font-family: 'Courier New', Courier, monospace;
  }
    .checkout-container, .pos-header, .bottom-nav, .modal-overlay {
display: none !important;
}
}
/* Restored compact checkout controls */
.customer-helper { margin: -2px 0 6px; color: var(--text-3); font-size: .72rem; font-weight: 600; }
.tax-toggle-btn { border: 1px solid var(--border); border-radius: 8px; background: var(--brand-light); color: var(--brand); padding: 6px 9px; font-weight: 700; cursor: pointer; }
.tax-fields[hidden], .cash-settlement[hidden], .remaining-due-row[hidden] { display: none; }
.cash-settlement { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(120px,.8fr); gap: 10px; margin-top: 10px; }
.cash-field,.cash-return { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-card); }
.cash-field { padding: 9px 12px; }
.cash-field > span:first-child,.cash-return span { display:block; color:var(--text-3); font-size:.66rem; font-weight:700; text-transform:uppercase; letter-spacing:.05em; }
.cash-input-wrap { display:flex; align-items:center; gap:4px; margin-top:2px; font-weight:800; }
#cash-received-input { width:100%; min-width:0; border:0; outline:0; background:transparent; color:var(--text-1); font:inherit; font-size:1rem; font-weight:800; }
.cash-return { padding:9px 12px; display:flex; flex-direction:column; justify-content:center; text-align:right; }
#cash-change { margin-top:2px; color:var(--text-2); font-size:1rem; }
#cash-change.is-return { color:var(--green); }
#cash-change.is-short { color:var(--red); }
.payment-options { grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; }
.payment-options .payment-btn:nth-child(3) { grid-column:auto; }
.payment-btn { min-height:46px; padding:10px 8px; justify-content:center; }
.advance-payment-btn.active { background:#f5f3ff; border-color:#7c3aed; color:#6d28d9; box-shadow:0 3px 12px rgba(124,58,237,.16); }
.advance-payment-btn.active i { color:#7c3aed; }
.customer-advance-chip { padding:3px 7px; border:1px solid #c4b5fd; border-radius:999px; background:#f5f3ff; color:#6d28d9; font-size:.68rem; font-weight:800; white-space:nowrap; }
@media (max-width:639px) {
  .actions-panel-header { display:none; }
  .checkout-container { gap:8px; padding:8px 10px calc(76px + env(safe-area-inset-bottom)); }
  .panel-body { padding:12px; }
  .panel-section { padding-bottom:10px; margin-bottom:10px; }
  .payment-btn { min-height:44px; padding:9px 6px; font-size:.82rem; }
  .cash-settlement { height:58px; margin-top:8px; gap:8px; }
  .cash-field, .cash-return { min-height:58px; padding:8px 10px; }
  .cash-field > span:first-child, .cash-return span { font-size:.62rem; line-height:1.1; }
  #cash-received-input, #cash-change { font-size:1.05rem; line-height:1.15; margin-top:3px; }
  .placement-area { bottom: env(safe-area-inset-bottom); padding:5px 10px; gap:8px; }
  .placement-area .place-order-button { min-height:40px; padding:9px; }
}
@media (max-width:420px) {
  .payment-options { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
