/* Enhanced Header Styles */

/* Header container enhancements */
.takaful-header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(229, 231, 235, 0.8);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.takaful-header.scrolled {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Logo enhancements */
.logo-container {
  position: relative;
  overflow: hidden;
}

.logo-container::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: linear-gradient(135deg, #10b981, #059669);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: -1;
  opacity: 0.1;
}

.logo-container:hover::before {
  width: 100px;
  height: 100px;
}

/* Navigation link enhancements */
.nav-link {
  position: relative;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 100%;
  background: linear-gradient(135deg, #10b981, #059669);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: -1;
  opacity: 0.1;
}

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

.nav-link:hover {
  color: #059669;
  transform: translateY(-1px);
}

/* Active nav link */
.nav-link.active {
  color: #059669;
  background: rgba(16, 185, 129, 0.1);
}

.nav-link.active .nav-indicator {
  width: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
}

/* Button enhancements */
.header-btn {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.header-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.header-btn:hover::before {
  width: 200%;
  height: 200%;
}

.header-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(16, 185, 129, 0.3);
}

/* Cart button special effects */
.cart-btn {
  position: relative;
}

.cart-btn:hover .cart-icon {
  animation: cartBounce 0.6s ease-in-out;
}

@keyframes cartBounce {
  0%, 100% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.1) rotate(-5deg); }
  75% { transform: scale(1.1) rotate(5deg); }
}

/* Cart count enhancements */
.cart-count {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
  animation: cartCountPulse 2s infinite;
}

@keyframes cartCountPulse {
  0%, 100% { 
    transform: scale(1);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
  }
  50% { 
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
  }
}

/* User avatar enhancements */
.user-avatar {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.user-avatar:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

/* Dropdown enhancements */
.user-dropdown {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(229, 231, 235, 0.8);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  transform: translateY(-8px) scale(0.95);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.group:hover .user-dropdown {
  transform: translateY(0) scale(1);
}

.dropdown-item {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.dropdown-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0.1;
}

.dropdown-item:hover::before {
  width: 100%;
}

/* Mobile menu enhancements */
.mobile-menu {
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  backdrop-filter: blur(20px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border-top: 1px solid rgba(229, 231, 235, 0.8);
  border-bottom: 1px solid rgba(229, 231, 235, 0.8);
}

/* Force mobile menu to be hidden by default */
#mobile-menu {
  display: none !important;
}

/* Only show when hamburger is clicked and menu-open class is added */
#mobile-menu.menu-open {
  display: block !important;
}

/* Mobile menu button visibility */
#mobile-menu-btn {
  display: none;
}

@media (max-width: 1023px) {
  #mobile-menu-btn {
    display: block !important;
  }
}

/* Hide on large screens completely */
@media (min-width: 1024px) {
  #mobile-menu {
    display: none !important;
  }
  
  #mobile-menu.menu-open {
    display: none !important;
  }
  
  #mobile-menu-btn {
    display: none !important;
  }
}

.mobile-nav-item {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  border-radius: 0.5rem;
  margin: 0.125rem 0;
}

.mobile-nav-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0.08;
  z-index: 0;
}

.mobile-nav-item:hover::before {
  width: 100%;
}

.mobile-nav-item:hover {
  transform: translateX(4px);
  background: rgba(16, 185, 129, 0.05);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Hamburger menu animation */
.hamburger-line {
  transform-origin: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Notification styles */
.notification-badge {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  animation: notificationPulse 2s infinite;
}

@keyframes notificationPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Language and theme buttons */
.utility-btn {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.utility-btn:hover {
  transform: translateY(-1px);
  background: rgba(16, 185, 129, 0.1);
}

/* Search functionality (if needed) */
.search-btn {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-btn:hover {
  background: rgba(16, 185, 129, 0.1);
  transform: scale(1.05);
}

/* Responsive enhancements */
@media (max-width: 1024px) {
  .nav-link {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 768px) {
  .takaful-header {
    padding: 0.5rem 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
  }
  
  .logo-container img {
    height: 2rem;
  }
  
  /* Mobile menu should be hidden by default, even on mobile */
  #mobile-menu {
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    display: none !important;
  }
  
  /* Only show when explicitly opened with menu-open class */
  #mobile-menu.menu-open {
    display: block !important;
  }
  
  /* Mobile menu item improvements */
  .mobile-nav-item {
    padding: 0.875rem 1rem;
    margin: 0.25rem 0.5rem;
    font-weight: 500;
    color: #374151;
    border-radius: 0.75rem;
  }
  
  .mobile-nav-item i {
    color: #10b981;
    width: 1.25rem;
    text-align: center;
  }
  
  /* User info section in mobile */
  .mobile-user-info {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 1rem;
    padding: 1rem;
    margin: 0.5rem;
    color: white;
    box-shadow: 0 8px 16px -4px rgba(16, 185, 129, 0.3);
  }
  
  /* Mobile menu sections */
  .mobile-menu-section {
    border-top: 1px solid rgba(229, 231, 235, 0.6);
    padding-top: 1rem;
    margin-top: 1rem;
  }
  
  .mobile-menu-section:first-child {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
  }
}

/* Accessibility improvements */
.nav-link:focus,
.header-btn:focus,
.mobile-nav-item:focus {
  outline: 2px solid #10b981;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

/* Dark mode support (if implemented) */
@media (prefers-color-scheme: dark) {
  .takaful-header {
    background: rgba(17, 24, 39, 0.95);
    border-bottom-color: rgba(75, 85, 99, 0.8);
  }
  
  .user-dropdown {
    background: rgba(17, 24, 39, 0.95);
    border-color: rgba(75, 85, 99, 0.8);
  }
  
  .mobile-menu {
    background: rgba(17, 24, 39, 0.98);
  }
}

/* High-performance animations */
.will-change-transform {
  will-change: transform;
}

.will-change-opacity {
  will-change: opacity;
}

/* Smooth scrolling enhancement */
@supports (scroll-behavior: smooth) {
  html {
    scroll-behavior: smooth;
  }
}

/* Print styles */
@media print {
  .takaful-header {
    position: static !important;
    box-shadow: none !important;
    background: white !important;
  }
}
