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

:root {
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --accent: #00e5ff;
  --accent-glow: rgba(0, 229, 255, 0.4);
  --bg-dark: #060c18;
  --card-dark: #0d1526;
  --card-border: #1a2540;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-glow: #0284c7;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
}

* {
  box-sizing: border-box;
  font-family: 'Cairo', system-ui, -apple-system, sans-serif;
}

body {
  direction: rtl;
  text-align: right;
  background-color: var(--bg-dark);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(2, 132, 199, 0.12), transparent),
    radial-gradient(ellipse 60% 30% at 100% 80%, rgba(0, 229, 255, 0.05), transparent);
  color: #f1f5f9;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
}

/* Custom Scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #0a111f; }
::-webkit-scrollbar-thumb { background: #1e3a5f; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #0284c7; }

/* ─── ANIMATED PARTICLE CANVAS ─── */
#particleCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
}

/* ─── ANIMATED BACKGROUND LOGO WATERMARK ─── */
.animated-bg-logo-wrapper {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(720px, 86vw);
  height: min(720px, 86vw);
  pointer-events: none;
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  transition: transform 0.2s ease-out;
}

/* Central floating logo with pulse & neon shadow */
.logo-watermark-img {
  width: 84%;
  height: 84%;
  object-fit: contain;
  border-radius: 40px;
  animation: logoFloatPulse 6.5s ease-in-out infinite;
  mask-image: radial-gradient(circle at center, black 65%, transparent 100%);
  -webkit-mask-image: radial-gradient(circle at center, black 65%, transparent 100%);
}

@keyframes logoFloatPulse {
  0%, 100% {
    transform: translateY(0px) scale(0.96) rotate(0deg);
    opacity: 0.17;
    filter: drop-shadow(0 0 25px rgba(0, 229, 255, 0.3)) drop-shadow(0 0 50px rgba(2, 132, 199, 0.2));
  }
  50% {
    transform: translateY(-16px) scale(1.05) rotate(0.8deg);
    opacity: 0.28;
    filter: drop-shadow(0 0 55px rgba(0, 229, 255, 0.6)) drop-shadow(0 0 90px rgba(2, 132, 199, 0.4));
  }
}

/* Hologram Aura Glow */
.logo-hologram-glow {
  position: absolute;
  width: 95%;
  height: 95%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 229, 255, 0.14) 0%, rgba(2, 132, 199, 0.07) 40%, transparent 70%);
  animation: auraBreath 5s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes auraBreath {
  from { transform: scale(0.88); opacity: 0.55; }
  to   { transform: scale(1.15); opacity: 0.95; }
}

/* Orbiting futuristic cybernetic circuit rings */
.logo-hologram-rings {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 1.5px dashed rgba(56, 189, 248, 0.18);
  animation: ringRotate 30s linear infinite;
  pointer-events: none;
}

.logo-hologram-rings::before {
  content: '';
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  border: 1px dotted rgba(0, 229, 255, 0.14);
  animation: ringRotate 18s linear infinite reverse;
}

.logo-hologram-rings::after {
  content: '';
  position: absolute;
  inset: 38px;
  border-radius: 50%;
  border: 1px solid rgba(14, 165, 233, 0.08);
}

@keyframes ringRotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Glassmorphism */
.glass-panel {
  background: rgba(13, 21, 38, 0.7);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.glass-header {
  background: rgba(6, 12, 24, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(56, 189, 248, 0.12);
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
}

/* ─── PRODUCT CARD ─── */
.circuit-card {
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.28s ease,
              border-color 0.28s ease;
  position: relative;
  overflow: hidden;
  will-change: transform;
}

/* Gradient border on top edge */
.circuit-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(56,189,248,0) 0%, rgba(56,189,248,0.6) 50%, rgba(56,189,248,0) 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.35s;
  pointer-events: none;
}

/* Shimmer sweep on hover */
.circuit-card::after {
  content: '';
  position: absolute;
  top: -100%;
  left: -60%;
  width: 40%;
  height: 300%;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.06) 50%, transparent 60%);
  transform: skewX(-15deg);
  transition: left 0.55s ease;
  pointer-events: none;
}

.circuit-card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow:
    0 0 0 1px rgba(56, 189, 248, 0.3),
    0 16px 40px -8px rgba(2, 132, 199, 0.3),
    0 0 60px -20px rgba(0, 229, 255, 0.2);
  border-color: rgba(56, 189, 248, 0.35) !important;
}

.circuit-card:hover::before { opacity: 1; }
.circuit-card:hover::after  { left: 120%; }

