/* Base Styles */
body {
  font-family: 'Poppins', sans-serif;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  margin: 0;
  padding: 0;
}

main {
  flex: 1;
  margin: 0;
  padding: 0;
}

/* Form Container */
.form-container {
  margin-top: 80px; /* Fallback value for initial load */
}

/* Hero Section */
.hero-section {
  background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url('https://images.unsplash.com/photo-1516321310764-4d383dd9a5d9?q=80&w=2070&auto=format&fit=crop') center/cover no-repeat;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  text-align: center;
  position: relative;
  margin: 0 !important;
  padding: 0 !important;
  top: 0;
}

.hero-section::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.8), rgba(59, 130, 246, 0.8));
  z-index: 0; /* Ensure below navbar */
}

.hero-content {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 0;
}

/* Navbar */
.navbar {
  transition: background-color 0.3s ease;
  margin: 0;
  padding: 0;
}

.navbar.scrolled {
  background-color: #1e3a8a !important;
}

.navbar-row-main {
  flex-wrap: wrap;
}

.navbar-nav .nav-link {
  font-size: clamp(0.9rem, 2vw, 1rem);
  padding: 0.5rem 1rem;
  color: #fff !important;
  cursor: pointer;
  pointer-events: auto !important; /* Ensure clickable */
}

.navbar-nav .dropdown-toggle {
  pointer-events: auto !important; /* Explicitly ensure Products button is clickable */
}

.dropdown-menu {
  min-width: 12rem;
  padding: 0.5rem 0;
  background-color: #fff !important;
  border-radius: 0.25rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  z-index: 1002 !important; /* Increase to avoid overlap */
  pointer-events: auto !important; /* Ensure clickable */
}

.dropdown-item {
  color: #212529 !important;
  font-weight: 500;
  font-size: clamp(0.85rem, 1.8vw, 0.95rem);
  padding: 0.375rem 1.5rem;
  cursor: pointer;
  pointer-events: auto !important; /* Ensure clickable */
}

.dropdown-item:hover,
.dropdown-item:focus,
.dropdown-item:active {
  background-color: #f8f9fa !important;
  color: #0d6efd !important;
  text-decoration: none;
}

.dropdown-submenu {
  position: relative;
}

.dropdown-submenu > .dropdown-menu {
  top: 0;
  left: 100%;
  margin-left: 0.1rem;
  z-index: 1002 !important; /* Ensure above other elements */
  pointer-events: auto !important; /* Ensure clickable */
}

.dropdown-submenu:hover > .dropdown-menu {
  display: block;
}

.dropdown-submenu > a::after {
  content: '';
  display: inline-block;
  width: 0.4em;
  height: 0.4em;
  border-right: 2px solid #6c757d;
  border-bottom: 2px solid #6c757d;
  transform: rotate(-45deg);
  margin-left: 0.3rem;
  vertical-align: middle;
}

/* Second Row: Action Buttons and Welcome Message */
.navbar-row-actions {
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.25rem 0;
}

.welcome-message {
  font-size: clamp(0.9rem, 2vw, 1rem);
  white-space: nowrap;
}

.action-buttons {
  gap: 0.5rem;
}

.mobile-nav-btn {
  font-size: clamp(0.9rem, 2vw, 1rem);
  padding: 0.5rem 1rem;
  line-height: 1.5;
  border-radius: 5px;
  min-width: 100px;
  text-align: center;
}

.cart-btn .badge {
  font-size: 0.8rem;
}

