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

/* ==========================================================================
   1. DESIGN TOKENS & SYSTEM VARIABLES (EXECUTIVE LIGHT & SOOTHING PALETTE)
   ========================================================================== */
:root {
  --font-sans: 'Prompt', 'Noto Sans SC', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Plus Jakarta Sans', 'Prompt', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Executive Comfortable Light Canvas */
  --bg-canvas: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-subtle: #F1F5F9;
  --bg-muted: #E2E8F0;

  /* Typography Hierarchy */
  --text-primary: #0F172A;
  --text-secondary: #334155;
  --text-muted: #64748B;
  --text-light: #94A3B8;

  /* Borders & Dividers */
  --border-subtle: #E2E8F0;
  --border-medium: #CBD5E1;
  --border-focus: #E11D48;

  /* Corporate Accents */
  --brand-crimson: #E11D48;
  --brand-crimson-hover: #BE123C;
  --brand-crimson-light: #FFF1F2;
  --brand-crimson-subtle: rgba(225, 29, 72, 0.08);

  --brand-sapphire: #1D4ED8;
  --brand-sapphire-light: #EFF6FF;

  --accent-emerald: #059669;
  --accent-emerald-light: #ECFDF5;

  --accent-amber: #D97706;
  --accent-amber-light: #FFFBEB;

  --accent-sky: #0284C7;
  --accent-sky-light: #F0F9FF;

  /* Elevating Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.09), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
}

/* ==========================================================================
   2. GLOBAL RESETS & BASE TYPOGRAPHY
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  color: var(--text-primary);
  background-color: var(--bg-canvas);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.font-display {
  font-family: var(--font-display);
}

.font-mono-code {
  font-family: var(--font-mono);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94A3B8;
}

/* ==========================================================================
   3. ISOLATED MODAL & DRAWER SYSTEM (ZERO CLICKS BLOCKED)
   ========================================================================== */
.modal-backdrop {
  display: none !important;
  pointer-events: none !important;
  position: fixed;
  inset: 0;
  z-index: -9999;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}

.modal-backdrop.open,
.modal-backdrop.active,
.modal-backdrop.active-modal {
  display: flex !important;
  pointer-events: auto !important;
  z-index: 100 !important;
}

/* Cart Slide Drawer */
#cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 460px;
  z-index: -9999;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  background-color: #FFFFFF;
}

#cart-drawer.open,
#cart-drawer.drawer-open {
  z-index: 110 !important;
  transform: translateX(0) !important;
  pointer-events: auto !important;
}

#cart-backdrop {
  position: fixed;
  inset: 0;
  z-index: -9999;
  background-color: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

#cart-backdrop.open,
#cart-backdrop.active-modal {
  z-index: 105 !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* ==========================================================================
   4. EXECUTIVE CARDS & CLEAN SURFACES ("สวยงาม ทางการ สบายตา")
   ========================================================================== */
