/* Mobile Header & Touch Adjustments */
@media (max-width: 640px) {
  header h1 {
    font-size: 1.05rem !important;
  }
  .header-actions-mobile {
    gap: 0.35rem !important;
  }
}


:root {
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

html {
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  max-width: 100%;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #F8FAFC !important;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(254, 240, 138, 0.45) 0%, transparent 35%),
    radial-gradient(circle at 85% 10%, rgba(167, 243, 208, 0.5) 0%, transparent 40%),
    radial-gradient(circle at 50% 70%, rgba(199, 210, 254, 0.35) 0%, transparent 45%),
    radial-gradient(circle at 90% 85%, rgba(254, 215, 170, 0.4) 0%, transparent 35%) !important;
  background-attachment: fixed !important;
}

/* Glassmorphism utilities */
.glass-panel {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.glass-card {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(226, 232, 240, 0.85);
  box-shadow: 0 10px 25px -3px rgba(15, 23, 42, 0.06), 0 4px 10px -2px rgba(15, 23, 42, 0.03);
}

/* Floating dark mobile navigation island dock */
.mobile-floating-dock {
  position: fixed;
  bottom: 0.85rem;
  left: 0.85rem;
  right: 0.85rem;
  z-index: 50;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 20px 45px -10px rgba(15, 23, 42, 0.45), 0 8px 16px -4px rgba(15, 23, 42, 0.25);
  border-radius: 1.5rem;
  padding: 0.4rem 0.5rem;
  padding-bottom: max(0.4rem, env(safe-area-inset-bottom, 0.4rem));
}

/* Interactive touch target & feedback */
button, a, [role="button"] {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.98) translateY(6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes slideUpSheet {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-sheet-up {
  animation: slideUpSheet 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Day Badges */
.day-pill-mandag { background: linear-gradient(135deg, #059669, #047857); color: #FFFFFF; }
.day-pill-tisdag { background: linear-gradient(135deg, #D97706, #B45309); color: #FFFFFF; }
.day-pill-onsdag { background: linear-gradient(135deg, #0284C7, #0369A1); color: #FFFFFF; }
.day-pill-torsdag { background: linear-gradient(135deg, #4F46E5, #4338CA); color: #FFFFFF; }
.day-pill-fredag { background: linear-gradient(135deg, #E11D48, #BE123C); color: #FFFFFF; }
.day-pill-lordag { background: linear-gradient(135deg, #7C3AED, #6D28D9); color: #FFFFFF; }
.day-pill-sondag { background: linear-gradient(135deg, #EA580C, #C2410C); color: #FFFFFF; }

/* Category pills */
.category-pill {
  padding: 0.5rem 0.95rem;
  min-height: 40px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid #E2E8F0;
  background-color: #FFFFFF;
  color: #475569;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.category-pill:hover {
  background-color: #F8FAFC;
  color: #0F172A;
  border-color: #CBD5E1;
  transform: translateY(-1px);
}

.category-pill:active {
  transform: scale(0.97);
}

.category-pill.active {
  background: linear-gradient(135deg, #059669, #047857);
  color: #FFFFFF;
  border-color: #047857;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
}

/* Allergy pills */
.allergy-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.95rem;
  min-height: 40px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid #E2E8F0;
  background-color: #FFFFFF;
  color: #64748B;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  user-select: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.allergy-pill:hover {
  border-color: #FDA4AF;
  color: #E11D48;
  background-color: #FFF1F2;
  transform: translateY(-1px);
}

.allergy-pill:active {
  transform: scale(0.97);
}

.allergy-pill.active {
  background: linear-gradient(135deg, #E11D48, #BE123C);
  color: #FFFFFF;
  border-color: #BE123C;
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.35);
}

/* Custom Checkbox - Touch Friendly */
.custom-checkbox {
  appearance: none;
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid #CBD5E1;
  border-radius: 0.55rem;
  outline: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  background-color: #FFFFFF;
}

.custom-checkbox:hover {
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

.custom-checkbox:checked {
  background: linear-gradient(135deg, #059669, #047857);
  border-color: #047857;
  box-shadow: 0 3px 8px rgba(5, 150, 105, 0.35);
}

.custom-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 6.5px;
  top: 2.5px;
  width: 6px;
  height: 11px;
  border: solid white;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

/* Meal card transitions */
.meal-card {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease;
}

.meal-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 35px -8px rgba(15, 23, 42, 0.12), 0 6px 14px -2px rgba(15, 23, 42, 0.05);
  border-color: rgba(5, 150, 105, 0.35);
}

/* Hide scrollbar utility */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Pull to dismiss or sheet modal styles */
@media (max-width: 640px) {
  .modal-sheet-dialog {
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    max-height: 94dvh !important;
    padding-bottom: 0 !important;
  }
}

/* Interactive Ingredient & Step items */
.ingredient-touch-item {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-tap-highlight-color: transparent;
}
.ingredient-touch-item:active {
  transform: scale(0.98);
}
.ingredient-touch-item.checked {
  background-color: rgba(236, 253, 245, 0.75) !important;
  border-color: rgba(110, 231, 183, 0.8) !important;
}
.ingredient-touch-item.checked .ingredient-text {
  text-decoration: line-through;
  color: #94A3B8 !important;
}
.ingredient-touch-item.checked .check-box-icon {
  background: linear-gradient(135deg, #059669, #047857) !important;
  border-color: #047857 !important;
  color: #FFFFFF !important;
}

.instruction-step-item {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-tap-highlight-color: transparent;
}
.instruction-step-item:active {
  transform: scale(0.99);
}
.instruction-step-item.completed {
  opacity: 0.65;
  background-color: #F8FAFC !important;
}
.instruction-step-item.completed .step-number-badge {
  background: linear-gradient(135deg, #059669, #047857) !important;
  color: #FFFFFF !important;
}

/* Nutrition Pill & Macro Bar */
.nutrition-pill {
  transition: all 0.2s ease-in-out;
}
.nutrition-pill:hover {
  background-color: #F1F5F9;
  border-color: #CBD5E1;
}

/* Print styles - Clean, high-legibility grocery checklist for paper printing */
@media print {
  header, 
  #statusBanner, 
  .mobile-floating-dock, 
  nav, 
  #controlSection, 
  section:not(#viewShopping), 
  footer, 
  .no-print, 
  #shoppingProgressBarContainer, 
  #shopStoreToggleGroup, 
  #shoppingSubtitle,
  .modal-sheet-dialog, 
  #toast, 
  #activeSavedBanner, 
  #activeSavedShoppingBanner, 
  button {
    display: none !important;
  }
  #viewShopping {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  body {
    background: #FFFFFF !important;
    background-image: none !important;
    color: #000000 !important;
    font-size: 11pt !important;
  }
  .glass-card {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    background: transparent !important;
  }
  #shoppingGrid {
    display: block !important;
  }
  #colHemkopShopping, #colCoopShopping, #colIcaShopping, #colWillysShopping, #colPantryShopping {
    page-break-inside: avoid;
    margin-bottom: 20px;
    border: 1px solid #94A3B8 !important;
    border-radius: 8px !important;
  }
  #colHemkopShopping > div:first-child,
  #colCoopShopping > div:first-child,
  #colIcaShopping > div:first-child,
  #colWillysShopping > div:first-child,
  #colPantryShopping > div:first-child {
    background: #F1F5F9 !important;
    color: #0F172A !important;
    border-bottom: 2px solid #CBD5E1 !important;
    padding: 8px 12px !important;
  }
  #colHemkopShopping > div:first-child *,
  #colCoopShopping > div:first-child *,
  #colIcaShopping > div:first-child *,
  #colWillysShopping > div:first-child *,
  #colPantryShopping > div:first-child * {
    color: #0F172A !important;
  }
  .custom-checkbox {
    border: 2px solid #000000 !important;
    width: 16px !important;
    height: 16px !important;
    border-radius: 3px !important;
  }
}

/* ========================================================
   ANIMERAD KYLSKÅP & FLYGANDE GRÖNSAKER VID MENYLADDNING
   ======================================================== */
@keyframes fridgeFloat {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-4px) rotate(-0.5deg); }
}

@keyframes foodArc1 {
  0% { transform: translate(-140px, -70px) scale(0.6) rotate(-20deg); opacity: 0; }
  25% { opacity: 1; transform: translate(-80px, -90px) scale(1.1) rotate(10deg); }
  70% { opacity: 1; transform: translate(-20px, -20px) scale(0.9) rotate(45deg); }
  100% { transform: translate(15px, 20px) scale(0.2) rotate(90deg); opacity: 0; }
}

@keyframes foodArc2 {
  0% { transform: translate(140px, -60px) scale(0.6) rotate(30deg); opacity: 0; }
  25% { opacity: 1; transform: translate(80px, -95px) scale(1.1) rotate(-15deg); }
  70% { opacity: 1; transform: translate(25px, -15px) scale(0.9) rotate(-45deg); }
  100% { transform: translate(-10px, 25px) scale(0.2) rotate(-90deg); opacity: 0; }
}

@keyframes foodArc3 {
  0% { transform: translate(-150px, 40px) scale(0.6) rotate(45deg); opacity: 0; }
  30% { opacity: 1; transform: translate(-70px, -30px) scale(1.15) rotate(-20deg); }
  75% { opacity: 1; transform: translate(-10px, 0px) scale(0.85) rotate(15deg); }
  100% { transform: translate(20px, 30px) scale(0.2) rotate(60deg); opacity: 0; }
}

@keyframes foodArc4 {
  0% { transform: translate(130px, 60px) scale(0.5) rotate(-30deg); opacity: 0; }
  35% { opacity: 1; transform: translate(60px, -40px) scale(1.1) rotate(25deg); }
  80% { opacity: 1; transform: translate(10px, 10px) scale(0.8) rotate(-10deg); }
  100% { transform: translate(-15px, 35px) scale(0.2) rotate(30deg); opacity: 0; }
}

@keyframes foodArc5 {
  0% { transform: translate(0px, -140px) scale(0.5) rotate(0deg); opacity: 0; }
  30% { opacity: 1; transform: translate(-30px, -70px) scale(1.2) rotate(-35deg); }
  70% { opacity: 1; transform: translate(0px, -10px) scale(0.8) rotate(20deg); }
  100% { transform: translate(5px, 25px) scale(0.2) rotate(70deg); opacity: 0; }
}

@keyframes sparkleSpin {
  0%, 100% { transform: scale(0.7) rotate(0deg); opacity: 0.3; }
  50% { transform: scale(1.3) rotate(180deg); opacity: 1; }
}

@keyframes shimmerSlide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.fridge-container {
  animation: fridgeFloat 3.5s ease-in-out infinite;
}

.floating-food {
  position: absolute;
  font-size: 28px;
  line-height: 1;
  pointer-events: none;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.15));
}

.food-fly-1 { animation: foodArc1 2.4s cubic-bezier(0.4, 0, 0.2, 1) infinite; animation-delay: 0s; }
.food-fly-2 { animation: foodArc2 2.6s cubic-bezier(0.4, 0, 0.2, 1) infinite; animation-delay: 0.5s; font-size: 32px; }
.food-fly-3 { animation: foodArc3 2.5s cubic-bezier(0.4, 0, 0.2, 1) infinite; animation-delay: 1.0s; font-size: 26px; }
.food-fly-4 { animation: foodArc4 2.7s cubic-bezier(0.4, 0, 0.2, 1) infinite; animation-delay: 1.5s; font-size: 30px; }
.food-fly-5 { animation: foodArc5 2.3s cubic-bezier(0.4, 0, 0.2, 1) infinite; animation-delay: 0.8s; font-size: 28px; }

.sparkle-fly-1 {
  position: absolute;
  top: 15%;
  left: 20%;
  font-size: 20px;
  animation: sparkleSpin 2s ease-in-out infinite;
}

.sparkle-fly-2 {
  position: absolute;
  top: 35%;
  right: 18%;
  font-size: 22px;
  animation: sparkleSpin 2.4s ease-in-out infinite;
  animation-delay: 0.7s;
}

.loading-shimmer-bar {
  animation: shimmerSlide 1.5s linear infinite;
}
