/* ==========================================================================
   MINIGEST — pos.css (Point of Sale Module Styles)
   ========================================================================== */

.pos-container {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  height: calc(100vh - 64px); /* Subtract header height */
  padding: 24px;
  overflow: hidden;
  box-sizing: border-box;
  animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) ease-out;
}

/* ===== LEFT PANEL: PRODUCTS ===== */
.pos-products {
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
  overflow: hidden;
}

/* Search bar styling */
.pos-search-wrapper {
  position: relative;
  width: 100%;
}

.pos-search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  opacity: 0.6;
}

.pos-search {
  width: 100%;
  padding: 14px 16px 14px 48px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.95rem;
  transition: var(--transition-normal);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.pos-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), var(--shadow-glow);
  background: rgba(255, 255, 255, 0.02);
}

/* Categories row scroll */
.pos-categories {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  flex-shrink: 0;
  scrollbar-width: thin;
}

.pos-categories::-webkit-scrollbar {
  height: 4px;
}

.pos-category-chip {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
}

.pos-category-chip:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.pos-category-chip.active {
  background: linear-gradient(135deg, var(--accent), #059669);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 12px var(--accent-glow);
}

/* Products grid wrapper */
.pos-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
  overflow-y: auto;
  padding-right: 4px;
  padding-bottom: 24px;
}

/* Product Card */
.pos-product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.pos-product-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), 0 0 16px rgba(16, 185, 129, 0.1);
}

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

.pos-product-emoji {
  font-size: 2.2rem;
  margin-bottom: 12px;
  transition: var(--transition-normal);
}

.pos-product-card:hover .pos-product-emoji {
  transform: scale(1.15) rotate(5deg);
}

.pos-product-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 2.4rem;
  line-height: 1.2;
}

.pos-product-price {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  margin-top: auto;
}

.pos-product-stock {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Out of Stock styling */
.pos-product-card.out-of-stock {
  opacity: 0.5;
  cursor: not-allowed;
  background: rgba(18, 18, 42, 0.4);
}

.pos-product-card.out-of-stock:hover {
  transform: none;
  border-color: var(--border);
  box-shadow: none;
}

.pos-product-card.out-of-stock::after {
  content: 'SIN STOCK';
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 26, 0.75);
  color: var(--danger);
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.05em;
  backdrop-filter: blur(2px);
}

/* ===== RIGHT PANEL: CART ===== */
.pos-cart {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.pos-cart-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.01);
}