/* Scroll-reveal animation */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

.reveal {
  opacity: 0;
  animation: fadeInUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ─── HERO SECTION ─── */
.hero-section {
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 50%, rgba(0, 229, 255, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(2, 132, 199, 0.08) 0%, transparent 40%);
  pointer-events: none;
}

/* Animated gradient text */
@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.gradient-text {
  background: linear-gradient(270deg, #38bdf8, #00e5ff, #818cf8, #38bdf8);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 5s ease infinite;
}

/* ─── STAT CARDS IN HERO ─── */
.stat-card {
  background: rgba(13, 21, 38, 0.8);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(56, 189, 248, 0.15);
  border-radius: 16px;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.1);
}

/* ─── CATEGORY PILLS ─── */
.cat-pill {
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cat-pill.active {
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.4), 0 4px 12px rgba(2, 132, 199, 0.3);
}

.cat-pill:not(.active):hover {
  transform: translateY(-2px);
}

/* ─── PRICE TAG GLOW ─── */
@keyframes priceGlow {
  0%, 100% { text-shadow: 0 0 6px rgba(0, 229, 255, 0.3); }
  50%       { text-shadow: 0 0 14px rgba(0, 229, 255, 0.7); }
}

.price-glow {
  animation: priceGlow 2.5s ease-in-out infinite;
}

/* ─── STOCK PULSE for low-stock ─── */
@keyframes stockPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.55; }
}

.low-stock-badge { animation: stockPulse 1.8s ease-in-out infinite; }

/* ─── NEON GLOW ─── */
.neon-glow { text-shadow: 0 0 10px rgba(0, 229, 255, 0.5); }
.neon-border { box-shadow: 0 0 15px rgba(2, 132, 199, 0.3); }

