
/* Strict Single Viewport Constraints & Clean Auto-Fit */
:root {
  /* Zofia POS Cafe Theme Palette */
  --zofia-canvas: #FFF2E9;
  --zofia-espresso: #4F3322;
  --zofia-espresso-dark: #3B2416;
  --zofia-espresso-muted: #7C5C43;
  --zofia-honey: #E5A93C;
  --zofia-cream: #FFF2E9;
  --zofia-card-bg: #FFFFFF;
  --zofia-input-bg: #FDF8F4;
  --zofia-border: rgba(79, 51, 34, 0.12);

  /* Superuser Midnight Obsidian Theme Palette */
  --su-canvas: #0B111E;
  --su-card-bg: #111C2E;
  --su-card-hover: #162238;
  --su-input-bg: #090E17;
  --su-text-primary: #FFFFFF;
  --su-text-secondary: #94A3B8;
  --su-text-muted: #64748B;
  --su-border: rgba(255, 255, 255, 0.10);
  --su-border-focus: #10B981;
  --su-emerald: #10B981;
  --su-amber: #F59E0B;
  --su-rose: #FB7185;
  --su-cyan: #00E5FF;
}

html, body {
  height: 100%;
  width: 100%;
  max-width: 100vw;
  margin: 0;
  padding: 0;
  overflow: hidden !important;
  box-sizing: border-box;
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  -khtml-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
  -webkit-tap-highlight-color: transparent !important;
  touch-action: manipulation;
}

/* Allow text selection only inside actual input and textarea fields */
input, textarea {
  -webkit-user-select: auto !important;
  -moz-user-select: auto !important;
  -ms-user-select: auto !important;
  user-select: auto !important;
}

*, *::before, *::after {
  box-sizing: border-box;
}

#root {
  height: 100%;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  position: relative;
}

/* Elegant Custom Scrollbar for all scrollable containers */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(79, 51, 34, 0.06);
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb {
  background: rgba(124, 92, 67, 0.45);
  border-radius: 9999px;
  border: 1.5px solid rgba(255, 255, 255, 0.5);
}

::-webkit-scrollbar-thumb:hover {
  background: #E5A93C;
}

/* Firefox standard scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(124, 92, 67, 0.45) rgba(79, 51, 34, 0.06);
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Superuser Component Utilities */
.superuser-view {
  background-color: var(--su-canvas);
  color: var(--su-text-primary);
}

.superuser-card {
  background-color: var(--su-card-bg);
  border: 1px solid var(--su-border);
  border-radius: 1.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
}

.superuser-input {
  background-color: var(--su-input-bg);
  color: var(--su-text-primary);
  border: 1px solid var(--su-border);
  border-radius: 0.75rem;
  transition: all 0.2s ease;
}

.superuser-input:focus {
  border-color: var(--su-emerald);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
  outline: none;
}

/* ZOFIA CAFE - Modern POS Design System & Aesthetics */

@keyframes pulseGlow {
  0%, 100% { opacity: 0.35; transform: scale(1); }
  50% { opacity: 0.65; transform: scale(1.08); }
}

.aurora-orb-1 {
  position: absolute;
  top: -10%;
  right: -5%;
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, rgba(229, 169, 60, 0.15) 0%, rgba(79, 51, 34, 0) 70%);
  filter: blur(50px);
  animation: pulseGlow 12s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}

.aurora-orb-2 {
  position: absolute;
  bottom: -10%;
  left: -5%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(249, 235, 224, 0.08) 0%, rgba(79, 51, 34, 0) 70%);
  filter: blur(60px);
  animation: pulseGlow 14s ease-in-out infinite alternate-reverse;
  pointer-events: none;
  z-index: 0;
}

.glass-panel {
  background: #FFFFFF;
  border: 1px solid rgba(79, 51, 34, 0.12);
  box-shadow: 0 4px 20px -2px rgba(79, 51, 34, 0.06);
}

