/* ==========================================================================
   DREAM CART BD — COMPREHENSIVE RESPONSIVE SUITE & ADAPTIVE LAYOUTS
   Multi-screen support: Mobile (320-480px), Phablet (481-768px),
   Tablet/iPad (769-1024px), Laptop/Desktop (1025-1440px), 4K & Smart TVs (>1440px)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CORE CSS VARIABLES & DARK MODE PALETTE
   -------------------------------------------------------------------------- */
:root {
  --app-max-width: 1380px;
  --header-height: 72px;
  --notice-height: 38px;
  --mobile-nav-height: 64px;

  /* Light Theme */
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-main: #e2e8f0;
  --border-light: #f1f5f9;
  --primary: #059669;
  --primary-hover: #047857;
  --primary-light: #ecfdf5;
  --accent: #f59e0b;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

.dark {
  --bg-main: #0b1120;
  --bg-card: #1e293b;
  --bg-card-hover: #243248;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-main: #334155;
  --border-light: #1e293b;
  --primary: #10b981;
  --primary-hover: #059669;
  --primary-light: #064e3b;
  --accent: #fbbf24;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
}

/* --------------------------------------------------------------------------
   2. GLOBAL FLUID TYPOGRAPHY & TOUCH TARGETS
   -------------------------------------------------------------------------- */
html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main#app-content {
  flex: 1;
  width: 100%;
}

/* Minimum interactive touch target for mobile usability */
button, 
a.btn-primary, 
a.btn-secondary, 
input, 
select {
  min-height: 38px;
}

/* --------------------------------------------------------------------------
   3. RESPONSIVE CONTAINER & GRID ADAPTATIONS
   -------------------------------------------------------------------------- */
.container-fluid {
  width: 100%;
  max-width: var(--app-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(12px, 3vw, 32px);
  padding-right: clamp(12px, 3vw, 32px);
}

/* Responsive Products Grid */
.product-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

@media (min-width: 480px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
  }
}

@media (min-width: 768px) {
  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
  }
}

@media (min-width: 1120px) {
  .product-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.5rem;
  }
}

@media (min-width: 1600px) {
  .product-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1.75rem;
  }
}

/* --------------------------------------------------------------------------
   4. HOVER ANIMATIONS & CARD INTERACTIONS
   -------------------------------------------------------------------------- */
.product-card {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
              box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.25s ease;
  will-change: transform, box-shadow;
}

@media (hover: hover) {
  .product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 30px -10px rgba(5, 150, 105, 0.18), 0 6px 12px -4px rgba(0, 0, 0, 0.06);
  }
}

.product-card:active {
  transform: translateY(-2px);
}

/* --------------------------------------------------------------------------
   5. AUTO-SLIDING HORIZONTAL CAROUSELS
   -------------------------------------------------------------------------- */
.carousel-track {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-bottom: 0.75rem;
}

.carousel-track::-webkit-scrollbar {
  height: 6px;
}

.carousel-track::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 9999px;
}

.carousel-track::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 9999px;
}

.carousel-item {
  flex: 0 0 260px;
  scroll-snap-align: start;
}

@media (min-width: 640px) {
  .carousel-item { flex: 0 0 280px; }
}

@media (min-width: 1024px) {
  .carousel-item { flex: 0 0 300px; }
}

/* --------------------------------------------------------------------------
   6. DEVICE SPECIFIC BREAKPOINTS
   -------------------------------------------------------------------------- */

/* A. Mobile Screens (max-width: 639px) */
@media (max-width: 639px) {
  body {
    padding-bottom: 68px; /* space for mobile nav bar */
  }

  .notice-bar {
    text-align: center;
    font-size: 10px;
    padding: 6px 10px;
  }

  /* Make floating buttons sit just above mobile nav */
  #floating-actions-dock {
    bottom: 74px !important;
    right: 12px !important;
  }

  .hide-on-mobile {
    display: none !important;
  }

  .mobile-full-width {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .voucher-wrapper {
    padding: 1rem !important;
    border-radius: 1rem !important;
  }
}

/* B. Phablet & Tablet (640px - 1023px) */
@media (min-width: 640px) and (max-width: 1023px) {
  .hide-on-tablet {
    display: none !important;
  }
}

/* C. Laptop & Desktop (1024px - 1439px) */
@media (min-width: 1024px) {
  .hide-on-desktop {
    display: none !important;
  }
}

/* D. Ultra-wide & 4K / Smart TV (min-width: 1440px) */
@media (min-width: 1440px) {
  :root {
    --app-max-width: 1560px;
  }

  body {
    font-size: 16.5px;
  }

  .product-card h3 {
    font-size: 0.95rem;
  }
}

@media (min-width: 2160px) {
  /* 4K screens & Big TVs */
  :root {
    --app-max-width: 1920px;
  }

  html {
    font-size: 18px;
  }
}

/* --------------------------------------------------------------------------
   7. LIVE PREDICTIVE SEARCH DROPDOWN
   -------------------------------------------------------------------------- */
#search-preview-popup {
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.25);
  animation: dropdownFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.search-preview-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.search-preview-item:hover {
  background-color: var(--primary-light);
}

.search-preview-item img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   8. STATUS STEPPER & TIMELINE (37 Order Statuses)
   -------------------------------------------------------------------------- */
.timeline-stepper {
  position: relative;
  padding-left: 2rem;
}

.timeline-stepper::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border-main);
}

.stepper-node {
  position: relative;
  margin-bottom: 1.75rem;
}

.stepper-node:last-child {
  margin-bottom: 0;
}

.stepper-bullet {
  position: absolute;
  left: -2rem;
  top: 2px;
  width: 24px;
  height: 24px;
  border-radius: 9999px;
  background: var(--bg-card);
  border: 3px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 900;
  color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}

.stepper-node.active .stepper-bullet {
  background: var(--primary);
  color: white;
  animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.3); }
  50% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0.1); }
}

/* --------------------------------------------------------------------------
   9. PRINT STYLESHEET FOR VOUCHERS / INVOICES
   -------------------------------------------------------------------------- */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .notice-bar,
  header,
  footer,
  #floating-actions-dock,
  .mobile-nav-bar,
  .print\:hidden {
    display: none !important;
  }

  .voucher-wrapper {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
  }

  main#app-content {
    padding: 0 !important;
    margin: 0 !important;
  }
}