.card-clean {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-clean:hover {
  border-color: var(--border-medium);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-subtle {
  background: #F8FAFC;
  border: 1px solid var(--border-subtle);
  border-radius: 1rem;
}

.card-dark {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: 1.25rem;
  box-shadow: var(--shadow-sm);
}

/* Executive Corporate Hero Mesh */
.hero-mesh {
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 60%, #0F172A 100%);
  border-bottom: 1px solid #1E293B;
  color: #F8FAFC;
}

.hero-mesh .card-dark {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(51, 65, 85, 0.8);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
}

/* Product Card & Luxury E-Commerce Presentation */
.product-card {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: 1.5rem;
  overflow: hidden;
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.04), 0 2px 6px -1px rgba(15, 23, 42, 0.02);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  position: relative;
}

.product-card:hover {
  border-color: #CBD5E1;
  box-shadow: 0 20px 35px -10px rgba(15, 23, 42, 0.1), 0 8px 16px -4px rgba(15, 23, 42, 0.04);
  transform: translateY(-5px);
}

.img-container {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  min-height: 200px;
  background: linear-gradient(180deg, #F8FAFC 0%, #F1F5F9 100%);
  overflow: hidden;
  display: block;
}

.img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.product-card:hover .img-container img {
  transform: scale(1.08);
}

/* Quick Floating Action on Card Hover */
.card-hover-actions {
  position: absolute;
  bottom: 0.75rem;
  left: 0.75rem;
  right: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transform: translateY(120%);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 5;
}

.product-card:hover .card-hover-actions {
  transform: translateY(0);
  opacity: 1;
}

/* Luxury Ribbons */
.ribbon-badge {
  position: absolute;
  top: 0.85rem;
  left: 0.85rem;
  padding: 0.3rem 0.65rem;
  border-radius: 0.75rem;
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  z-index: 4;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(8px);
}

.ribbon-hot {
  background: linear-gradient(135deg, #E11D48 0%, #BE123C 100%);
  color: #FFFFFF;
}

.ribbon-gold {
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  color: #FFFFFF;
}

/* Glassmorphism Classes */
.glass-nav {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

.glass-card {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 10px 30px -5px rgba(15, 23, 42, 0.05);
}

.glass-card-dark {
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(51, 65, 85, 0.7);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
}

/* Live Flight Radar Wave */
@keyframes radar-pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.radar-dot {
  animation: radar-pulse 2s infinite cubic-bezier(0.45, 0, 0.55, 1);
}

/* Review Cards */
.review-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 1.25rem;
  padding: 1.25rem;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.review-card:hover {
  transform: translateY(-3px);
  border-color: #CBD5E1;
  box-shadow: 0 12px 24px -6px rgba(15, 23, 42, 0.06);
}

/* Quick Search Tag Chips */
.quick-search-chip {
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 600;
  background-color: #F8FAFC;
  border: 1px solid #E2E8F0;
  color: #334155;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  white-space: nowrap !important;
  word-break: keep-all !important;
  flex-shrink: 0 !important;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.quick-search-chip:hover {
  background-color: #FFFFFF;
  border-color: #CBD5E1;
  color: #E11D48;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
}

/* Retail Store Pavilions */
.store-pavilion-card {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: 1.25rem;
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-xs);
  transition: all 0.2s ease;
  cursor: pointer;
}

.store-pavilion-card:hover,
.store-pavilion-card.active {
  border-color: var(--brand-crimson);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.store-pavilion-card.active {
  background-color: #FFF1F2;
  border-color: #E11D48;
}

/* Status Badges */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.badge-pending {
  background-color: #FFFBEB;
  color: #B45309;
  border: 1px solid #FDE68A;
}

.badge-procuring {
  background-color: #EFF6FF;
  color: #1D4ED8;
  border: 1px solid #BFDBFE;
}

.badge-packed {
  background-color: #FDF4FF;
  color: #9333EA;
  border: 1px solid #F5D0FE;
}

.badge-intransit {
  background-color: #F0FDF4;
  color: #15803D;
  border: 1px solid #BBF7D0;
}

.badge-customs {
  background-color: #FFF7ED;
  color: #C2410C;
  border: 1px solid #FED7AA;
}

.badge-delivered {
  background-color: #ECFDF5;
  color: #047857;
  border: 1px solid #A7F3D0;
}

/* ==========================================================================
   5. INTERACTIVE TIMELINE & TRACKING STEPPER
   ========================================================================== */
.tracking-step {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding-bottom: 1.5rem;
}

.tracking-step::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 28px;
  bottom: 0;
  width: 2px;
  background-color: #E2E8F0;
}

.tracking-step:last-child {
  padding-bottom: 0;
}

.tracking-step:last-child::before {
  display: none;
}

.tracking-dot {
  width: 30px;
  height: 30px;
  border-radius: 9999px;
  background-color: #F1F5F9;
  border: 2px solid #CBD5E1;
  display: flex;
  align-items: center;
  justify-content: center;
  shrink: 0;
  z-index: 1;
  transition: all 0.2s ease;
}

.tracking-step.completed .tracking-dot {
  background-color: #059669;
  border-color: #059669;
  color: #FFFFFF;
}

.tracking-step.active .tracking-dot {
  background-color: #E11D48;
  border-color: #E11D48;
  color: #FFFFFF;
  box-shadow: 0 0 0 4px rgba(225, 29, 72, 0.15);
}

.tracking-step.completed::before {
  background-color: #059669;
}

/* ==========================================================================
   6. SMART CART WEIGHT METER & SHIPPING TIERS
   ========================================================================== */
.weight-meter-track {
  height: 8px;
  border-radius: 9999px;
  background-color: #E2E8F0;
  overflow: hidden;
  position: relative;
}

.weight-meter-bar {
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(90deg, #10B981 0%, #059669 60%, #E11D48 100%);
  transition: width 0.4s ease-out;
}

.shipping-tier-card {
  border: 1.5px solid #E2E8F0;
  border-radius: 1rem;
  padding: 0.875rem 1rem;
  transition: all 0.2s ease;
  cursor: pointer;
  background-color: #FFFFFF;
}

.shipping-tier-card:hover {
  border-color: #CBD5E1;
}

.shipping-tier-card.selected {
  border-color: #E11D48;
  background-color: #FFF1F2;
  box-shadow: 0 0 0 1px #E11D48;
}

/* Variant Chip */
.variant-chip {
  padding: 0.375rem 0.75rem;
  border-radius: 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid #E2E8F0;
  background-color: #FFFFFF;
  color: #334155;
  transition: all 0.15s ease;
  cursor: pointer;
}

.variant-chip:hover {
  border-color: #94A3B8;
  color: #0F172A;
}

.variant-chip.active {
  background-color: #0F172A;
  color: #FFFFFF;
  border-color: #0F172A;
}

/* Quantity Button */
.qty-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  background-color: #F1F5F9;
  color: #1E293B;
  font-weight: bold;
  transition: background-color 0.15s ease;
}

.qty-btn:hover {
  background-color: #E2E8F0;
}

/* ==========================================================================
   7. PRINTABLE COMMERCIAL INVOICE & AWB STYLING
   ========================================================================== */
.barcode-stripes {
  height: 36px;
  background: repeating-linear-gradient(
    90deg,
    #000000,
    #000000 2px,
    #FFFFFF 2px,
    #FFFFFF 4px,
    #000000 4px,
    #000000 7px,
    #FFFFFF 7px,
    #FFFFFF 9px
  );
  border-radius: 2px;
}

@media print {
  body * {
    visibility: hidden;
  }

  #printable-invoice-modal,
  #printable-invoice-modal * {
    visibility: visible;
  }

  #printable-invoice-modal {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    background: #FFFFFF !important;
    display: block !important;
  }

  .no-print {
    display: none !important;
  }
}
