/* ================================
   CART PAGE STYLES
   ================================ */

/* Cart Page Container */

.cart-page-container {
  min-height: 60vh;
  padding: 2rem 0;
  background: var(--bg);
}

.cart-page-container .container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Cart Header */

.cart-header {
  margin-bottom: 2.5rem;
  margin-top: 1.5rem;
  text-align: center;
}

/* Breadcrumb styles now use the standard .breadcrumb classes from navigation.css */

.cart-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  margin-top: var(--space-lg);
  letter-spacing: -0.02em;
}

/* Loading State */

.cart-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1.5rem;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.cart-loading p {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin: 0;
}

/* Empty Cart State */

.cart-empty {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  margin-top: 2rem;
}

.cart-empty-content {
  max-width: 400px;
  margin: 0 auto;
}

.cart-empty-icon {
  margin-bottom: 1.5rem;
}

.cart-empty-icon svg {
  width: 80px;
  height: 80px;
  color: var(--text-muted);
  opacity: 0.6;
}

.cart-empty h2 {
  font-size: 1.5rem;
  color: var(--text);
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.cart-empty p {
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 1rem;
  line-height: 1.5;
}

.cart-empty-actions {
  display: flex;
  justify-content: center;
}

/* Cart Layout */

.cart-layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 3rem;
  align-items: start;
}

@media (max-width: 1024px) {
  .cart-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

/* Cart Items Section */

.cart-items-section {
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  overflow: hidden;
}

.cart-items-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev-2);
}

.cart-items-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.cart-clear-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cart-clear-btn:hover {
  background: var(--bg-elev-1);
  color: var(--text);
  border-color: var(--accent);
}

.cart-clear-btn svg {
  width: 16px;
  height: 16px;
}

/* Cart Items List */

.cart-items-list {
  padding: 0;
}

/* Individual Cart Item */

.cart-item {
  display: grid;
  grid-template-columns: 100px 1fr auto auto auto;
  gap: 1.5rem;
  align-items: center;
  padding: 2rem;
  border-bottom: 1px solid var(--line);
  transition: background-color 0.2s ease;
}

.cart-item:hover {
  background: var(--bg-elev-2);
}

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

.cart-item-image {
  width: 100px;
  height: 100px;
  overflow: hidden;
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
}

.cart-item-image img {
  width: 100%;
  height: 100%;
  -o-object-fit: cover;
     object-fit: cover;
  transition: transform 0.2s ease;
}

.cart-item:hover .cart-item-image img {
  transform: scale(1.05);
}

.cart-item-details {
  min-width: 0;
  /* Allows text truncation */
}

.cart-item-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.5rem 0;
  line-height: 1.4;
}

.cart-item-description {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 0.75rem 0;
  line-height: 1.4;
}

.cart-item-meta {
  display: flex;
  gap: 1rem;
}

.cart-item-sku {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: monospace;
}

/* Quantity Controls */

.cart-item-quantity {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.cart-item-quantity label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.quantity-controls {
  display: flex;
  align-items: center;
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  overflow: hidden;
}

.quantity-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1.2rem;
  font-weight: 600;
}

.quantity-btn:hover {
  background: var(--accent);
  color: var(--text-invert);
}

.quantity-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.quantity-input {
  width: 60px;
  height: 32px;
  text-align: center;
  background: transparent;
  border: none;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
}

.quantity-input:focus {
  outline: none;
  background: var(--bg-elev-1);
}

/* Price Display */

.cart-item-price {
  text-align: right;
  min-width: 120px;
}

.price-per-unit {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.price-total {
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 700;
}

/* Remove Button */

.cart-item-actions {
  display: flex;
  justify-content: center;
}

.cart-item-remove {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.cart-item-remove:hover {
  background: #dc2626;
  border-color: #dc2626;
  color: white;
  transform: scale(1.05);
}

.cart-item-remove svg {
  width: 18px;
  height: 18px;
}

/* Cart Summary Section */

.cart-summary-section {
  position: sticky;
  top: 2rem;
}

.cart-summary-card {
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  overflow: hidden;
}

.cart-summary-title {
  background: var(--bg-elev-2);
  padding: 1.5rem 2rem;
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--line);
}

.cart-summary-details {
  padding: 2rem;
}

.summary-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
}

.summary-line:not(.summary-total) {
  border-bottom: 1px solid var(--line);
}

.summary-line:last-child {
  margin-bottom: 0;
}

.summary-label {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.summary-value {
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
}

.summary-total {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 2px solid var(--line);
}

.summary-total .summary-label {
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 600;
}

.summary-total .summary-value {
  color: var(--accent);
  font-size: 1.3rem;
  font-weight: 700;
}

.shipping-free {
  color: #10b981 !important;
  font-weight: 600;
}

/* Cart Actions */

.cart-actions {
  padding: 2rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.btn-primary {
  background: var(--accent);
  color: var(--text-invert);
  border: 2px solid var(--accent);
  padding: 1rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  transition: all 0.2s ease;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary:hover {
  background: transparent;
  color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

.btn-large {
  padding: 1.25rem 2.5rem;
  font-size: 1.1rem;
}

/* Trust Indicators */

.cart-trust-indicators {
  padding: 1.5rem 2rem;
  background: var(--bg-elev-2);
  border-top: 1px solid var(--line);
}

.trust-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.trust-item:last-child {
  margin-bottom: 0;
}

.trust-item svg {
  width: 16px;
  height: 16px;
  color: #10b981;
  flex-shrink: 0;
}

/* Mobile Responsive */

@media (max-width: 768px) {
  .cart-page-container {
    padding: 1rem 0;
  }

  .cart-page-container .container {
    padding: 0 0.75rem;
  }

  .cart-title {
    font-size: 2rem;
  }

  .cart-header {
    margin-bottom: 1.5rem;
    margin-top: 1.5rem;
  }


  .cart-layout {
    gap: 1.5rem;
  }

  /* Mobile Cart Item Layout */
  .cart-item {
    grid-template-columns: 80px 1fr;
    gap: 1rem;
    padding: 1.5rem;
    grid-template-areas:
      "image details"
      "quantity price"
      "actions actions";
  }

  .cart-item-image {
    grid-area: image;
    width: 80px;
    height: 80px;
  }

  .cart-item-details {
    grid-area: details;
  }

  .cart-item-quantity {
    grid-area: quantity;
    align-items: flex-start;
  }

  .cart-item-price {
    grid-area: price;
    text-align: right;
  }

  .cart-item-actions {
    grid-area: actions;
    margin-top: 1rem;
    justify-content: flex-end;
  }

  .cart-items-header {
    padding: 1rem 1.5rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .cart-summary-title,
  .cart-summary-details,
  .cart-actions,
  .cart-trust-indicators {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .cart-empty {
    padding: 3rem 1.5rem;
    margin-top: 1rem;
  }

  .cart-empty-icon svg {
    width: 60px;
    height: 60px;
  }
}

@media (max-width: 480px) {
  .cart-title {
    font-size: 1.75rem;
  }

  .cart-item {
    padding: 1rem;
  }

  .cart-item-image {
    width: 70px;
    height: 70px;
  }

  .cart-item-name {
    font-size: 1rem;
  }

  .quantity-controls {
    transform: scale(0.9);
  }

  .cart-actions {
    padding: 1.5rem;
  }

  .btn-primary,
  .btn-ghost {
    padding: 1rem 1.5rem;
  }
}