.glass-card {
  background: #FFFFFF;
  border: 1px solid rgba(79, 51, 34, 0.12);
  box-shadow: 0 2px 10px rgba(79, 51, 34, 0.04);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-card:hover {
  border-color: #4F3322;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(79, 51, 34, 0.1);
}

.glass-input {
  background: #FDF8F4;
  border: 1px solid rgba(79, 51, 34, 0.15);
  color: #4F3322;
  transition: all 0.2s ease;
}

.glass-input:focus {
  border-color: #4F3322;
  background: #FFFFFF;
  box-shadow: 0 0 0 2px rgba(79, 51, 34, 0.15);
}

/* Fix for Dark Mode / Superuser / Analytics Selects & Options */
select option {
  background-color: #0F172A !important;
  color: #F8FAFC !important;
  padding: 8px 12px;
}

select option:hover,
select option:focus,
select option:checked {
  background-color: #1E293B !important;
  color: #F59E0B !important;
}

/* Superuser dark mode inputs override */
.bg-\[\#0B111E\] select,
.bg-\[\#0B111E\] select option,
.bg-\[\#0B111E\] input,
.bg-\[\#111C2E\] select,
.bg-\[\#111C2E\] select option,
.bg-\[\#111C2E\] input,
.bg-\[\#090E17\] select,
.bg-\[\#090E17\] select option,
.bg-\[\#090E17\] input,
select.bg-\[\#090E17\],
select.bg-\[\#4A2D1B\],
.superuser-view select,
.superuser-view select option {
  background-color: #090E17 !important;
  color: #FFFFFF !important;
  color-scheme: dark;
}

.bg-\[\#0B111E\] select:focus,
.bg-\[\#111C2E\] select:focus,
.bg-\[\#090E17\] select:focus,
select.bg-\[\#090E17\]:focus,
.bg-\[\#0B111E\] input:focus,
.bg-\[\#111C2E\] input:focus,
.bg-\[\#090E17\] input:focus {
  background-color: #0F172A !important;
  color: #FFFFFF !important;
  border-color: #E5A93C !important;
  box-shadow: 0 0 0 2px rgba(229, 169, 60, 0.3) !important;
  outline: none !important;
}

select.bg-\[\#4A2D1B\],
select.bg-\[\#4A2D1B\] option {
  background-color: #4A2D1B !important;
  color: #FFFFFF !important;
}

.btn-3d-cat {
  background: #FFFFFF;
  border: 1px solid rgba(79, 51, 34, 0.12);
  color: #4F3322;
  box-shadow: 0 2px 4px rgba(79, 51, 34, 0.04);
  transition: all 0.15s ease;
}

.btn-3d-cat:hover {
  background: #FDF8F4;
  border-color: #4F3322;
  transform: translateX(-2px);
}

.btn-3d-cat.active {
  background: #4F3322 !important;
  border-color: #4F3322 !important;
  color: #FFF2E9 !important;
  box-shadow: 0 4px 12px rgba(79, 51, 34, 0.25) !important;
}

.btn-3d-pay {
  background: linear-gradient(135deg, #4F3322 0%, #3B2416 100%);
  border: 1px solid rgba(229, 169, 60, 0.3);
  color: #FFF2E9;
  box-shadow: 0 4px 15px rgba(79, 51, 34, 0.3);
  transition: all 0.15s ease;
}

.btn-3d-pay:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79, 51, 34, 0.4);
}

.btn-3d-pay:active {
  transform: translateY(1px);
}

.btn-3d-mini {
  transition: all 0.12s ease;
}

.btn-3d-mini:active {
  transform: translateY(1px);
}

.keypad-btn {
  background: #FFFFFF;
  border: 1px solid rgba(79, 51, 34, 0.15);
  color: #4F3322;
  box-shadow: 0 2px 6px rgba(79, 51, 34, 0.05);
  transition: all 0.1s ease;
}

.keypad-btn:hover {
  background: #FDF8F4;
  border-color: #4F3322;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 51, 34, 0.12);
}

.keypad-btn:active {
  transform: translateY(2px);
}

/* Multi-line Title Clamp & Responsive Typography */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}

.product-card-title {
  min-height: 2.5rem;
  line-height: 1.25rem;
}

/* Accessible Status Badges */
.badge-in-stock {
  background: rgba(16, 185, 129, 0.12);
  color: #065F46;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-low-stock {
  background: rgba(245, 158, 11, 0.15);
  color: #92400E;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge-out-of-stock {
  background: rgba(244, 63, 94, 0.12);
  color: #9F1239;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

/* Accessible Disabled Button State */
button:disabled, .btn-disabled {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  filter: grayscale(40%);
  pointer-events: none;
}

/* RTL Number Isolation */
.rtl-num {
  direction: ltr;
  display: inline-block;
}

/* =========================================================================
   Print Styles for 80mm/58mm POS Thermal Printers
   Removes Browser Headers & Footers, Sets Exact Thermal Roll Dimensions
   ========================================================================= */
@page {
  size: 80mm auto;
  margin: 0mm !important;
}

@media print {
  @page {
    size: 80mm auto;
    margin: 0mm !important;
  }

  *, *:before, *:after {
    box-sizing: border-box !important;
  }

  /* 1. Default Thermal Receipts Mode (80mm Roll) */
  body:not(.is-printing-standee) {
    width: 80mm !important;
    max-width: 80mm !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11.5px !important;
    line-height: 1.25 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    overflow: visible !important;
  }

  body:not(.is-printing-standee) * {
    visibility: hidden !important;
  }

  body:not(.is-printing-standee) #printable-receipt,
  body:not(.is-printing-standee) #printable-receipt *,
  body:not(.is-printing-standee) #printable-zreport,
  body:not(.is-printing-standee) #printable-zreport *,
  body:not(.is-printing-standee) #printable-kot,
  body:not(.is-printing-standee) #printable-kot * {
    visibility: visible !important;
  }

  #printable-receipt,
  #printable-zreport,
  #printable-kot {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 78mm !important;
    max-width: 78mm !important;
    margin: 0 auto !important;
    padding: 3mm 2.5mm !important;
    color: #000000 !important;
    background: #ffffff !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    page-break-after: avoid !important;
    page-break-inside: avoid !important;
    overflow: visible !important;
  }

  /* 2. QR Table Standee Print Mode (Centered High-Quality Card) */
  body.is-printing-standee {
    width: 100vw !important;
    max-width: 100% !important;
    min-height: 100vh !important;
    margin: 0 !important;
    padding: 20px !important;
    background: #ffffff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    overflow: visible !important;
  }

  body.is-printing-standee * {
    visibility: hidden !important;
  }

  body.is-printing-standee #print-standee-portal,
  body.is-printing-standee #print-standee-portal * {
    visibility: visible !important;
  }

  body.is-printing-standee #print-standee-portal {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 350px !important;
    max-width: 90% !important;
    margin: 0 auto !important;
    z-index: 999999 !important;
    display: block !important;
  }

  /* High contrast black text for thermal printing */
  #printable-receipt *,
  #printable-kot *,
  #printable-zreport * {
    color: #000000 !important;
    text-shadow: none !important;
    border-color: #000000 !important;
  }

  #printable-receipt .bg-[#F5E6D8],
  #printable-receipt .bg-[#FDF8F4],
  #printable-receipt .bg-[#FFFDF9] {
    background-color: transparent !important;
    border-color: #000000 !important;
  }
}

/* RTL Scrolling Marquee for Kurdish (Starts at 0% for immediate visibility with zero blank delay) */
@keyframes marquee-rtl {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-50%, 0, 0); }
}

.animate-marquee {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  width: max-content;
  will-change: transform;
  animation: marquee-rtl 25s linear infinite !important;
}

.animate-marquee:hover {
  animation-play-state: paused;
}

/* ==========================================================================
   LOW STOCK ALERT SYSTEM (GLOWING PILL BADGE & SWINGING BELL)
   ========================================================================== */

.low-stock-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 9999px;
  background: linear-gradient(90deg, #4c0519 0%, #881337 50%, #4c0519 100%);
  border: 2px solid rgba(244, 63, 94, 0.9);
  color: #ffffff;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
  animation: fastRedGlow 0.85s infinite ease-in-out;
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.low-stock-badge:active {
  transform: scale(0.95);
}

.bell-icon {
  width: 14px;
  height: 14px;
  color: #fda4af;
  transform-origin: top center;
  animation: bellRing 1.1s infinite ease-in-out;
  display: inline-block;
  flex-shrink: 0;
}

.badge-content {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.badge-count {
  font-family: monospace;
  font-size: 12px;
  font-weight: 900;
  color: #ffe4e6;
}

.badge-label {
  color: #fecdd3;
  font-size: 11px;
  font-weight: 800;
}

@keyframes fastRedGlow {
  0%, 100% {
    box-shadow: 0 0 8px rgba(244, 63, 94, 0.5), inset 0 0 6px rgba(244, 63, 94, 0.2);
    border-color: rgba(244, 63, 94, 0.7);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 22px rgba(244, 63, 94, 0.95), 0 0 40px rgba(225, 29, 72, 0.6), inset 0 0 12px rgba(244, 63, 94, 0.4);
    border-color: #f43f5e;
    transform: scale(1.05);
  }
}

@keyframes bellRing {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(18deg); }
  40% { transform: rotate(-18deg); }
  60% { transform: rotate(12deg); }
  80% { transform: rotate(-12deg); }
}

/* ==========================================================================
   NEW ORDER ALERT SYSTEM (GLOWING EMERALD PILL BADGE & SWINGING BELL)
   ========================================================================== */

.new-order-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 9999px;
  background: linear-gradient(90deg, #022c22 0%, #064e3b 50%, #022c22 100%);
  border: 2px solid rgba(16, 185, 129, 0.9);
  color: #ffffff;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
  animation: fastEmeraldGlow 0.85s infinite ease-in-out;
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.new-order-badge:active {
  transform: scale(0.95);
}

.new-order-badge .bell-icon {
  width: 14px;
  height: 14px;
  color: #6ee7b7;
  transform-origin: top center;
  animation: bellRing 1.1s infinite ease-in-out;
  display: inline-block;
  flex-shrink: 0;
}

.new-order-badge .badge-content {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.new-order-badge .badge-count {
  font-family: monospace;
  font-size: 12px;
  font-weight: 900;
  color: #d1fae5;
}

.new-order-badge .badge-label {
  color: #a7f3d0;
  font-size: 11px;
  font-weight: 800;
}

@keyframes fastEmeraldGlow {
  0%, 100% {
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5), inset 0 0 6px rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.7);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 22px rgba(16, 185, 129, 0.95), 0 0 40px rgba(5, 150, 105, 0.6), inset 0 0 12px rgba(16, 185, 129, 0.4);
    border-color: #10b981;
    transform: scale(1.05);
  }
}

/* Mobile Safe Area & Smartphone Navigation Insets */
.safe-area-bottom {
  padding-bottom: max(0.5rem, env(safe-area-inset-bottom, 0.5rem)) !important;
}

.safe-area-top {
  padding-top: max(0.5rem, env(safe-area-inset-top, 0.5rem)) !important;
}

/* Prevent auto zoom on input focus on iOS */
@media screen and (max-width: 768px) {
  input, select, textarea {
    font-size: 16px !important;
  }
}

/* ==========================================================================
   BI-DIRECTIONAL (BIDI) TEXT RENDERING & ARABIC/KURDISH ISOLATION SYSTEM
   ========================================================================== */

/* Universal RTL / LTR text alignment */
[dir="rtl"], .rtl, .text-rtl {
  direction: rtl !important;
  text-align: right !important;
}

[dir="ltr"], .ltr, .text-ltr {
  direction: ltr !important;
  text-align: left !important;
}

/* Bi-Directional Isolation: Stops numbers, dollar signs ($), hours, percentages (%), and English terms from flipping */
bdi,
.bidi-isolate,
.bidi-inline,
.isolate-bidi,
.price-tag,
.currency-val,
.eng-phrase,
.ltr-snippet,
.bidi-range,
[dir="rtl"] [lang="en"],
[dir="rtl"] .en-text {
  unicode-bidi: isolate;
  display: inline-block;
  direction: ltr;
  vertical-align: baseline;
}

/* Force RTL containers to avoid mixed punctuation flipping at sentence ends */
.rtl-sentence,
.policy-doc-view p,
.policy-doc-view li,
.doc-section p,
.doc-section li {
  unicode-bidi: plaintext;
  text-align: right;
  direction: rtl;
}

/* Ensure all keypad buttons, calculator keys, and flex centered items are strictly centered */
button,
button span,
.keypad-btn,
.pin-btn,
[class*="justify-center"] {
  text-align: center;
}

/* Fast-touch manipulation utility to eliminate 300ms mobile tap delay */
.touch-manipulation,
.pin-btn,
.keypad-btn {
  touch-action: manipulation !important;
  -webkit-tap-highlight-color: transparent !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

/* Prevent horizontal overflow across all mobile screens */
.break-words,
.bidi-container,
.policy-doc-view,
.doc-content,
.doc-card,
.doc-section,
.glass-panel,
.modal-body {
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  box-sizing: border-box !important;
}

/* Policy & Documentation Responsive Typography & Viewport Safety */
.policy-doc-view {
  direction: rtl !important;
  text-align: right !important;
  padding-left: 1rem !important; /* px-4 */
  padding-right: 1rem !important; /* px-4 */
  font-size: 0.875rem !important; /* text-sm on mobile */
  line-height: 1.65 !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  box-sizing: border-box !important;
}

@media (min-width: 640px) {
  .policy-doc-view {
    padding-left: 1.5rem !important; /* px-6 on desktop */
    padding-right: 1.5rem !important;
    font-size: 1rem !important; /* text-base */
    line-height: 1.75 !important;
  }
}

/* Ensure all tables & charts inside docs or analytics fit mobile viewports */
.responsive-doc-table {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  display: block;
}
