/* Modern enhanced header design with animations and glass-morphism effects */

/* Base styles */
:root {
  --pine-green: #2e7d32;
  --pine-leaf: #1b5e20;
  --pine-yellow: #fde68a;
  --pine-yellow-deep: #f6c453;
  --transition-speed: 0.3s;
  --transition-smooth: 0.4s;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.16);
}

/* Header container with enhanced shadow and animation */
.header-container {
  background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
  box-shadow: var(--shadow-sm);
  position: relative;
  z-index: 1000;
  animation: slideDown 0.6s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Navbar styles */
.navbar {
  padding: 1.2rem 0;
  transition: all var(--transition-smooth) ease;
}

/* Logo with enhanced animation */
.header-logo {
  height: 45px;
  width: auto;
  transition: all var(--transition-smooth) cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.05));
}

.header-logo:hover {
  transform: scale(1.08);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

/* Navigation links with modern styling */
.nav-link {
  color: #2c3e50;
  text-decoration: none;
  padding: 10px 16px;
  display: block;
  position: relative;
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.3px;
  transition: all var(--transition-speed) ease;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 8px;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--pine-green), var(--pine-yellow-deep));
  transform: translateX(-50%);
  transition: width var(--transition-speed) cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-link:hover::after {
  width: 60%;
}

.nav-link:hover {
  color: var(--pine-green);
  transform: translateY(-2px);
}

/* Active state for navigation */
.nav-link.active {
  color: var(--pine-green) !important;
  font-weight: 700;
}

.nav-link.active::after {
  width: 60%;
}

/* Mobile menu button with animation */
.navbar-toggler {
  border: 2px solid var(--pine-green);
  padding: 0.5rem 0.75rem;
  font-size: 1.3rem;
  color: var(--pine-green);
  border-radius: 8px;
  transition: all var(--transition-speed) ease;
}

.navbar-toggler:focus,
.navbar-toggler:hover {
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
  outline: none;
  transform: scale(1.05);
}

/* Navigation icons */
.nav-icon {
  color: var(--pine-green);
  transition: all var(--transition-speed) cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  font-size: 1.3rem;
  border-radius: 50%;
}

.nav-icon:hover {
  color: var(--pine-yellow-deep);
  background: rgba(46, 125, 50, 0.08);
  transform: scale(1.15) rotate(3deg);
}

/* Badge styling */
.badge {
  background: linear-gradient(135deg, var(--pine-yellow-deep), var(--pine-yellow));
  color: var(--pine-green);
  font-size: 0.65rem;
  padding: 0.3rem 0.45rem;
  font-weight: 700;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Glass-morphism effect for dropdowns */
.cart-preview-dropdown,
.account-menu-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(46, 125, 50, 0.1);
  min-width: 300px;
  border-radius: 16px;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  z-index: 1000;
  opacity: 0;
  transform: translateY(10px) scale(0.95);
  transition: all var(--transition-smooth) cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

#cartIconLink:hover + .cart-preview-dropdown,
.cart-preview-dropdown:hover,
#accountIconLink:hover + .account-menu-dropdown,
.account-menu-dropdown:hover {
  display: block;
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.cart-preview-dropdown::before,
.account-menu-dropdown::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 20px;
  right: 0;
  height: 12px;
  background: transparent;
  pointer-events: none;
}

/* Dropdown header */
.cart-preview-header {
  padding: 1rem 1.2rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--pine-green);
  border-bottom: 2px solid rgba(46, 125, 50, 0.1);
  background: rgba(46, 125, 50, 0.02);
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  letter-spacing: 0.3px;
}

/* Cart preview list */
.cart-preview-list {
  padding: 0.75rem;
  max-height: 350px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cart-preview-list::-webkit-scrollbar {
  width: 6px;
}

.cart-preview-list::-webkit-scrollbar-track {
  background: rgba(46, 125, 50, 0.05);
  border-radius: 10px;
}

.cart-preview-list::-webkit-scrollbar-thumb {
  background: var(--pine-green);
  border-radius: 10px;
}

.cart-preview-list::-webkit-scrollbar-thumb:hover {
  background: var(--pine-leaf);
}

/* Cart items */
.cart-preview-item {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  border-radius: 10px;
  transition: all var(--transition-speed) cubic-bezier(0.34, 1.56, 0.64, 1);
  text-decoration: none;
  color: inherit;
  gap: 0.75rem;
}

.cart-preview-item:hover {
  background: rgba(46, 125, 50, 0.08);
  transform: translateX(4px);
}

.cart-preview-item img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.cart-preview-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.cart-preview-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #2c3e50;
}

