/*
 * Sticky Menu with Transparent Effect on Scroll
 * PT Teknindo Geosistem Unggul
 */

/* ============================================
   STICKY HEADER ENHANCEMENT
   ============================================ */

/* Default Header State - Override existing sticky behavior */
#header {
  position: fixed !important;
  top: 0 !important;
  left: 0;
  width: 100%;
  z-index: 999;
  transition: all 0.4s ease-in-out;
  background-color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transform: translateY(0) !important;
  opacity: 1 !important;
}

/* Ensure header is always visible - override any existing hide behavior */
#header.sticky-on-scrollup {
  position: fixed !important;
  top: 0 !important;
  transform: translateY(0) !important;
  opacity: 1 !important;
}

/* Override any existing show-sticky-onscroll behavior */
#header.sticky-on-scrollup.show-sticky-onscroll {
  position: fixed !important;
  top: 0 !important;
  transform: translateY(0) !important;
  opacity: 1 !important;
}

/* Override any existing show-sticky-onscroll behavior */
#header.sticky-on-scrollup.show-sticky-onscroll {
  position: fixed !important;
  top: 0 !important;
  transform: translateY(0) !important;
  opacity: 1 !important;
}

/* Force header to always be visible regardless of existing classes */
#header.sticky-on-scrollup:not(.show-sticky-onscroll) {
  position: fixed !important;
  top: 0 !important;
  transform: translateY(0) !important;
  opacity: 1 !important;
}

/* Header when scrolled down - Transparent with blur */
#header.header-scrolled {
  background-color: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  position: fixed !important;
  top: 0 !important;
  transform: translateY(0) !important;
  opacity: 1 !important;
}

/* Header wrap */
#header-wrap {
  transition: all 0.4s ease-in-out;
}

/* Reduce header height when scrolled 
#header.header-scrolled #header-wrap {
  padding: 10px 0;
}*/

/* Logo size adjustment when scrolled 
#header.header-scrolled #logo img {
  max-height: 50px;
  transition: all 0.4s ease-in-out;
}*/

#logo img {
  max-height: 60px;
  transition: all 0.4s ease-in-out;
}

/* ============================================
   MENU STYLING
   ============================================ */

/* Primary Menu */
.primary-menu {
  transition: all 0.3s ease;
}

/* Menu Links */
.menu-link {
  transition: all 0.3s ease;
  position: relative;
}

/* Menu Link Hover Effect */
.menu-link:hover {
  color: #E67300 !important;
}

/* Active Menu Item */
.menu-item.current .menu-link {
  color: #E67300 !important;
}

/* Menu Link Underline Effect */
.menu-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: #E67300;
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.menu-link:hover::after,
.menu-item.current .menu-link::after {
  width: 80%;
}

/* ============================================
   DROPDOWN MENU ENHANCEMENT
   ============================================ */

/* Dropdown Container */
.sub-menu-container {
  background-color: #ffffff !important;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border: none;
  padding: 10px 0;
  margin-top: 10px;
  min-width: 250px;
  max-height: 500px;
  overflow-y: auto;
  animation: fadeInDown 0.3s ease;
}

/* Dropdown Animation */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Dropdown Menu Items */
.sub-menu-container .menu-item {
  transition: all 0.2s ease;
}

.sub-menu-container .menu-item:hover {
  background-color: #f8f9fa;
}

/* Dropdown Links */
.sub-menu-container .menu-link {
  padding: 12px 25px;
  color: #264653 !important;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.sub-menu-container .menu-link:hover {
  color: #E67300 !important;
  padding-left: 30px;
  background-color: rgba(230, 115, 0, 0.05);
}

/* Product Dropdown Special Styling */
.sub-menu-container .menu-link div {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Scrollbar for long dropdown */
.sub-menu-container::-webkit-scrollbar {
  width: 6px;
}

.sub-menu-container::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.sub-menu-container::-webkit-scrollbar-thumb {
  background: #264653;
  border-radius: 10px;
}

.sub-menu-container::-webkit-scrollbar-thumb:hover {
  background: #E67300;
}

/* ============================================
   MOBILE MENU
   ============================================ */

@media (max-width: 991px) {
  /* Mobile Header */
  #header {
    background-color: #ffffff;
  }
  
  #header.header-scrolled {
    background-color: rgba(255, 255, 255, 0.98);
  }
  
  /* Mobile Menu Container */
  .primary-menu {
    background-color: #ffffff;
  }
  
  /* Mobile Dropdown */
  .sub-menu-container {
    position: static !important;
    box-shadow: none;
    border-left: 3px solid #E67300;
    margin-left: 15px;
    margin-top: 5px;
    padding-left: 10px;
    max-height: 400px;
  }
  
  /* Mobile Menu Links */
  .sub-menu-container .menu-link {
    padding: 10px 15px;
    font-size: 13px;
  }
  
  .sub-menu-container .menu-link:hover {
    padding-left: 20px;
  }
}

/* ============================================
   HEADER MISC (WhatsApp Button)
   ============================================ */

.header-misc .btn {
  transition: all 0.3s ease;
}

.header-misc .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(230, 115, 0, 0.3);
}

/* ============================================
   SMOOTH SCROLL BEHAVIOR
   ============================================ */

html {
  scroll-behavior: smooth;
}

/* Offset for sticky header */
:target {
  scroll-margin-top: 100px;
}

/* ============================================
   LOADING STATE
   ============================================ */

#header.loading {
  pointer-events: none;
  opacity: 0.7;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Focus States */
.menu-link:focus {
  outline: 2px solid #E67300;
  outline-offset: 2px;
}

/* Skip to Content Link */
.skip-to-content {
  position: absolute;
  top: -40px;
  left: 0;
  background: #264653;
  color: white;
  padding: 8px 16px;
  text-decoration: none;
  z-index: 10000;
  transition: top 0.3s;
}

.skip-to-content:focus {
  top: 0;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  #header {
    position: static;
    background: white;
    box-shadow: none;
  }
  
  .header-misc,
  .sub-menu-container {
    display: none;
  }
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* GPU Acceleration */
#header,
.menu-link,
.sub-menu-container {
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Reduce Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
  #header,
  .menu-link,
  .sub-menu-container,
  .menu-link::after {
    transition: none;
    animation: none;
  }
}
