﻿/* ============================================================
   POS Tailwind Custom Styles
   Additional styles for the modern POS interface
   ============================================================ */

/* Base font size */
html {
  font-size: 16px;
}

@media (max-width: 1024px) {
  html {
    font-size: 11px;
  }
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 5px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #e9eaeb;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb {
  background: #b0bec5;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #90a4ae;
}

/* Custom cyan colors (Material Design inspired) */
.bg-cyan-50,
.hover\:bg-cyan-50:hover {
  background-color: #e0f7fa;
}
.bg-cyan-100,
.hover\:bg-cyan-100:hover {
  background-color: #b2ebf2;
}
.bg-cyan-200,
.hover\:bg-cyan-200:hover {
  background-color: #80deea;
}
.bg-cyan-300,
.hover\:bg-cyan-300:hover {
  background-color: #4dd0e1;
}
.bg-cyan-400,
.hover\:bg-cyan-400:hover {
  background-color: #26c6da;
}
.bg-cyan-500,
.hover\:bg-cyan-500:hover {
  background-color: #00bcd4;
}
.bg-cyan-600,
.hover\:bg-cyan-600:hover {
  background-color: #00acc1;
}
.bg-cyan-700,
.hover\:bg-cyan-700:hover {
  background-color: #0097a7;
}
.bg-cyan-800,
.hover\:bg-cyan-800:hover {
  background-color: #00838f;
}
.bg-cyan-900,
.hover\:bg-cyan-900:hover {
  background-color: #006064;
}

.text-cyan-50,
.hover\:text-cyan-50:hover {
  color: #e0f7fa;
}
.text-cyan-100,
.hover\:text-cyan-100:hover {
  color: #b2ebf2;
}
.text-cyan-200,
.hover\:text-cyan-200:hover {
  color: #80deea;
}
.text-cyan-300,
.hover\:text-cyan-300:hover {
  color: #4dd0e1;
}
.text-cyan-400,
.hover\:text-cyan-400:hover {
  color: #26c6da;
}
.text-cyan-500,
.hover\:text-cyan-500:hover {
  color: #00bcd4;
}
.text-cyan-600,
.hover\:text-cyan-600:hover {
  color: #00acc1;
}
.text-cyan-700,
.hover\:text-cyan-700:hover {
  color: #0097a7;
}
.text-cyan-800,
.hover\:text-cyan-800:hover {
  color: #00838f;
}
.text-cyan-900,
.hover\:text-cyan-900:hover {
  color: #006064;
}

/* Custom blue-gray colors */
.bg-blue-gray-50,
.hover\:bg-blue-gray-50:hover {
  background-color: #eceff1;
}
.bg-blue-gray-100,
.hover\:bg-blue-gray-100:hover {
  background-color: #cfd8dc;
}
.bg-blue-gray-200,
.hover\:bg-blue-gray-200:hover {
  background-color: #b0bec5;
}
.bg-blue-gray-300,
.hover\:bg-blue-gray-300:hover {
  background-color: #90a4ae;
}
.bg-blue-gray-400,
.hover\:bg-blue-gray-400:hover {
  background-color: #78909c;
}
.bg-blue-gray-500,
.hover\:bg-blue-gray-500:hover {
  background-color: #607d8b;
}
.bg-blue-gray-600,
.hover\:bg-blue-gray-600:hover {
  background-color: #546e7a;
}
.bg-blue-gray-700,
.hover\:bg-blue-gray-700:hover {
  background-color: #455a64;
}
.bg-blue-gray-800,
.hover\:bg-blue-gray-800:hover {
  background-color: #37474f;
}
.bg-blue-gray-900,
.hover\:bg-blue-gray-900:hover {
  background-color: #263238;
}

