/* Floating Cart Button with Boxicon */
.floating-cart {
  position: fixed;
  bottom: 40px;
  right: 40px;
  background: #8B4513;
  color: white;
  padding: 0.8rem 1.2rem;
  border-radius: 50px;
  font-weight: bold;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  cursor: pointer;
  z-index: 1000;
  transition: transform 0.3s, box-shadow 0.3s;
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
}

.floating-cart:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0,0,0,0.3);
  background: #A0522D;
}

.floating-cart i {
  font-size: 1.2rem;
}

.floating-cart #cart-count {
  background: #ff9800;
  color: white;
  border-radius: 50%;
  padding: 2px 6px;
  font-size: 12px;
  min-width: 18px;
  height: 18px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

/* Navbar Cart Count Alignment Fix */
#navbar-cart-count {
  background: #ff9800;
  color: white;
  border-radius: 50%;
  padding: 2px 5px;
  font-size: 10px;
  font-weight: bold;
  margin-left: 5px;
  min-width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  vertical-align: middle;
}

/* Cart Drawer */
.cart-drawer {
  position: fixed;
  top: 0;
  right: -400px;
  width: 350px;
  max-width: 90%;
  height: 100vh;
  background: #fff;
  box-shadow: -2px 0 8px rgba(0,0,0,0.2);
  z-index: 999;
  display: flex;
  flex-direction: column;
  transition: right 0.4s ease-in-out;
  overflow: hidden;
}

.cart-drawer.open {
  right: 0;
}

/* Header */
.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #8B4513;
  color: white;
  padding: 1rem;
  flex-shrink: 0;
}

.cart-header h3 {
  margin: 0;
  font-size: 1.3rem;
}

.close-cart {
  background: transparent;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.close-cart:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Cart Items */
.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: #fafafa;
}

.cart-item {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid #eee;
  padding-bottom: 1rem;
  background: white;
  border-radius: 8px;
  padding: 1rem;
  transition: box-shadow 0.2s;
  align-items: center;
  flex-direction: row;
  text-align: left;
}

.cart-item:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.cart-item img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 8px;
  background: #f0f0f0;
  flex-shrink: 0;
}

.cart-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.cart-item-info h4 {
  color: #8B4513;
  margin: 0 0 0.3rem 0;
  font-size: 1rem;
  font-weight: bold;
}

.cart-item-info p {
  margin: 0.2rem 0;
  color: #555;
  font-size: 0.9rem;
}

.cart-item-qty {
  font-weight: bold;
  color: #8B4513;
  margin: 0.5rem 0;
}

/* Qty Management */
.qty-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
}

.qty-btn {
  background: #8B4513;
  color: white;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  font-weight: bold;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qty-btn:hover {
  background: #A0522D;
}

.qty-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.qty-input {
  width: 50px;
  text-align: center;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 0.3rem;
  font-size: 0.9rem;
}

.subtotal {
  font-weight: bold;
  color: #8B4513;
  font-size: 1rem;
  margin-top: 0.5rem;
}

/* Remove Button */
.remove-item {
  background: #dc3545;
  color: white;
  border: none;
  padding: 0.5rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: bold;
  transition: background 0.2s;
  flex-shrink: 0;
  align-self: flex-start;
}

.remove-item:hover {
  background: #c82333;
}

/* Empty Cart Message */
.cart-empty {
  display: none;
  text-align: center;
  padding: 3rem 1rem;
  color: #666;
  flex: 1;
  justify-content: center;
  align-items: center;
}

.cart-empty p {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.cart-empty a {
  color: #8B4513;
  text-decoration: none;
  font-weight: bold;
  border-bottom: 1px solid #8B4513;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  transition: background 0.2s;
}

.cart-empty a:hover {
  background: #8B4513;
  color: white;
}

/* Footer */
.cart-footer {
  padding: 1rem;
  border-top: 1px solid #ddd;
  background: #fafafa;
  text-align: center;
  flex-shrink: 0;
}

.cart-footer p {
  font-size: 1rem;
  margin-bottom: 1rem;
  font-weight: bold;
  color: #8B4513;
}

.cart-footer p strong {
  color: #8B4513;
}

.checkout-btn {
  background-color: #8B4513;
  color: white;
  padding: 0.7rem 1.2rem;
  border-radius: 6px;
  text-decoration: none;
  display: inline-block;
  font-weight: bold;
  transition: background 0.3s, transform 0.2s;
  width: 100%;
  box-sizing: border-box;
}

.checkout-btn:hover {
  background-color: #6F370F;
  transform: translateY(-1px);
}

/* Loading Spinner for Updates */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #8B4513;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Toast Notification */
.cart-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #28a745;
  color: white;
  padding: 12px 20px;
  border-radius: 6px;
  z-index: 1002;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-weight: bold;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Responsive - TABLET (768px and below) */
@media (max-width: 768px) {
  .floating-cart {
    bottom: 20px;
    right: 20px;
    padding: 0.7rem 1rem;
    font-size: 0.95rem;
  }

  .floating-cart i {
    font-size: 1.1rem;
  }

  .floating-cart #cart-count {
    min-width: 16px;
    height: 16px;
    font-size: 11px;
    padding: 1px 4px;
  }

  .cart-drawer {
    width: 100vw;
    max-width: none;
    right: -100vw;
  }

  .cart-drawer.open {
    right: 0;
  }

  .cart-header {
    padding: 0.8rem;
  }

  .cart-header h3 {
    font-size: 1.2rem;
  }

  .cart-items {
    padding: 0.8rem;
  }

  /* KEEP HORIZONTAL LAYOUT */
  .cart-item {
    gap: 0.8rem;
    padding: 0.8rem;
    flex-direction: row;
    text-align: left;
    align-items: flex-start;
  }

  .cart-item img {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
  }

  .qty-controls {
    justify-content: flex-start;
  }

  .remove-item {
    width: auto;
    align-self: auto;
  }

  .cart-footer {
    padding: 0.8rem;
  }

  .checkout-btn {
    padding: 0.8rem;
    font-size: 1rem;
  }
}

/* Responsive - MOBILE/ANDROID (480px and below) */
@media (max-width: 480px) {
  .qty-btn {
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
  }

  .qty-input {
    width: 45px;
    font-size: 0.9rem;
  }

  .cart-empty {
    padding: 2rem 0.5rem;
  }

  .cart-empty p {
    font-size: 1rem;
  }

  /* KEEP HORIZONTAL LAYOUT FOR ANDROID */
  .cart-item {
    gap: 0.6rem;
    padding: 0.6rem;
    flex-direction: row;
    text-align: left;
    align-items: center;
  }

  .cart-item img {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
  }

  .cart-item-info h4 {
    font-size: 0.9rem;
  }

  .cart-item-info p {
    font-size: 0.8rem;
  }

  .qty-controls {
    justify-content: flex-start;
    gap: 0.3rem;
  }

  .remove-item {
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
    width: auto;
  }

  .floating-cart {
    bottom: 15px;
    right: 15px;
    padding: 0.6rem 0.9rem;
    font-size: 0.85rem;
  }

  .cart-drawer {
    width: 100vw;
  }
}