/* Enhanced Responsive CSS for Welcome Page */

/* Base styles with improved responsive units */
.bg {
  background-color: #f9faf4ea;
  padding-top: 70px;
}

/* Hero Section - Improved responsiveness */
.hero-section {
  min-height: 80vh;
  padding-top: 0;
  display: flex;
  align-items: center;
}

@media (min-width: 992px) {
  .hero-section {
    padding-top: 2rem;
  }
}

.hero-img {
  height: 75vh;
  object-fit: cover;
}

.hero-overlay {
  position: absolute;
  bottom: 15px;
  left: 15px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 10px;
}

/* Improved responsive typewriter */
.custom-hero-title {
  font-size: clamp(1.75rem, 5vw, 6rem); /* Fluid typography */
  font-weight: 400;
  line-height: 1.2;
  font-family: 'Jost', sans-serif;
  white-space: normal;
  overflow: hidden;
  width: 100%;
  word-wrap: break-word;
}

/* Apply the caret effect only to the span */
.typewriter-caret {
  display: inline;
  border-right: 2px solid #6cc51d;
  animation: blink-caret 0.75s step-end infinite;
}

/* Caret animation */
@keyframes blink-caret {
  from, to { border-color: transparent; }
  50% { border-color: #6cc51d; }
}

.hero-image-wrapper img {
  opacity: 1;
  transition: opacity 1s ease-in-out;
  height: clamp(300px, 50vh, 500px); /* Responsive height */
  object-fit: cover;
}

.hero-image-wrapper img.fade-out {
  opacity: 0;
}

.paragraph {
  font-family: 'Jost', sans-serif;
  font-size: clamp(1rem, 2.5vw, 1.2rem); /* Fluid font size */
  line-height: 1.5;
  color: #333; /* Better contrast */
  margin-bottom: 1.5rem;
}

/* Improved responsive buttons */
.custom-login-btn,
.custom-register-btn {
  padding: 0.5rem 1rem;
  font-weight: 500;
  border-radius: 5rem;
  transition: all 0.3s ease-in-out;
  font-family: 'Jost', sans-serif;
  font-size: clamp(0.875rem, 2vw, 1rem); /* Responsive button text */
}

.btn-shop-now {
  background: linear-gradient(135deg, #6cc51d, #4ba600);
  color: #fff;
  padding: clamp(0.6rem, 2vw, 0.75rem) clamp(1rem, 3vw, 1.5rem); /* Responsive padding */
  font-weight: 600;
  border-radius: 2rem;
  transition: all 0.3s ease-in-out;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-size: clamp(0.9rem, 2vw, 1rem);
}

.btn-shop-now:hover {
  background: linear-gradient(135deg, #5cb618, #3f9200);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  transform: translateY(-2px);
}

.animate-icon {
  transition: transform 0.3s ease;
}

.btn-shop-now:hover .animate-icon {
  transform: translateX(5px) rotate(5deg);
}

/* Login Button */
nav .custom-login-btn {
  background-color: #343a40;
  color: #fff;
  border: none;
}

nav .custom-login-btn:hover {
  background-color: #1d2124;
  color: #f8f9fa;
}

/* Register Button */
nav .custom-register-btn {
  background-color: #6cc51d;
  color: #fff;
  border: none;
}

nav .custom-register-btn:hover {
  background-color: #5cb618;
  color: #fff;
}

nav a .nav-link {
  font-size: clamp(1rem, 2vw, 1.1rem);
  font-weight: 500;
  font-family: 'Jost', sans-serif;
}

/* Services Section - Improved responsiveness */
.service-card {
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  height: 100%;
}

.service-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.1);
}

.service-card img {
  object-fit: cover;
  height: clamp(150px, 25vw, 200px); /* Responsive image height */
}

.card-title {
  font-size: clamp(1.1rem, 2.5vw, 1.25rem);
  font-family: 'Jost', sans-serif;
}

/* Brands Section - Improved responsive scrolling */
.logo-carousel {
  overflow: hidden;
  position: relative;
  width: 100%;
}

.logo-track {
  animation: scrollLeft 30s linear infinite;
  display: flex;
  gap: clamp(20px, 5vw, 40px); /* Responsive gap */
  align-items: center;
}

.logo-track img {
  height: clamp(30px, 8vw, 50px); /* Responsive logo size */
  width: auto;
  object-fit: contain;
  opacity: 0.9;
  transition: transform 0.3s ease;
}

.logo-track img:hover {
  transform: scale(1.1);
  opacity: 1;
}

/* Keyframes for scrolling animation */
@keyframes scrollLeft {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

/* Optional: Pause on hover */
.logo-carousel:hover .logo-track {
  animation-play-state: paused;
}

/* Delivery Section - Improved responsive images */
.delivery-img {
  height: clamp(200px, 40vh, 350px); /* Responsive height */
  object-fit: cover;
  border-radius: 1rem;
}

/* Keyframes for fade & slide */
@keyframes fadeUp {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Apply animation only on active slide */
.carousel-item.active .carousel-caption h5 {
  animation: fadeUp 0.8s ease-in-out both;
}

.carousel-item.active .carousel-caption p {
  animation: fadeUp 0.8s ease-in-out both;
  animation-delay: 0.2s;
}

/* Referral Section - Improved responsive layout */
.mini-card {
  min-width: clamp(80px, 20vw, 150px); /* Responsive width */
  height: clamp(70px, 15vw, 100px); /* Responsive height */
  background: #fff;
  border-radius: 0.5rem;
  padding: clamp(0.4rem, 1.5vw, 0.5rem) clamp(0.8rem, 2vw, 1rem); /* Responsive padding */
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  font-size: clamp(0.75rem, 2vw, 0.875rem); /* Responsive font size */
}

/* === Card Base === */
.custom-card {
  border-radius: 1rem;
  padding: clamp(1rem, 3vw, 1.5rem); /* Responsive padding */
  border: 1px solid transparent;
  background-color: #f8f9fa;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* === Referral Code Card (Green Theme) === */
.custom-card.referral {
  background-color: rgba(159, 238, 90, 0.89);
  border: 1px solid #427516;
  color: #212220;
}

.custom-card.referral .mini-card {
  background-color: #d1f2fa;
  color: #065f46;
}

/* === Invite Friends Card (Blue Theme) === */
.custom-card.invite {
  background-color: rgba(159, 238, 90, 0.89);
  border: 1px solid #427516;
  color: #212220;
}

.custom-card.invite .mini-card {
  background-color: #dbeafe;
  color: #1e3a8a;
}

/* === Reward Card (Teal Theme) === */
.custom-card.reward {
  background-color: rgba(159, 238, 90, 0.89);
  border: 1px solid #427516;
  color: #212220;
}

/* Optional: Hover effect */
.custom-card:hover {
  background-color: #fff;
  box-shadow: 0 0.75rem 1rem rgba(0, 0, 0, 0.05);
}

/* Category Section - Improved responsive grid */
.category-card {
  height: 100%;
  min-height: clamp(150px, 30vw, 220px); /* Responsive minimum height */
  position: relative;
  overflow: hidden;
  border-radius: 15px;
}

.category-card img {
  transition: transform 0.4s ease;
  object-fit: cover;
  width: 100%;
  height: 100%;
}

.category-card:hover img {
  transform: scale(1.05);
}

.category-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
  color: #fff;
  padding: clamp(0.5rem, 2vw, 1rem) clamp(0.75rem, 2vw, 1.5rem); /* Responsive padding */
  font-size: clamp(0.8rem, 2vw, 0.9rem); /* Responsive font size */
}

.category-card:hover {
  transform: scale(1.02);
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Mobile-specific improvements */
@media (max-width: 768px) {
  .hero-section {
    min-height: 70vh;
    padding-top: 1rem;
  }

  .hero-image-wrapper img {
    height: 40vh;
    margin-top: 1rem;
  }

  .service-card {
    margin-bottom: 1.5rem;
  }

  .custom-card {
    margin-bottom: 1rem;
  }

  /* Stack referral cards on mobile */
  .referral-section .row {
    flex-direction: column;
  }

  .referral-section .col-md-6 {
    width: 100%;
  }
}

/* Extra small devices */
@media (max-width: 576px) {
  .bg {
    padding-top: 60px;
  }

  .hero-section {
    min-height: 60vh;
  }

  .hero-image-wrapper img {
    height: 30vh;
  }

  .btn-shop-now {
    width: 100%;
    justify-content: center;
  }

  .logo-track {
    gap: 15px;
  }

  .delivery-img {
    height: 180px;
  }
}

/* Large screens optimization */
@media (min-width: 1400px) {
  .container {
    max-width: 1320px;
  }

  .hero-section {
    min-height: 85vh;
  }
}

/* Fix for category section on mobile */
#categoryCarousel .category-card {
  height: 250px;
  margin: 0 10px;
}

/* Ensure proper spacing in all sections */
section {
  padding: clamp(2rem, 5vw, 3rem) 0;
}

/* Headings responsive sizing */
h1 {
  font-size: clamp(1.8rem, 5vw, 2.5rem);
}

h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
}

h5 {
  font-size: clamp(1.1rem, 2.5vw, 1.25rem);
}
