/* ==========================================================================
   OpenSourcePOS Modern UI / UX Design System (Square & Shopify POS Inspired)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Color Palette - Modern Slate & Indigo */
  --color-primary: #4f46e5;
  --color-primary-hover: #4338ca;
  --color-primary-light: #eef2ff;
  --color-primary-dark: #3730a3;
  
  --color-success: #10b981;
  --color-success-hover: #059669;
  --color-success-light: #ecfdf5;

  --color-warning: #f59e0b;
  --color-warning-light: #fffbeb;

  --color-danger: #ef4444;
  --color-danger-hover: #dc2626;
  --color-danger-light: #fef2f2;

  --color-dark: #0f172a;
  --color-slate-900: #0f172a;
  --color-slate-800: #1e293b;
  --color-slate-700: #334155;
  --color-slate-600: #475569;
  --color-slate-500: #64748b;
  --color-slate-400: #94a3b8;
  --color-slate-300: #cbd5e1;
  --color-slate-200: #e2e8f0;
  --color-slate-100: #f1f5f9;
  --color-slate-50: #f8fafc;
  --color-white: #ffffff;

  /* Surface & Shadows */
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-sidebar: #0f172a;
  --border-color: #e2e8f0;

  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;
}

/* Base Styling */
body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--color-slate-800);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* App Shell Layout */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Modern Sidebar */
.app-sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  color: var(--color-white);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
  box-shadow: 4px 0 24px 0 rgba(0, 0, 0, 0.08);
}

.sidebar-header {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--color-primary), #818cf8);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 20px;
  color: #fff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.sidebar-brand-text {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.3px;
  color: #ffffff;
  line-height: 1.2;
}

.sidebar-brand-sub {
  font-size: 11px;
  color: var(--color-slate-400);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-title {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--color-slate-500);
  padding: 12px 12px 6px 12px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--color-slate-300);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.sidebar-link:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  transform: translateX(3px);
}

.sidebar-link.active {
  background: linear-gradient(135deg, var(--color-primary), #6366f1);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
}

.sidebar-link-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
}

.sidebar-link.active .sidebar-link-icon {
  opacity: 1;
}

.sidebar-user {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: rgba(0, 0, 0, 0.2);
}

.sidebar-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 11px;
  color: var(--color-slate-400);
}

/* Main Content Wrapper */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-x: hidden;
}

/* Top App Header */
.app-topbar {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
  backdrop-filter: blur(8px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-clock {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-slate-600);
  background: var(--color-slate-100);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 8px;
}

.clock-dot {
  width: 8px;
  height: 8px;
  background-color: var(--color-success);
  border-radius: var(--radius-full);
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-badge {
  background-color: var(--color-success-light);
  color: var(--color-success-hover);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Main Content Body */
.app-content {
  padding: 28px;
  flex: 1;
}

/* Modern Card Containers */
.pos-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  overflow: hidden;
}

.pos-card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-surface);
}

.pos-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-slate-900);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pos-card-body {
  padding: 24px;
}

/* Modern Metric Stats Cards */
.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 22px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.metric-icon-box {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.metric-icon-indigo { background: var(--color-primary-light); color: var(--color-primary); }
.metric-icon-emerald { background: var(--color-success-light); color: var(--color-success); }
.metric-icon-amber { background: var(--color-warning-light); color: var(--color-warning); }
.metric-icon-rose { background: var(--color-danger-light); color: var(--color-danger); }

.metric-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-slate-500);
  margin-bottom: 4px;
}

.metric-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--color-slate-900);
  letter-spacing: -0.5px;
}

/* ==========================================================================
   FLAGSHIP POS REGISTER UI (Square / Shopify POS Style)
   ========================================================================== */
.pos-register-layout {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1024px) {
  .pos-register-layout {
    grid-template-columns: 1fr;
  }
}

/* Product Search Bar */
.pos-search-wrapper {
  position: relative;
  margin-bottom: 20px;
}

.pos-search-input {
  width: 100%;
  height: 56px;
  padding: 12px 20px 12px 52px;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-slate-900);
  background-color: var(--bg-surface);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.pos-search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}

.pos-search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-slate-400);
  font-size: 20px;
  pointer-events: none;
}

/* Live Cart Table */
.cart-table-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.cart-table {
  width: 100%;
  border-collapse: collapse;
}

.cart-table th {
  background-color: var(--color-slate-50);
  padding: 14px 18px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--color-slate-500);
  border-bottom: 1px solid var(--border-color);
}

.cart-table td {
  padding: 16px 18px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
}

.cart-table tr:last-child td {
  border-bottom: none;
}

.cart-table tr:hover {
  background-color: rgba(248, 250, 252, 0.8);
}

.item-name-cell {
  font-weight: 700;
  color: var(--color-slate-900);
  font-size: 15px;
}

.item-sku-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--color-slate-100);
  color: var(--color-slate-600);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  display: inline-block;
  margin-top: 4px;
}

/* Quantity Control Steppers */
.qty-stepper {
  display: inline-flex;
  align-items: center;
  background: var(--color-slate-100);
  border: 1px solid var(--color-slate-200);
  border-radius: var(--radius-lg);
  padding: 2px;
}

.qty-stepper input {
  width: 48px;
  text-align: center;
  border: none;
  background: transparent;
  font-weight: 700;
  font-size: 14px;
  color: var(--color-slate-900);
}

.qty-stepper input:focus {
  outline: none;
}

/* Modern Right Checkout Ticket Drawer */
.pos-ticket-drawer {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 90px;
}

.customer-selector-card {
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.customer-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-primary), #818cf8);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

/* Totals Breakdown */
.summary-line {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
  color: var(--color-slate-600);
  font-weight: 500;
}

.summary-total-box {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  color: #ffffff;
  padding: 20px;
  border-radius: var(--radius-lg);
  margin: 18px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25);
}

.summary-total-label {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-slate-300);
}

.summary-total-amount {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.8px;
  color: #10b981;
}

/* Fast Payment Methods Buttons */
.payment-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.payment-btn {
  padding: 12px;
  background: var(--color-slate-100);
  border: 1px solid var(--color-slate-200);
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 13px;
  color: var(--color-slate-700);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.payment-btn:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.payment-btn.active {
  background: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

/* Main Checkout Action Button */
.btn-charge {
  width: 100%;
  padding: 18px;
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
  background: linear-gradient(135deg, #10b981, #059669);
  border: none;
  border-radius: var(--radius-xl);
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-charge:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.5);
  background: linear-gradient(135deg, #059669, #047857);
}

.btn-charge:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Modern Modal Dialogs */
.modal-content {
  border: none;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface);
}

.modal-title {
  font-weight: 800;
  font-size: 18px;
  color: var(--color-slate-900);
}

.modal-body {
  padding: 24px;
  background: var(--bg-surface);
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background: var(--color-slate-50);
}

/* Form Controls */
.form-control, .form-select {
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-slate-800);
  transition: all 0.15s ease;
}

.form-control:focus, .form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
  outline: none;
}

/* Buttons */
.btn-modern-primary {
  background: linear-gradient(135deg, var(--color-primary), #4338ca);
  color: #fff;
  border: none;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 14px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
  transition: all 0.15s ease;
}

.btn-modern-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
  color: #fff;
}

.btn-modern-secondary {
  background: var(--color-slate-100);
  color: var(--color-slate-700);
  border: 1px solid var(--color-slate-200);
  padding: 10px 18px;
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
}

.btn-modern-secondary:hover {
  background: var(--color-slate-200);
  color: var(--color-slate-900);
}
