/* --- Base Theme Variables --- */
:root {
  --primary-blue: #2563eb;
  --light-blue: #eff6ff;
  --dark-blue: #1e3a8a;
  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(255, 255, 255, 0.4);
}

/* --- Layout Reset --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #f8fafc;
  color: #1e293b;
  min-height: 100vh;
}

/* --- Glassmorphism Core --- */
.glass-header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
}

.glass-nav {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.03);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.glass-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.08);
}

/* --- Navigation & Links --- */
.nav-link {
  position: relative;
  cursor: pointer;
  transition: color 0.3s ease;
}

.nav-link::after {
  content: "";
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -4px;
  left: 0;
  background-color: var(--primary-blue);
  transition: width 0.3s ease;
}

.nav-link:hover::after {
  width: 100%;
}

.nav-link.active {
  color: var(--primary-blue);
  font-weight: 700;
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #bfdbfe;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-blue);
}

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

.page-transition {
  animation: fadeIn 0.4s ease-out forwards;
}

/* --- Status Badges --- */
.badge-blue { background: rgba(37, 99, 235, 0.1); color: #2563eb; }
.badge-green { background: rgba(34, 197, 94, 0.1); color: #16a34a; }
.badge-orange { background: rgba(249, 115, 22, 0.1); color: #ea580c; }
.badge-red { background: rgba(239, 68, 68, 0.1); color: #dc2626; }
.badge-purple { background: rgba(147, 51, 234, 0.1); color: #9333ea; }

/* Status Colors (Standard Utility Fallbacks) */
.bg-blue-100 { background-color: #dbeafe; }
.text-blue-600 { color: #2563eb; }
.bg-green-100 { background-color: #dcfce7; }
.text-green-600 { color: #16a34a; }
.bg-orange-100 { background-color: #ffedd5; }
.text-orange-600 { color: #ea580c; }
.bg-red-100 { background-color: #fee2e2; }
.text-red-600 { color: #dc2626; }
.bg-purple-100 { background-color: #f3e8ff; }
.text-purple-600 { color: #9333ea; }
.bg-amber-100 { background-color: #fef3c7; }
.text-amber-600 { color: #d97706; }

/* --- Chat Specifics --- */
#chat-content {
  scrollbar-width: thin;
}

.message-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 0.85rem;
  line-height: 1.4;
}

.message-bot {
  background: #f1f5f9;
  color: #334155;
  border-bottom-left-radius: 4px;
}

.message-user {
  background: var(--primary-blue);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

/* --- Dashboard Grid Helpers --- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.metric-card {
  padding: 1.5rem;
  border-radius: 1.25rem;
  display: flex;
  flex-direction: column;
}

/* --- Additional Animations --- */
@keyframes slide-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slide-out {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* --- Utility Classes --- */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.animate-slide-in {
  animation: slide-in 0.3s ease-out;
}

/* --- Cart Badge --- */
.shopping-cart-badge {
  transition: all 0.3s ease;
}

.shopping-cart-badge:empty {
  display: none;
}

#map {
  z-index: 0;
  border: 1px solid var(--glass-border);
}

/* --- Loading & Shimmer Effects --- */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.animate-shimmer {
  animation: shimmer 2s infinite linear;
  background: linear-gradient(to right, #f1f5f9 4%, #e2e8f0 25%, #f1f5f9 36%);
  background-size: 1000px 100%;
}

@keyframes glass-shine {
  0% {
    left: -100%;
    opacity: 0;
  }
  20% {
    left: 100%;
    opacity: 0.6;
  }
  100% {
    left: 100%;
    opacity: 0;
  }
}

.glass-shine-effect {
  position: relative;
  overflow: hidden;
}

.glass-shine-effect::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.4) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: skewX(-25deg);
  animation: glass-shine 3s infinite;
  z-index: 10;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.2);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 25px rgba(37, 99, 235, 0.5);
    transform: scale(1.05);
  }
}

.animate-pulse-glow {
  animation: pulse-glow 2s infinite;
}
/* --- Mobile Navigation Overhaul --- */
#mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 5rem;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.03);
    z-index: 2000;
    padding: 0 1rem;
    padding-bottom: env(safe-area-inset-bottom);
    justify-content: space-around;
    align-items: center;
}

#mobile-top-bar {
    display: none;
}

@media (max-width: 1024px) {
    #mobile-bottom-nav {
        display: flex;
    }
    
    #main-nav {
        display: block; /* Always show header */
    }

    #mobile-bottom-nav {
        display: flex; /* Show bottom nav on mobile */
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: calc(4.5rem + env(safe-area-inset-bottom));
        z-index: 2000;
    }
    
    #app-viewport {
        padding-top: 0.5rem;
        padding-bottom: calc(6rem + env(safe-area-inset-bottom));
    }
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: #64748b;
    font-size: 0.7rem;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    width: 20%;
}

.mobile-nav-item i {
    font-size: 1.5rem;
}

.mobile-nav-item.active {
    color: var(--primary-blue);
    transform: translateY(-5px);
}

.mobile-nav-item.active i {
    background: var(--light-blue);
    padding: 8px;
    border-radius: 50%;
    margin-bottom: -4px;
}

/* Mobile Side Menu States */
#mobile-side-menu.active {
    pointer-events: auto;
}

#mobile-side-menu.active #mobile-menu-overlay {
    opacity: 1;
}

#mobile-side-menu.active #mobile-menu-content {
    transform: translateX(0);
}

/* Responsive Grid Adjustments */
@media (max-width: 640px) {
    #app-viewport {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        padding-bottom: calc(5.5rem + env(safe-area-inset-bottom));
    }

    .glass-nav {
        top: 0;
        margin: 0 !important;
    }

    .hero-section {
        flex-direction: column;
        text-align: center;
        padding: 2rem 1rem;
    }
}

/* Hide chat on very small screens if it overlaps with bottom nav */
@media (max-width: 480px) {
    #chat-container {
        bottom: 6rem;
    }
}
