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

[x-cloak] {
  display: none !important;
}

:root {
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Outfit', sans-serif;
}

html {
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

body {
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  transition: background-color 0.2s ease, color 0.2s ease;
}

h1, h2, h3, h4, .font-heading {
  font-family: var(--font-heading);
}

/* Explicit Dark Theme Support */
html.dark, html.dark body {
  background-color: #020617 !important; /* slate-950 */
  color: #f8fafc !important;
}

html.dark .bg-white {
  background-color: #0f172a !important; /* slate-900 */
  color: #f8fafc !important;
  border-color: #1e293b !important;
}

html.dark .bg-slate-50 {
  background-color: #0b1329 !important;
  color: #f8fafc !important;
  border-color: #1e293b !important;
}

html.dark .bg-slate-100 {
  background-color: #1e293b !important;
  color: #f8fafc !important;
}

html.dark .text-slate-900,
html.dark .text-slate-800 {
  color: #f8fafc !important;
}

html.dark .text-slate-700,
html.dark .text-slate-600 {
  color: #cbd5e1 !important;
}

html.dark .text-slate-500 {
  color: #94a3b8 !important;
}

html.dark .border-slate-200,
html.dark .border-slate-100 {
  border-color: #1e293b !important;
}

/* Chain Brand Badges */
.badge-lidl { background-color: #0050aa !important; color: #ffffff !important; }
.badge-konzum { background-color: #ef4444 !important; color: #ffffff !important; } /* Žarka / Svijetla Konzum crvena */
.badge-plodine { background-color: #B20738 !important; color: #ffffff !important; } /* Plodine crvena */
.badge-kaufland { background-color: #b91c1c !important; color: #ffffff !important; } /* Kaufland crvena */
.badge-spar { background-color: #007a33 !important; color: #ffffff !important; }
.badge-eurospin { background-color: #1e40af !important; color: #ffffff !important; }
.badge-dm { background-color: #762a84 !important; color: #ffffff !important; }
.badge-studenac { background-color: #f26522 !important; color: #ffffff !important; }
.badge-stanic { background-color: #0284c7 !important; color: #ffffff !important; }
.badge-vrutak { background-color: #854d0e !important; color: #ffffff !important; }

/* Safe padding for bottom navigation bar on mobile so all 90 items can be scrolled */
.content-pb-safe {
  padding-bottom: 120px !important;
}

/* Transitions */
.card-hover {
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.card-hover:active {
  transform: scale(0.98);
}

/* Leaflet Map Styling */
.leaflet-popup-content-wrapper {
  border-radius: 14px;
  padding: 4px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
}
.dark .leaflet-popup-content-wrapper {
  background-color: #0f172a !important;
  color: #f8fafc !important;
  border: 1px solid #334155;
}
.dark .leaflet-popup-tip {
  background-color: #0f172a !important;
}
.dark .leaflet-tile-pane {
  filter: brightness(0.85) invert(0.9) hue-rotate(180deg) saturate(1.2);
}

/* Hide scrollbar for clean horizontal scrolling */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Barcode Scanner UI */
#qr-reader {
  width: 100% !important;
  border: none !important;
}
#qr-reader__scan_region {
  background: #000;
  border-radius: 16px;
  overflow: hidden;
}
#qr-reader__dashboard {
  padding: 8px 0 !important;
}

/* Clean Print Styling */
@media print {
  header, nav, #storesMap, .no-print, button, input {
    display: none !important;
  }
  body, html {
    background: white !important;
    color: black !important;
    font-size: 12pt;
  }
  .print-only {
    display: block !important;
  }
  .content-pb-safe {
    padding-bottom: 0 !important;
  }
  .shadow-sm, .shadow-md, .shadow-lg, .shadow-2xl {
    box-shadow: none !important;
  }
  .border {
    border: 1px solid #cbd5e1 !important;
  }
}
.print-only {
  display: none;
}

/* ============================================================ */
/* DEVICE-SPECIFIC DISPLAY OPTIMIZATIONS (Phone & Tablet)       */
/* ============================================================ */

/* Mobile Mode (Compact, 2-column friendly, tighter spacing) */
html.device-mobile {
  font-size: 14.5px;
}
html.device-mobile main {
  padding-left: 0.5rem !important;
  padding-right: 0.5rem !important;
}
html.device-mobile .product-card {
  padding: 0.65rem !important;
  border-radius: 0.85rem !important;
}
html.device-mobile .product-card h4 {
  font-size: 0.8rem !important;
  line-height: 1.15rem !important;
  min-height: 2.3rem !important;
}
html.device-mobile .product-card .price-tag {
  font-size: 1.25rem !important;
  line-height: 1.35rem !important;
}
html.device-mobile .product-card .unit-tag {
  font-size: 0.65rem !important;
}
html.device-mobile .product-card .btn-add {
  padding-top: 0.4rem !important;
  padding-bottom: 0.4rem !important;
  font-size: 0.72rem !important;
  border-radius: 0.65rem !important;
}

/* Tablet Mode (Balanced grid, elegant 3-column spacing) */
html.device-tablet {
  font-size: 15px;
}
html.device-tablet main {
  max-width: 96% !important;
  padding-left: 1rem !important;
  padding-right: 1rem !important;
}
html.device-tablet .product-card {
  padding: 0.75rem !important;
  border-radius: 1rem !important;
}
html.device-tablet .product-card h4 {
  font-size: 0.85rem !important;
  line-height: 1.2rem !important;
}
html.device-tablet .product-card .price-tag {
  font-size: 1.4rem !important;
}

/* Small screen mobile header protections */
@media (max-width: 640px) {
  header {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }
  header button {
    padding-left: 0.4rem !important;
    padding-right: 0.4rem !important;
  }
}