.text-blue-gray-50,
.hover\:text-blue-gray-50:hover {
  color: #eceff1;
}
.text-blue-gray-100,
.hover\:text-blue-gray-100:hover {
  color: #cfd8dc;
}
.text-blue-gray-200,
.hover\:text-blue-gray-200:hover {
  color: #b0bec5;
}
.text-blue-gray-300,
.hover\:text-blue-gray-300:hover {
  color: #90a4ae;
}
.text-blue-gray-400,
.hover\:text-blue-gray-400:hover {
  color: #78909c;
}
.text-blue-gray-500,
.hover\:text-blue-gray-500:hover {
  color: #607d8b;
}
.text-blue-gray-600,
.hover\:text-blue-gray-600:hover {
  color: #546e7a;
}
.text-blue-gray-700,
.hover\:text-blue-gray-700:hover {
  color: #455a64;
}
.text-blue-gray-800,
.hover\:text-blue-gray-800:hover {
  color: #37474f;
}
.text-blue-gray-900,
.hover\:text-blue-gray-900:hover {
  color: #263238;
}

/* Glass effect for modals */
.glass {
  background-color: rgba(100, 120, 130, 0.6);
  backdrop-filter: blur(10px);
}

/* No wrap utility */
.nowrap {
  white-space: nowrap;
}

/* Receipt content max height */
#receipt-content {
  /* max-height: 70vh;
  overflow-y: scroll; */
}

/* ============================================================
   Print Styles - Unified for both printReceipt() and reprintOrder()
   ============================================================ */
@media print {
  /* Reset page */
  @page {
    size: 80mm auto;
    margin: 5mm;
  }

  html,
  body {
    margin: 0;
    padding: 0;
    background: white;
  }

  html {
    display: flex;
    margin: 0 auto;
    justify-content: center;
  }
  body {
    width: 100%;
  }

  /* Hide everything by default */
  body > * {
    display: none !important;
    visibility: hidden !important;
  }

  /* ONLY show print-area (where printReceipt() copies content) */
  #print-area {
    display: block !important;
    visibility: visible !important;
    position: relative !important;
    width: 80mm !important;
    max-width: 80mm !important;
    margin: 0 auto !important;
    padding: 0 !important;
    background: white !important;
    overflow: visible !important;
    max-height: none !important;
    height: auto !important;
    box-shadow: none !important;
    border: none !important;
  }

  /* Make print-area content visible */
  #print-area * {
    visibility: visible !important;
  }

  /* Hide modals, buttons, overlays */

  /* Prevent page breaks inside receipt */
  #print-area {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* Typography for print */
  .text-xs {
    font-size: 10px !important;
  }
  .text-sm {
    font-size: 12px !important;
  }
  .text-base {
    font-size: 14px !important;
  }
  .text-lg {
    font-size: 16px !important;
  }
  .text-xl {
    font-size: 18px !important;
  }

  /* Spacing */
  .mb-0 {
    margin-bottom: 0 !important;
  }
  .mb-1 {
    margin-bottom: 4px !important;
  }
  .mb-2 {
    margin-bottom: 8px !important;
  }
  .mb-3 {
    margin-bottom: 12px !important;
  }
  .my-1 {
    margin-top: 4px !important;
    margin-bottom: 4px !important;
  }
  .my-2 {
    margin-top: 8px !important;
    margin-bottom: 8px !important;
  }

  /* Layout */
  .flex {
    display: flex !important;
  }
  .justify-between {
    justify-content: space-between !important;
  }
  .text-center {
    text-align: center !important;
  }
  .text-right {
    text-align: right !important;
  }
  .text-left {
    text-align: left !important;
  }

  /* Colors - convert to black/gray for print */
  .font-bold {
    font-weight: bold !important;
  }
  .font-medium {
    font-weight: 500 !important;
  }
  .uppercase {
    text-transform: uppercase !important;
  }

  /* HR lines */
  hr,
  .border-dashed,
  .border-double {
    border-color: #000 !important;
    page-break-after: avoid;
    page-break-before: avoid;
  }

  /* Images */
  img {
    max-width: 100% !important;
    height: auto !important;
    page-break-inside: avoid;
  }
}