.cart-preview-price {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--pine-green);
}

.cart-preview-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: #7f8c8d;
  font-size: 0.9rem;
}

/* Dropdown footer */
.cart-preview-footer {
  padding: 1rem 1.2rem;
  border-top: 2px solid rgba(46, 125, 50, 0.1);
  background: rgba(46, 125, 50, 0.02);
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
}

.cart-preview-count {
  font-size: 0.85rem;
  color: #7f8c8d;
  font-weight: 500;
}

.btn-action {
  background: linear-gradient(135deg, var(--pine-green), #1e5a1e);
  color: white !important;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all var(--transition-speed) cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
}

.btn-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(46, 125, 50, 0.3);
}

/* Account menu items */
.account-menu-item {
  display: block;
  padding: 0.85rem 1.2rem;
  color: #2c3e50;
  text-decoration: none;
  transition: all var(--transition-speed) ease;
  font-weight: 500;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(46, 125, 50, 0.05);
}

.account-menu-item:hover {
  background: rgba(46, 125, 50, 0.1);
  color: var(--pine-green);
  transform: translateX(4px);
}

.account-menu-item:last-child {
  border-bottom: none;
}

/* Mobile responsive */
@media (max-width: 991.98px) {
  .navbar-collapse {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    margin-top: 1rem;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(46, 125, 50, 0.1);
  }
  
  .nav-item {
    margin: 0.5rem 0;
  }
  
  .nav-link::after {
    display: none;
  }
  
  .d-lg-flex {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid rgba(46, 125, 50, 0.1);
  }
}

/* Mobile menu animations */
@keyframes fadeIn {
  from { 
    opacity: 0; 
    transform: translateY(-10px); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0); 
  }
}

.navbar-collapse.show {
  animation: fadeIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Sidebar styling with animations */
.sidebar {
  position: fixed;
  top: 0;
  left: -300px;
  width: 300px;
  height: 100%;
  background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
  z-index: 1050;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow-y: auto;
  box-shadow: 2px 0 var(--shadow-lg);
}

.sidebar.sidebar-open {
  transform: translateX(300px);
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 1040;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  backdrop-filter: blur(4px);
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem;
  border-bottom: 2px solid rgba(46, 125, 50, 0.1);
  background: linear-gradient(135deg, var(--pine-green), #1e5a1e);
}

.sidebar-logo {
  height: 40px;
  width: auto;
  filter: brightness(0) invert(1);
}

.sidebar-close {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  line-height: 1;
  border-radius: 8px;
  transition: all var(--transition-speed) ease;
}

.sidebar-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

.sidebar-nav {
  padding: 1rem 0;
}

.sidebar-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav li a {
  display: block;
  padding: 1rem 1.5rem;
  color: #2c3e50;
  text-decoration: none;
  transition: all var(--transition-speed) cubic-bezier(0.34, 1.56, 0.64, 1);
  font-size: 1rem;
  font-weight: 500;
  border-left: 3px solid transparent;
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active {
  background: rgba(46, 125, 50, 0.1);
  color: var(--pine-green);
  border-left-color: var(--pine-green);
  transform: translateX(4px);
}

body.sidebar-visible {
  overflow: hidden;
}

@media (min-width: 992px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.sidebar-open {
    transform: translateX(0);
  }
  
  .sidebar-overlay {
    display: none;
  }
  
  body.sidebar-visible {
    overflow: auto;
  }
}

.header-container {
  position: relative;
  z-index: 1060;
}

/* Very small devices */
@media (max-width: 400px) {
  .header-logo {
    height: 40px;
  }
  
  .navbar-toggler {
    font-size: 1.2rem;
    padding: 0.4rem 0.6rem;
  }
  
  .nav-link {
    font-size: 0.85rem;
    padding: 0.6rem 0.75rem !important;
  }

  .nav-icon {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
  }
}
