/* ==========================================================================
   TuBox-POS Professional Desktop Cashier Interface
   Designed for EdalanGarch - Matches Reference Desktop POS
   ========================================================================== */

.tubox-pos-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  background-color: #f1f3f4;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #1f2937;
  overflow: hidden;
  position: fixed;
  inset: 0;
  z-index: 10;
}

/* 1. Top POS Header Bar */
.tubox-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 1rem;
  background: #2b2b2b;
  color: #ffffff;
  font-size: 0.82rem;
  border-bottom: 1px solid #1a1a1a;
}

.tubox-brand-tag {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
}

.tubox-brand-tag span.badge-name {
  color: #f59e0b;
  font-size: 1rem;
}

.tubox-status-indicators {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: #cbd5e1;
}

.badge-selling-local {
  background: #15803d;
  color: #ffffff;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.badge-selling-local .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
}

/* 2. Top Scanner & Search Bar */
.tubox-search-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  align-items: center;
}

.tubox-scanner-input {
  flex: 1;
  padding: 0.65rem 1rem;
  font-size: 1.05rem;
  font-weight: 700;
  border: 2.5px solid #f59e0b; /* Yellow/Orange highlight border as in image */
  border-radius: 8px;
  outline: none;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.tubox-scanner-input:focus {
  border-color: #d97706;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
}

.tubox-customer-input {
  width: 280px;
  padding: 0.65rem 0.85rem;
  font-size: 0.88rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  outline: none;
}

.tubox-btn-reprint {
  padding: 0.65rem 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  font-size: 0.85rem;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tubox-btn-reprint:hover {
  background: #e2e8f0;
}

/* 3. Center POS Work Area (Split Table + Keypad) */
.tubox-main-work-area {
  display: grid;
  grid-template-columns: 1fr 340px;
  flex: 1;
  overflow: hidden;
  background: #ffffff;
}

/* Left Table Panel */
.tubox-table-panel {
  display: flex;
  flex-direction: column;
  border-right: 2px solid #e2e8f0;
  overflow: hidden;
  background: #ffffff;
}

.tubox-table-header {
  display: grid;
  grid-template-columns: 40px 1fr 100px 100px 110px 40px;
  padding: 0.6rem 1rem;
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
  font-size: 0.82rem;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
}

.tubox-table-items {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.tubox-item-row {
  display: grid;
  grid-template-columns: 40px 1fr 100px 100px 110px 40px;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.9rem;
  font-weight: 600;
  align-items: center;
  transition: background 0.15s ease;
}

.tubox-item-row:hover {
  background: #f8fafc;
}

.tubox-item-row.selected {
  background: #fef3c7;
}

.tubox-item-row input.qty-field {
  width: 60px;
  padding: 0.25rem;
  text-align: center;
  font-weight: 800;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
}

.tubox-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #94a3b8;
  text-align: center;
  padding: 2rem;
}

.tubox-empty-state h3 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #64748b;
  margin-bottom: 0.25rem;
}

/* Bottom Totals & Owner Private Margin Panel (Inverted: Left = Owner Confidential, Right = Client Totals) */
.tubox-bottom-totals-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 0.75rem 1.25rem;
  background: #fafafa;
  border-top: 2px solid #e2e8f0;
  align-items: center;
  gap: 1.5rem;
}

.tubox-owner-private-box {
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  font-size: 0.82rem;
  color: #64748b;
}

.tubox-owner-private-box .title {
  font-weight: 800;
  color: #b45309;
  font-size: 0.7rem;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
  display: block;
  letter-spacing: 0.5px;
}

.tubox-owner-metrics-rows {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem 0.85rem;
}

.tubox-owner-metrics-rows .metric-line {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: #475569;
}

.tubox-owner-metrics-rows .metric-line strong {
  color: #0f172a;
}

.tubox-client-totals {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.88rem;
  color: #475569;
  text-align: right;
  align-items: flex-end;
}

.tubox-client-totals .tot-line {
  font-size: 0.88rem;
}

.tubox-client-totals .grand-total-row {
  font-size: 1.6rem;
  font-weight: 900;
  color: #0f172a;
  margin-top: 0.2rem;
}

/* Right Keypad Panel (Buttons layout matching reference screenshot) */
.tubox-keypad-panel {
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  padding: 0.6rem;
  gap: 0.5rem;
  overflow-y: auto;
}

.tubox-btn-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
}

.tubox-btn-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.tubox-action-btn {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.55rem 0.35rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  min-height: 54px;
}

.tubox-action-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.tubox-action-btn:active {
  transform: translateY(1px);
}

.tubox-action-btn .shortcut {
  font-size: 0.65rem;
  color: #64748b;
  font-weight: 600;
}

.tubox-action-btn .icon {
  font-size: 1.1rem;
  margin-bottom: 0.1rem;
}

/* Specific button colors from reference */
.btn-tubox-cobrar {
  background: #bbf7d0 !important; /* Light green in screenshot */
  border-color: #86efac !important;
  color: #14532d !important;
  font-size: 1.05rem !important;
  font-weight: 900 !important;
  grid-row: span 2;
  min-height: 110px !important;
}

.btn-tubox-cobrar:hover {
  background: #86efac !important;
}