/* POS Main Container */
#pos-tailwind-app {
  font-family:
    "Inter",
    "Segoe UI",
    system-ui,
    -apple-system,
    sans-serif;
}

/* Product card hover animation */
.product-card {
  transition: all 0.2s ease;
}
.product-card:hover {
  transform: translateY(-2px);
}

/* Cart item animation */
.cart-item {
  animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Quantity button styles */
.qty-btn {
  transition: all 0.15s ease;
}
.qty-btn:active {
  transform: scale(0.95);
}

/* Submit button pulse when ready */
.submit-ready {
  animation: pulse 2s infinite;
}

/* @keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(0, 188, 212, 0.4);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(0, 188, 212, 0);
  }
} */

/* Modal backdrop */
.modal-backdrop {
  transition: opacity 0.2s ease;
}

/* Modal content animation */
.modal-content {
  transition: all 0.2s ease;
}

/* Money button grid */
.money-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

/* Loading spinner */
.spinner {
  border: 2px solid #f3f3f3;
  border-top: 2px solid #00bcd4;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Empty state styling */
.empty-state {
  opacity: 0.25;
  user-select: none;
}

.currently-in-tab-note {
  color: #ff7400;
}

/* Product grid responsive */
@media (max-width: 1200px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

@media (max-width: 900px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}
@media (max-width: 600px) {
  .product-grid {
    grid-template-columns: repeat(1, 1fr) !important;
  }
}
/* ============================================================
   Tablet Responsive Styles (< 1024px)
   ============================================================ */
@media (max-width: 1024px) {
  /* Cart panel adjustments */

  /* Search bar adjustments */

  /* Smaller product cards */
  .product-card {
    font-size: 0.875rem;
  }

  /* Lot select button */
  .lot-select-btn {
    width: 28px;
    height: 28px;
  }

  .text-sm {
    font-size: 0.75rem !important;
  }

  .text-xs {
    font-size: 0.65rem !important;
  }

  .text-lg {
    font-size: 0.875rem !important;
  }

  /* Product image in cart smaller */
  img.w-14 {
    width: 2.5rem !important;
    height: 2.5rem !important;
  }

  /* Payment section smaller */

  /* Smaller gaps */

  /* Hide sidebar by default on mobile */
  #pos-tailwind-app .sidebar-panel {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 50;
    height: 100vh;
    overflow-y: auto;
    position: absolute;
  }

  #pos-tailwind-app .sidebar-panel.open {
    transform: translateX(0);
  }
}

div[x-text="product.name"],
.lot-modal-product-name {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  margin-bottom: 8px;
}

@media (min-width: 1025px) {
  .payment-section {
    background-color: #fff;
    border-radius: 6px;
  }
}

@media (max-width: 1024px) {
  #pos-tailwind-app {
    flex-direction: column;
  }

  .p-4 {
    padding: 0.5rem !important;
  }

  /*
   * ─── LUẬT NÀY NHẮM THẲNG VÀO THẺ button, KHÔNG QUA CLASS ─────────────────
   *
   * Nên nó thắng mọi class đơn: `.m-btn { min-height: 52px }` viết sau vẫn bị
   * gạch, vì `button:not(.w-6):not(.w-5)` có độ ưu tiên cao hơn. Luồng màn
   * chạm bản 2 dựng lại toàn bộ cỡ nút theo bản thiết kế nên phải đứng ngoài.
   *
   * Loại trừ bằng class ở <body> (TGS_POS_Mobile_V2::body_class()). Các trang
   * còn lại không mang class đó nên không đổi một pixel nào.
   */
  body:not(.pos-theme-mobile-v2) button:not(.w-6):not(.w-5),
  body:not(.pos-theme-mobile-v2) .btn {
    min-height: 20px;
  }

  .product-card p {
    font-size: 0.75rem;
  }

  .modal-content {
    max-height: 90vh;
    margin: 1rem;
  }

  .lot-item {
    padding: 0.75rem;
    min-height: 50px;
  }
}

/* ============================================================
   Small Mobile Styles (< 480px)
   ============================================================ */