/* Mobile Styles */
@media (max-width: 991px) {
  .navbar-row-main {
    flex-direction: row;
    align-items: center;
  }

  .navbar-nav {
    text-align: left;
    padding: 0.5rem;
    background-color: #343a40;
    z-index: 1002 !important; /* Ensure navbar is above other elements */
  }

  .navbar-nav .nav-link {
    font-size: clamp(1rem, 3vw, 1.1rem);
  }

  .dropdown-menu {
    position: static;
    width: 100%;
    box-shadow: none;
    background-color: #f8f9fa !important;
    margin-left: 0.5rem;
    z-index: 1002 !important; /* Ensure above other elements */
    pointer-events: auto !important; /* Ensure clickable */
  }

  .dropdown-submenu > .dropdown-menu {
    margin-left: 1rem;
    z-index: 1002 !important; /* Ensure above other elements */
    pointer-events: auto !important; /* Ensure clickable */
  }

  .navbar-row-actions {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    padding: 0.25rem 0;
  }

  .welcome-message {
    font-size: clamp(0.85rem, 2vw, 0.95rem);
    margin-bottom: 0.25rem;
  }

  .action-buttons {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .mobile-nav-btn {
    flex: 1 1 auto;
    min-width: 80px;
    max-width: 120px;
    margin: 0.25rem;
    padding: 0.5rem;
    font-size: clamp(0.85rem, 2vw, 0.95rem);
    border: 1px solid #fff;
    background-color: transparent;
    color: #fff !important;
  }

  .mobile-nav-btn:hover {
    background-color: #ffffff;
    color: #000 !important;
  }

  .cart-btn .badge {
    top: 5px;
    right: 10px;
    transform: translate(50%, -50%);
  }
}

@media (max-width: 576px) {
  .navbar-row-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .action-buttons {
    flex-direction: column;
    align-items: flex-start;
  }

  .mobile-nav-btn {
    width: 100%;
    max-width: 100%;
    margin: 0.25rem 0;
  }

  .welcome-message {
    font-size: clamp(0.8rem, 2vw, 0.9rem);
  }

  .hero-content {
    padding: 0 !important;
  }
}

/* Service Cards */
.service-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: none;
  border-radius: 10px;
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.service-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.card {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-img-top {
  height: 160px;
  width: 100%;
  object-fit: contain;
  padding: 0.5rem;
}

.card-body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
}

.card-title {
  font-size: clamp(0.9rem, 2.5vw, 1rem);
  margin-bottom: 0.5rem;
}

.card-text {
  font-size: clamp(0.8rem, 2vw, 0.85rem);
  flex-grow: 1;
}

.card .fw-semibold {
  font-size: clamp(0.85rem, 2vw, 0.9rem);
  margin-top: 0.75rem;
  text-align: center;
}

/* Contact Section */
.contact-section {
  background-color: #1e3a8a;
  color: white;
}

.btn-cta {
  background-color: #3b82f6;
  color: white;
  border: none;
  padding: 12px 24px;
  font-weight: bold;
  border-radius: 25px;
  transition: background-color 0.3s ease, transform 0.2s ease;
}

.btn-cta:hover {
  background-color: #2563eb;
  transform: scale(1.05);
}

/* Back-to-Top Button */
.back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: #3b82f6;
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1000;
}

.back-to-top.show {
  opacity: 1;
}

/* Carousel */
.carousel-caption {
  background: rgba(0, 0, 0, 0.7);
  border-radius: 10px;
}

#techCarousel .carousel-inner {
  max-height: 400px;
  border-radius: 1rem;
  overflow: hidden;
}

#techCarousel .carousel-item img {
  height: 400px;
  object-fit: cover;
  width: 100%;
  border-radius: 0.5rem;
}

.carousel-control-prev,
.carousel-control-next {
  width: 5%;
  opacity: 0.7;
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
  background-size: 100%, 100%;
  width: 30px;
  height: 30px;
}

.btn-primary {
  background-color: #2563eb;
  border-color: #2563eb;
}

.btn-outline-light:hover {
  background-color: #ffffff;
  color: #000;
}

.text-secondary {
  color: #9ca3af !important;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .hero-section {
    min-height: 100vh;
    margin: 0 !important;
    padding: 0 !important;
  }

  .hero-section h1 {
    font-size: clamp(1.8rem, 5vw, 2.5rem);
  }

  .hero-section p.lead {
    font-size: clamp(0.9rem, 2.5vw, 1rem);
  }

  #techCarousel .carousel-inner,
  #techCarousel .carousel-item img {
    max-height: 200px;
  }

  .row-cols-md-2 > .col,
  .row-cols-lg-4 > .col {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .carousel-control-prev,
  .carousel-control-next {
    width: 10%;
  }

  .carousel-control-prev-icon,
  .carousel-control-next-icon {
    width: 25px;
    height: 25px;
  }

  .card-img-top {
    height: 120px;
  }

  .card-title {
    font-size: clamp(0.85rem, 2.2vw, 0.95rem);
  }

  .card-text {
    font-size: clamp(0.75rem, 2vw, 0.8rem);
  }

  .back-to-top {
    width: 40px;
    height: 40px;
    bottom: 15px;
    right: 15px;
  }
}

@media (max-width: 576px) {
  .hero-section {
    min-height: 100vh;
    margin: 0 !important;
    padding: 0 !important;
  }

  .hero-section h1 {
    font-size: clamp(1.5rem, 4vw, 2rem);
  }

  .hero-section p.lead {
    font-size: clamp(0.8rem, 2vw, 0.9rem);
  }

  .navbar-brand {
    font-size: clamp(1rem, 3vw, 1.2rem);
  }

  .navbar-nav .nav-link {
    font-size: clamp(0.8rem, 2vw, 0.9rem);
  }

  #techCarousel .carousel-inner,
  #techCarousel .carousel-item img {
    max-height: 150px;
  }

  .contact-section iframe {
    height: 150px;
  }

  .btn-cta {
    padding: 8px 16px;
    font-size: clamp(0.8rem, 2vw, 0.9rem);
  }

  .carousel-control-prev-icon,
  .carousel-control-next-icon {
    width: 20px;
    height: 20px;
  }
}