/* Header Cart Styles */

/* Cart item in navigation */
.nav-cart-item {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  margin-left: 0;
  vertical-align: baseline;
}

/* Cart button in header */
.nav-cart-button {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: var(--space-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform var(--transition-fast);
  vertical-align: baseline;
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
}

.nav-cart-button:hover {
  transform: scale(1.1);
}

.nav-cart-button:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Cart icon */
.nav-cart-icon {
  width: 28px;
  height: 28px;
  fill: currentColor;
  color: var(--color-text-primary);
  transition: color var(--transition-fast);
}

/* Theme-aware colors */
[data-theme="light"] .nav-cart-icon,
:root:not([data-theme]) .nav-cart-icon {
  color: var(--color-black);
}

[data-theme="dark"] .nav-cart-icon {
  color: var(--color-white);
}

/* Cart badge in header */
.nav-cart-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: var(--color-red);
  color: var(--color-white);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-code);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  animation: pulse 0.3s ease-out;
}

.nav-cart-badge.pulse {
  animation: pulse 0.3s ease-out;
}

/* Mobile styles */
@media (max-width: 768px) {
  /* Position cart icon in mobile header */
  .nav-cart-item {
    position: fixed !important; /* Fixed to viewport, no parent transform */
    right: 80px; /* Position to the left of hamburger menu with more spacing */
    top: var(--space-lg); /* Align with hamburger vertical position */
    transform: none;
    margin: 0;
    z-index: 1001; /* Same as hamburger menu */
  }
  
  .nav-cart-button {
    padding: var(--space-sm);
    min-width: 44px;
    min-height: 44px;
  }
  
  .nav-cart-icon {
    width: 34px;
    height: 34px;
  }

  .nav-cart-badge {
    top: -3px;
    right: -3px;
    min-width: 18px;
    height: 18px;
    font-size: 11px;
    padding: 0 4px;
  }
}

/* Tablet specific adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
  .nav-cart-item {
    margin-left: 0;
  }
}

/* Desktop adjustments for alignment */
@media (min-width: 1025px) {
  .nav-cart-item {
    margin-left: 0;
  }

  /* Ensure cart icon aligns with nav text baseline */
  .nav-cart-button {
    display: inline-flex;
    align-items: baseline;
    vertical-align: baseline;
  }
}


/* Animation */
@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .nav-cart-icon {
    stroke: currentColor;
    stroke-width: 0.5;
  }
  
  .nav-cart-badge {
    border: 1px solid var(--color-white);
  }
}

/* Print styles */
@media print {
  .nav-cart-item {
    display: none !important;
  }
}