@media (max-width: 480px) {
  .cart-item img {
    width: 40px;
    height: 40px;
  }

  .qty-btn {
    width: 28px;
    height: 28px;
  }
}

/* ============================================================
   Touch-friendly enhancements
   ============================================================ */
@media (pointer: coarse) {
  .product-card {
    cursor: pointer;
  }

  .lot-select-btn {
    width: 36px;
    height: 36px;
  }

  .product-card:hover {
    transform: none;
  }

  .modal-close-btn {
    width: 44px;
    height: 44px;
  }
}

/* ============================================================
   Landscape mobile adjustments
   ============================================================ */
@media (max-height: 500px) and (orientation: landscape) {

  .modal-content {
    max-height: 85vh;
  }
}

/* ============================================================
   Print styles - hide mobile elements
   ============================================================ */
/* @media (min-width: 1401px) and (max-width: 1920px) {
  .lg\:grid-cols-3 {
    grid-template-columns: repeat(1, 1fr) !important;
  }
}

@media (max-width: 1400px) {
  .lg\:grid-cols-3 {
    grid-template-columns: repeat(1, 1fr) !important;
  }
} */

@media (max-width: 1024px) {
  .lg\:hidden {
    display: block;
  }
}

.showConfirmModal {
  z-index: 999;
}

@media (max-width: 1024px) {
  .text-sm {
    font-size: 0.7rem;
  }
  .product-image {
    width: 50px;
    height: 50px;
    object-fit: contain;
  }

  .px-6 {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }

  .py-2 {
    padding-top: 0.25rem !important;
    padding-bottom: 0.25rem !important;
  }

  .gap-3 {
    gap: 0.5rem !important;
  }
  .p-2\.5 {
    padding: 0.5rem !important;
  }
}
/* ============================================================
   Tablet Responsive Styles (< 1025px)
   ============================================================ */
@media (max-width: 1024px) {
  /* Hide scanner in search bar on tablet/mobile */
  .scanner-desktop-only {
    display: none !important;
  }

  ::-webkit-scrollbar {
    width: 0 !important;
  }
}