.btn-tubox-anular {
  background: #fecaca !important; /* Light red/pink in screenshot */
  border-color: #fca5a5 !important;
  color: #7f1d1d !important;
  font-weight: 900 !important;
}

.btn-tubox-anular:hover {
  background: #fca5a5 !important;
}

/* 4. Bottom Footer & Shortcuts Bar */
.tubox-bottom-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 1rem;
  background: #e2e8f0;
  border-top: 1px solid #cbd5e1;
  font-size: 0.75rem;
  color: #475569;
}

.tubox-shortcuts-legend {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tubox-btn-menu {
  background: #0f172a;
  color: #ffffff;
  border: none;
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  font-weight: 800;
  font-size: 0.8rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: background 0.15s ease;
}

.tubox-btn-menu:hover {
  background: #dc2626;
}

/* ==================== DRAWER MENU / ADMIN SUITE MODAL ==================== */
.admin-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  justify-content: flex-end;
  animation: fadeIn 0.2s ease;
}

.admin-drawer-sidebar {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  height: 100vh;
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 25px rgba(0,0,0,0.3);
  animation: slideInRight 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.admin-drawer-header {
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
  color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid #dc2626;
}

.admin-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.admin-menu-item-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  text-decoration: none;
  color: #1e293b;
  transition: all 0.2s ease;
  cursor: pointer;
}

.admin-menu-item-card:hover {
  border-color: #dc2626;
  background: #fef2f2;
  transform: translateX(4px);
}

.admin-menu-item-card .icon-box {
  font-size: 1.8rem;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-menu-item-card .text-box h4 {
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 0.1rem;
}

.admin-menu-item-card .text-box p {
  font-size: 0.78rem;
  color: #64748b;
}

/* Fast Cash Modal */
.modal-cash-payment {
  max-width: 420px;
  text-align: center;
}

.modal-cash-input {
  font-size: 2rem;
  font-weight: 900;
  text-align: center;
  width: 100%;
  padding: 0.75rem;
  border: 3px solid #16a34a;
  border-radius: 12px;
  margin: 1rem 0;
  box-sizing: border-box;
  outline: none;
}

/* ==================== STRICT TAB PANE ISOLATION & TABS BAR ==================== */
.tab-pane {
  display: none !important;
}

.tab-pane.active {
  display: block !important;
  animation: tabFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.admin-tabs-bar {
  display: flex;
  gap: 0.5rem;
  background: #f1f5f9;
  padding: 0.6rem 1.25rem;
  border-bottom: 2px solid #cbd5e1;
  overflow-x: auto;
  white-space: nowrap;
}

.admin-tabs-bar::-webkit-scrollbar {
  height: 5px;
}

.admin-tabs-bar::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.tab-btn {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: #475569;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
  user-select: none;
  flex-shrink: 0;
}

.tab-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: #0f172a;
}

.tab-btn.active {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
  color: #ffffff !important;
  border-color: #991b1b !important;
  box-shadow: 0 4px 10px rgba(220, 38, 38, 0.35);
  font-weight: 800;
}

/* Sub-tabs inside Cargar Productos */
.sub-tabs-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.75rem;
}

.sub-tab-btn {
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sub-tab-btn:hover {
  background: #f1f5f9;
}

.sub-tab-btn.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0369a1 !important;
  box-shadow: 0 3px 8px rgba(2, 132, 199, 0.3);
}

/* ==================== LOGIN KEYPAD STYLING ==================== */
.login-keypad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 1rem;
}

.keypad-num-btn {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 1.25rem;
  font-weight: 800;
  color: #1e293b;
  padding: 0.65rem 0.5rem;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.keypad-num-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.keypad-num-btn:active {
  transform: translateY(1px);
}

/* ==================== POS LIVE SEARCH DROPDOWN ==================== */
.pos-search-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 2.5px solid #f59e0b;
  border-radius: 10px;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.35);
  z-index: 2000;
  max-height: 420px;
  overflow-y: auto;
  animation: fadeIn 0.15s ease-out;
}

.pos-search-dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1rem;
  background: #1e1b4b;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.pos-search-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.15s ease;
  background: #ffffff;
  color: #1e293b;
}

.pos-search-dropdown-item:hover,
.pos-search-dropdown-item.selected {
  background: #fef3c7;
  padding-left: 1.25rem;
}

.pos-search-item-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.pos-search-thumb {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
  overflow: hidden;
}

.pos-search-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pos-search-item-name {
  font-size: 0.92rem;
  font-weight: 800;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pos-search-item-meta {
  font-size: 0.75rem;
  color: #64748b;
}

.pos-search-item-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.pos-search-stock-badge {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
}

.pos-stock-ok {
  background: #dcfce7;
  color: #15803d;
}

.pos-stock-low {
  background: #fef3c7;
  color: #b45309;
}

.pos-stock-out {
  background: #fee2e2;
  color: #dc2626;
}

.pos-search-price {
  font-size: 1.1rem;
  font-weight: 900;
  color: #15803d;
}

.btn-pos-add-search {
  background: #15803d;
  color: #ffffff;
  border: none;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-weight: 800;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-pos-add-search:hover {
  background: #166534;
}
