:root {
  --primary-color: #4f46e5;
  --primary-hover: #4338ca;
  --bg-color: #f8fafc;
  --card-bg: rgba(255, 255, 255, 0.9);
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: rgba(0, 0, 0, 0.08);
}

html {
  font-size: 13.5px; /* Scales down Bootstrap's rem units globally */
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.08s ease-out;
}

body.page-loaded {
  opacity: 1;
}

/* Glassmorphism Navbar */
.navbar {
  background: rgba(255, 255, 255, 0.8) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.5rem;
  background: linear-gradient(135deg, #a855f7, #4f46e5);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.nav-link {
  color: var(--text-main) !important;
  font-weight: 500;
  transition: color 0.3s ease;
}

.nav-link:hover {
  color: var(--primary-color) !important;
}

.nav-icon {
  color: var(--text-main);
  transition: color 0.3s ease;
}

.nav-icon:hover {
  color: var(--primary-color);
}

/* Product Cards */
.product-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  height: 100%;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
  border-color: rgba(79, 70, 229, 0.2);
}

.product-img-wrapper {
  height: 250px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.product-img-wrapper i {
  font-size: 5rem;
  color: #cbd5e1;
  transition: transform 0.5s ease;
}

.product-card:hover .product-img-wrapper i {
  transform: scale(1.1);
  color: rgba(79, 70, 229, 0.2);
}

.product-details {
  padding: 1.5rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: auto !important;
}

.product-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-main);
  text-decoration: none;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-title:hover {
  color: var(--primary-color);
}

.product-price {
  font-size: 1.4rem;
  font-weight: 800;
  color: #0f172a;
}

/* Buttons */
.btn-primary-custom {
  background: linear-gradient(135deg, #4f46e5, #a855f7);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.5rem;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.25);
}

.btn-primary-custom:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
  color: white;
}

.btn-outline-custom {
  background: transparent;
  color: var(--text-main);
  border: 1px solid rgba(15, 23, 42, 0.2);
  border-radius: 8px;
  padding: 0.6rem 1.5rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

.btn-outline-custom:hover {
  background: #f1f5f9;
  border-color: var(--text-main);
  color: var(--text-main);
}

/* Footer */
.footer {
  margin-top: auto;
  background: #ffffff;
  border-top: 1px solid var(--border-color);
  padding: 3rem 0;
}

.footer-title {
  color: var(--text-main);
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.3s ease;
  display: block;
  margin-bottom: 0.5rem;
}

.footer-link:hover {
  color: var(--primary-color);
}

/* Category Badges */
.badge-category {
  background-color: #f1f5f9;
  color: #475569;
  font-weight: 500;
  padding: 0.4em 0.8em;
  border: 1px solid #e2e8f0;
}

/* Mobile Responsiveness Improvements */
@media (max-width: 768px) {
  html {
    font-size: 12.5px; /* Scales down all rem-based sizes on mobile */
  }

  .product-img-wrapper {
    height: 180px; /* Smaller image areas on mobile */
  }

  .product-details {
    padding: 1rem; /* Less padding inside cards */
  }

  .carousel-item img {
    height: 250px !important; /* Force smaller hero banner on mobile */
    max-height: 250px !important;
  }

  .navbar-brand {
    font-size: 1.25rem;
  }
  
  .py-5 {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
  }
}

/* Dark Mode Overrides */
[data-bs-theme="dark"] {
  --bg-color: #0f172a;
  --card-bg: rgba(30, 41, 59, 0.9);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] body {
  background-color: var(--bg-color);
  color: var(--text-main);
}

[data-bs-theme="dark"] .bg-white {
  background-color: var(--card-bg) !important;
}

[data-bs-theme="dark"] .bg-light {
  background-color: rgba(255, 255, 255, 0.05) !important;
}

[data-bs-theme="dark"] .text-dark {
  color: var(--text-main) !important;
}

[data-bs-theme="dark"] .text-muted {
  color: var(--text-muted) !important;
}

[data-bs-theme="dark"] .navbar {
  background: rgba(15, 23, 42, 0.8) !important;
}

[data-bs-theme="dark"] .footer {
  background: #0b1120;
}

[data-bs-theme="dark"] .product-img-wrapper {
  background: rgba(255, 255, 255, 0.02);
}

[data-bs-theme="dark"] .product-card:hover {
  border-color: rgba(168, 85, 247, 0.4);
}

[data-bs-theme="dark"] .btn-outline-custom {
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

[data-bs-theme="dark"] .btn-outline-custom:hover {
  background: rgba(255, 255, 255, 0.1);
}