@media (max-width: 1024px) {
  .py-4 {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
  }

  .p-3 {
    padding: 0.5rem !important;
  }

  .text-sm {
    font-size: 16px !important;
  }

  .text-xs {
    font-size: 16px !important;
  }

  .text-lg {
    font-size: 16px !important;
  }

  .text-xs {
    font-size: 14px !important;
    line-height: 1.25 !important;
  }

  .text-base {
    font-size: 16px !important;
  }

  .lg\:grid-cols-3 {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .customer-search-container input {
    font-size: 16px !important;
    height: 48px !important;
  }
  .customer-search-container > button {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
  }

  @media (max-width: 1024px) and (min-width: 768px) {
    .h-4.w-4 {
      width: 30px !important;
      height: 30px !important;
    }

    .h-6.w-6 {
      width: 39px !important;
      height: 39px !important;
    }
  }

}

@media (max-width: 1024px) {

  .lot-modal-close svg {
    width: 16px;
  }

  .lot-modal-product-name {
    font-size: 16px;
  }

  .pt-3 {
    padding-top: 0.5rem !important;
  }

  .p-6 {
    padding: 0.75rem !important;
  }

  .rounded-2xl,
  .rounded-xl,
  .rounded-lg,
  .rounded-md {
    border-radius: 4px !important;
  }

  input[type="checkbox"] {
    width: 16px;
    height: 16px;
  }

  .lot-modal-barcode {
    font-size: 16px;
    margin-bottom: 6px;
  }
  div[x-show="showQuantityModal"] button,
  div[x-show="showCloseTabModal"] button,
  div[x-show="showConfirmModal"] button,
  div[x-show="showReceiptModal"] button,
  div[x-show="showQRModal"] button {
    padding: 6px !important;
  }

  div[x-show="showConfirmModal"] h3 {
    font-size: 14px !important;
  }

  div[x-show="showConfirmModal"] p {
    font-size: 12px !important;
  }

  div[x-show="getCurrentTab().cart.length > 0"] img.object-cover {
    width: 50px;
    height: 50px;
  }

  /* Show category button on mobile/tablet */
  .cate-big {
    padding-block: 0 !important;
    margin-top: 6px !important;
  }
  .cate-child {
    padding: 0 !important;
    padding-left: 12px !important;
  }
  .cart-payment-block {
  }

  div[x-show="showLotSelectionModal"] {
    padding: 0 !important;
    align-items: flex-end !important;
  }

  div[x-show="showLotSelectionModal"] .rounded-2xl {
    border-radius: 0 !important;
  }

  div[x-show="showLotSelectionModal"] .max-h-72 {
    max-height: 50vh !important;
  }

  .checkout-section {
    z-index: 11;
    /* position: absolute; */
    bottom: 0;
    left: 0;
    right: 0;
  }

  p[x-text="formatPrice(item.price)"] {
    font-size: 13px !important;
  }

  /* Two-Step Checkout Flow */

  img.w-14,
  img.w-12 {
    width: 60px !important;
    height: 60px !important;
    object-fit: contain;
  }
}

@media (max-width: 767px) {
  * {
    font-size: 13px;
  }
  .text-sm {
    font-size: 13px !important;
  }

  .text-xs {
    font-size: 13px !important;
    line-height: 1.25 !important;
  }

  .text-lg {
    font-size: 13px !important;
  }

  .text-base {
    font-size: 13px !important;
  }
  .lg\:grid-cols-3 {
    grid-template-columns: repeat(1, 1fr) !important;
  }

  .customer-search-container input {
    font-size: 13px !important;
    height: 40px !important;
  }
  .lot-modal-product-name {
    font-size: 13px;
  }
  .lot-modal-barcode {
    font-size: 13px;
    margin-bottom: 6px;
  }
  .customer-search-container > button {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
  }
}

#receipt-content hr {
  border: 0;
  border-top: 1px dashed #9ca3af;
}

/* ============================================================
   Category Tree - Modern Styles
   ============================================================ */

/* Active category node - pill style with gradient */

/* Depth indicators using left border */
.cat-tree-node.cat-depth-0 {
  border-left: 3px solid var(--pos-accent);
  border-radius: 0 8px 8px 0;
}
.cat-tree-node.cat-depth-1 {
  border-left: 2px solid #67e8f9;
}
.cat-tree-node.cat-depth-2 {
  border-left: 2px solid #cffafe;
}
.cat-tree-node.cat-depth-3 {
  border-left: 1px solid #e5e7eb;
}

/* Hover effect - subtle lift */

/* Product count badge */

/* Slide animation for children (expand/collapse) */
.category-tree .cat-tree-node {
  animation: catSlideIn 0.2s ease-out;
}

@keyframes catSlideIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Toggle button animation */
.cat-toggle {
  transition:
    background-color 0.15s,
    transform 0.15s;
}
.cat-toggle:active {
  transform: scale(0.9);
}

/* ============================================================
   Category Slide Navigation
   ============================================================ */

/* Slide container - clips overflow */

/* Slide panel */

/* Slide in from right (drilling into children) */

/* Slide in from left (going back to parent) */

@keyframes catSlideFromRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes catSlideFromLeft {
  from {
    opacity: 0;
    transform: translateX(-100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Slide item styles */

/* Back button */

/* ============================================================
   Laptop desktop adjustments (1366x768 class screens)
   ============================================================ */
/* Large desktop: cart panel wider */

@media (min-width: 1025px) and (max-width: 1440px) {

  #pos-tailwind-app .lg\:grid-cols-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* === Tracking incomplete warning styles === */

nav .py-3 {
  padding-top: 0.75rem !important;
  padding-bottom: 0.75rem !important;
}

nav .px-3 {
  padding-left: 0.75rem !important;
  padding-right: 0.75rem !important;
}

#tgs-pos-cache-reset-btn {
  display: none !important;
}