.pos-cart-title {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

.pos-cart-count {
  background: var(--accent);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* Cart item list scrolling area */
.pos-cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.pos-cart-empty p {
  font-size: 0.85rem;
}

/* Cart items card */
.pos-cart-item {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  position: relative;
  transition: var(--transition-fast);
}

.pos-cart-item:hover {
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.01);
}

.pos-cart-item-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pos-cart-item-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pos-cart-item-price {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Quantity controls in cart */
.pos-qty-controls {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.pos-qty-btn {
  background: transparent;
  border: none;
  width: 28px;
  height: 28px;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.pos-qty-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.pos-qty-value {
  font-size: 0.85rem;
  font-weight: 700;
  min-width: 24px;
  text-align: center;
}

.pos-cart-item-subtotal {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: right;
  min-width: 60px;
}

.pos-cart-item-remove {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  border-radius: 4px;
}

.pos-cart-item-remove:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
}

/* Totals box */
.pos-cart-totals {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pos-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.pos-total-final {
  color: var(--text-primary);
  font-size: 1.15rem;
  font-weight: 800;
  border-top: 1px dashed var(--border);
  padding-top: 8px;
  margin-top: 4px;
}

.pos-total-final span:last-child {
  color: var(--accent);
}

/* Payment Section */
.pos-payment-section {
  padding: 12px 24px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.05);
}

.pos-payment-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 8px;
}

.pos-payment-chips {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.pos-payment-chip {
  padding: 8px 4px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  transition: var(--transition-fast);
}

.pos-payment-chip:hover {
  background: var(--bg-input);
  color: var(--text-primary);
}

.pos-payment-chip.active {
  border-color: var(--accent);
  background: rgba(16, 185, 129, 0.06);
  color: var(--accent);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.08);
}

/* Efectivo custom section */
.pos-efectivo-section {
  padding: 8px 24px 12px;
  background: rgba(0, 0, 0, 0.05);
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Doc type Toggle */
.pos-doc-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 12px 24px;
  background: rgba(0, 0, 0, 0.05);
  border-top: 1px solid var(--border);
  gap: 8px;
}

.pos-doc-option {
  padding: 8px 0;
  text-align: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.pos-doc-option:hover {
  background: var(--bg-input);
  color: var(--text-primary);
}

.pos-doc-option.active {
  background: linear-gradient(135deg, var(--accent-secondary), #2563eb);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

/* Cobrar Button Wrapper */
.pos-cobrar-section {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.05);
}

.pos-cobrar-btn {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-md);
  border: none;
  font-family: var(--font-family);
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), #059669);
  cursor: pointer;
  transition: var(--transition-normal);
  box-shadow: 0 4px 14px var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.pos-cobrar-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4), var(--shadow-glow);
  background: linear-gradient(135deg, var(--accent-hover), var(--accent));
}

.pos-cobrar-btn:active:not(:disabled) {
  transform: translateY(0);
}

.pos-cobrar-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
  background: var(--bg-input);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Keyboard shortcut bar */
.pos-shortcut-hint {
  position: fixed;
  bottom: 12px;
  left: 284px; /* Align nicely with sidebar */
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  box-shadow: var(--shadow-md);
  pointer-events: none;
  z-index: 50;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  gap: 4px;
}

.pos-shortcut-key {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: monospace;
}

/* ===== RECEIPT / TICKET (THERMAL STYLE IN MODAL) ===== */
.pos-ticket {
  background: #ffffff;
  color: #1a1a2e;
  padding: 24px;
  border-radius: 4px;
  font-family: 'Courier New', Courier, monospace;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  max-width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.pos-ticket-header {
  text-align: center;
  margin-bottom: 16px;
  color: #1a1a2e;
}

.pos-ticket-divider {
  border-top: 1px dashed #777788;
  margin: 12px 0;
  height: 0;
}

.pos-ticket-items {
  margin: 8px 0;
}

.pos-ticket-total {
  font-weight: bold;
}

.pos-ticket span {
  color: #1a1a2e !important; /* Force black monospace text on receipt regardless of light/dark mode */
}

.pos-ticket strong {
  color: #000000 !important;
}

.pos-ticket p {
  color: #555566 !important;
}

/* ==========================================================================
   POS RESPONSIVE STYLES
   ========================================================================== */
@media (max-width: 1024px) {
  .pos-container {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
    padding: 16px;
    gap: 16px;
  }
  
  .pos-products {
    height: auto;
    overflow: visible;
  }

  .pos-grid {
    overflow-y: visible;
    height: auto;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    padding-bottom: 0;
  }

  .pos-cart {
    height: 550px;
  }
}

@media (max-width: 768px) {
  .pos-shortcut-hint {
    display: none !important; /* Hide physical keyboard guides on touch screens */
  }
}

@media (max-width: 480px) {
  .pos-cart {
    height: 500px;
  }

  /* 2x2 Payment Grid for easy thumb tapping */
  .pos-payment-chips {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .pos-payment-chip {
    padding: 10px 4px;
    font-size: 0.8rem;
  }

  /* Two-row layout for cart items on small screens */
  .pos-cart-item {
    grid-template-columns: 1fr auto;
    row-gap: 8px;
    column-gap: 12px;
    padding: 10px;
  }

  .pos-cart-item-info {
    grid-column: span 2;
  }

  .pos-qty-controls {
    grid-column: 1;
    justify-self: start;
  }

  .pos-cart-item-subtotal {
    grid-column: 2;
    text-align: right;
    justify-self: end;
    align-self: center;
  }

  /* Receipt/Ticket padding reduction */
  .pos-ticket {
    padding: 14px;
    font-size: 0.78rem;
  }
}