/* ─── PULSE ANIMATION (Admin New Order Alert) ─── */
@keyframes pulseRing {
  0%   { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70%  { transform: scale(1);    box-shadow: 0 0 0 15px rgba(239, 68, 68, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.pulse-alert { animation: pulseRing 1.8s infinite; }

/* ─── BADGE STATUS ─── */
.badge-status-new    { background-color: rgba(239,68,68,0.2);   color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.badge-status-prep   { background-color: rgba(245,158,11,0.2);  color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.badge-status-ready  { background-color: rgba(59,130,246,0.2);  color: #60a5fa; border: 1px solid rgba(59,130,246,0.3); }
.badge-status-done   { background-color: rgba(16,185,129,0.2);  color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.badge-status-cancel { background-color: rgba(100,116,139,0.2); color: #94a3b8; border: 1px solid rgba(100,116,139,0.3); }

/* ─── SKELETON LOADING ─── */
@keyframes skeleton {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton {
  background: linear-gradient(90deg, #0d1526 25%, #172039 50%, #0d1526 75%);
  background-size: 800px 100%;
  animation: skeleton 1.5s infinite;
  border-radius: 8px;
}

/* ─── ADD TO CART BUTTON ─── */
.add-cart-btn {
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.add-cart-btn:hover {
  box-shadow: 0 0 18px rgba(6, 182, 212, 0.45);
  transform: scale(1.04);
}

.add-cart-btn:active { transform: scale(0.96); }

/* ─── FLOATING WHATSAPP BUTTON ─── */
@keyframes floatBounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}

.whatsapp-float {
  animation: floatBounce 3s ease-in-out infinite;
  box-shadow: 0 4px 20px rgba(16, 185, 85, 0.5);
  transition: box-shadow 0.3s, transform 0.15s;
}

.whatsapp-float:hover {
  box-shadow: 0 6px 28px rgba(16, 185, 85, 0.7);
  animation-play-state: paused;
  transform: scale(1.1);
}

/* ─── CART DRAWER TRANSITION ─── */
.drawer-enter         { transform: translateX(100%); }
.drawer-enter-active  { transform: translateX(0); transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1); }

/* ─── TOAST ENHANCED ─── */
.toast-bar {
  height: 3px;
  border-radius: 2px;
  background: rgba(255,255,255,0.4);
  animation: shrinkBar 3s linear forwards;
  transform-origin: right;
}

@keyframes shrinkBar {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* ─── MONO ─── */
.num-mono { font-family: 'JetBrains Mono', 'Cairo', monospace; }

/* ─── IMAGE ZOOM OVERLAY ─── */
.img-zoom-wrap {
  overflow: hidden;
  border-radius: inherit;
}

.img-zoom-wrap img {
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.img-zoom-wrap:hover img {
  transform: scale(1.12);
}

/* ─── SCROLLBAR NONE ─── */
.scrollbar-none::-webkit-scrollbar { display: none; }
.scrollbar-none { -ms-overflow-style: none; scrollbar-width: none; }

/* ─── COUNTER ANIMATION ─── */
@keyframes countUp {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1); }
}

.count-animated { animation: countUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }

/* ─── GRID STAGGER DELAYS ─── */
.reveal:nth-child(1)  { animation-delay: 0.03s; }
.reveal:nth-child(2)  { animation-delay: 0.07s; }
.reveal:nth-child(3)  { animation-delay: 0.11s; }
.reveal:nth-child(4)  { animation-delay: 0.15s; }
.reveal:nth-child(5)  { animation-delay: 0.19s; }
.reveal:nth-child(6)  { animation-delay: 0.23s; }
.reveal:nth-child(7)  { animation-delay: 0.27s; }
.reveal:nth-child(8)  { animation-delay: 0.31s; }
.reveal:nth-child(n+9) { animation-delay: 0.35s; }

/* ─── CATEGORY CAROUSEL & CONTROLS ─── */
.cat-carousel-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.cat-scroll-container {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 4px 10px 4px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
  user-select: none;
}

.cat-scroll-container:active {
  cursor: grabbing;
}

/* Custom sleek Cyber Scrollbar */
.cyber-scrollbar::-webkit-scrollbar {
  height: 6px;
}
.cyber-scrollbar::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.7);
  border-radius: 9999px;
}
.cyber-scrollbar::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, #0284c7, #00e5ff);
  border-radius: 9999px;
  border: 1px solid rgba(0, 229, 255, 0.3);
}
.cyber-scrollbar::-webkit-scrollbar-thumb:hover {
  background: #00e5ff;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.7);
}

/* Scroll Arrow Navigation Buttons */
.cat-nav-btn {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.cat-nav-btn:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #00e5ff;
  transform: scale(1.08);
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.45);
}

.cat-nav-btn:active {
  transform: scale(0.92);
}

/* Category Wrapped Grid Mode (show ALL at once) */
.cat-scroll-container.is-wrapped {
  flex-wrap: wrap !important;
  overflow-x: visible !important;
  overflow-y: visible !important;
  max-height: none !important;
  gap: 10px !important;
  cursor: default !important;
}

/* Category pill enhancements */
.cat-pill {
  white-space: nowrap;
  user-select: none;
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cat-pill:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 229, 255, 0.6);
  color: #ffffff;
}

.cat-pill:active {
  transform: scale(0.96);
}

/* ═══════════════════════════════════════════════════════
   INVOICE SYSTEM (A4 & THERMAL POS PRINTING)
═══════════════════════════════════════════════════════ */

/* Paper preview styles on screen */
.invoice-sheet-a4 {
  background: #ffffff !important;
  color: #0f172a !important;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 36px 32px;
  border-radius: 16px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.1);
  font-family: 'Cairo', system-ui, -apple-system, sans-serif;
  direction: rtl;
  text-align: right;
  line-height: 1.5;
}

.invoice-sheet-pos {
  background: #ffffff !important;
  color: #0f172a !important;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  padding: 24px 18px;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75);
  font-family: 'Cairo', system-ui, -apple-system, sans-serif;
  direction: rtl;
  text-align: right;
  font-size: 11.5px;
  line-height: 1.4;
}

/* Print CSS */
@media print {
  html, body {
    background: #ffffff !important;
    color: #000000 !important;
    margin: 0 !important;
    padding: 0 !important;
    min-height: auto !important;
    overflow: visible !important;
  }

  /* Hide interactive interface components */
  body > *:not(#printableInvoiceArea) {
    display: none !important;
  }

  header, footer, nav, main, #particleCanvas, .animated-bg-logo-wrapper,
  #toastContainer, #newOrderAlertBanner, #adminOrderModal, #adminProductModal,
  #adminInvoiceModal, .no-print {
    display: none !important;
  }

  #printableInvoiceArea {
    display: block !important;
    position: static !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    color: #000000 !important;
    box-shadow: none !important;
    border: none !important;
  }

  #printableInvoiceArea * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .invoice-sheet-a4 {
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
  }

  .invoice-sheet-pos {
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    max-width: 78mm !important;
    margin: 0 auto !important;
  }

  @page {
    size: auto;
    margin: 8mm 8mm 8mm 8mm;
  }

  .avoid-break {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  table {
    page-break-inside: auto;
  }

  tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }
}

