:root {
  --primary-color: #ff6b8b;
  --primary-gradient: linear-gradient(135deg, #ff6b8b, #ff8fab);
  --primary-hover: #ff5a7a;
  --secondary-color: #f8f9fa;
  --text-color: #333;
  --text-light: #666;
  --background: #f9f9f9;
  --card-bg: #ffffff;
  --border-color: #e9ecef;
  --success-color: #28a745;
  --danger-color: #dc3545;
  --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 4px 15px rgba(0, 0, 0, 0.15);
  --shadow-heavy: 0 10px 30px rgba(0, 0, 0, 0.2);
  --border-radius: 12px;
  --transition: all 0.3s ease;
}

.cart-page {
  padding: 2rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  min-height: 60vh;
}

.cart-header {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 2rem;
}

.back-to-cart-btn {
  background-color: #a67f83;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
}

.back-to-cart-btn:hover {
  background-color: #8c6a6e;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(166, 127, 131, 0.4);
}

.back-to-cart-btn i {
  font-size: 0.8rem;
}

.cart-page h1 {
  text-align: center;
  margin-bottom: 2.5rem;
  color: #f7e7ce;
  font-size: 2.5rem;
  font-weight: 700;
  position: relative;
  display: inline-block;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
}

.cart-page h1:after {
  content: "";
  position: absolute;
  width: 60%;
  height: 4px;
  background: #f7e7ce;
  bottom: -10px;
  left: 20%;
  border-radius: 2px;
}

.cart-container {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2.5rem;
  min-height: 60vh;
  align-items: start;
}

/* Cart Items */
.cart-items {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.cart-empty {
  text-align: center;
  padding: 4rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  min-height: 50vh;
  max-width: 600px;
  width: 100%;
}

.cart-empty i {
  font-size: 4.5rem;
  color: var(--primary-color);
  margin-bottom: 1.5rem;
  opacity: 0.7;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-15px);
  }
  60% {
    transform: translateY(-7px);
  }
}

.cart-empty h2 {
  color: #a67f83;
  margin-bottom: 1rem;
  font-size: 1.8rem;
  font-weight: 700;
}

.cart-empty p {
  color: var(--text-light);
  margin-bottom: 2rem;
  font-size: 1.1rem;
  max-width: 400px;
  line-height: 1.6;
}

.cart-empty .btn {
  background-color: #a67f83;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.3s ease;
  letter-spacing: 0.5px;
}

.cart-empty .btn:hover {
  background-color: #8c6a6e;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(166, 127, 131, 0.4);
}

.cart-empty .btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(166, 127, 131, 0.4);
}

.cart-items-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.cart-item {
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  display: grid;
  grid-template-columns: 140px 1fr auto auto;
  gap: 1.5rem;
  align-items: center;
  background: var(--card-bg);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-light);
}

.cart-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-medium);
  border-color: var(--primary-color);
}

.cart-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary-gradient);
  opacity: 0;
  transition: var(--transition);
}

.cart-item:hover::before {
  opacity: 1;
}

.cart-item-image {
  width: 140px;
  height: 140px;
  flex-shrink: 0;
  border-radius: 10px;
  overflow: hidden;
  background: var(--secondary-color);
  border: 1px solid var(--border-color);
  padding: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-light);
  transition: var(--transition);
}

.cart-item-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: var(--transition);
  border-radius: 6px;
}

.cart-item:hover .cart-item-image {
  box-shadow: var(--shadow-medium);
  transform: scale(1.02);
}

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

.cart-item-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-right: 1rem;
}

.cart-item-details h3 {
  margin: 0;
  color: var(--text-color);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.3;
}

.cart-item-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.cart-item-options p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0;
}

.cart-item-options .color-preview {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 0 0 1px var(--border-color);
  flex-shrink: 0;
}

.cart-item-price {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary-color);
  text-align: right;
  margin-left: auto;
}

.cart-item-quantity {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--secondary-color);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-light);
}

.cart-item-quantity .quantity {
  font-weight: 600;
  color: var(--text-color);
  font-size: 0.95rem;
}

.quantity-btn {
  background: var(--primary-gradient);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  color: white;
  transition: var(--transition);
  font-weight: 600;
  box-shadow: var(--shadow-light);
}

.quantity-btn:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-medium);
}

.quantity-btn:active {
  transform: scale(0.95);
}

.remove-item {
  background: white;
  border: 2px solid var(--danger-color);
  color: var(--danger-color);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0.5rem;
  transition: var(--transition);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-light);
}

.remove-item:hover {
  background: var(--danger-color);
  color: white;
  transform: scale(1.1);
  box-shadow: var(--shadow-medium);
}

.remove-item:active {
  transform: scale(0.95);
}

.cart-item-title {
  font-size: 1.2rem;
  color: var(--text-color);
  margin: 0 0 0.5rem 0;
  font-weight: 600;
  transition: var(--transition);
}

.cart-item-price {
  font-weight: 700;
  color: var(--primary-color);
  font-size: 1.25rem;
  margin: 0.5rem 0;
}

.cart-item-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.quantity-controls {
  display: flex;
  align-items: center;
  background: #f8f9fa;
  border-radius: 50px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.quantity-btn {
  background: transparent;
  border: none;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--text-color);
  transition: var(--transition);
}

.quantity-btn:hover {
  background: var(--background);
  color: var(--primary-color);
}

.quantity-input {
  width: 40px;
  height: 36px;
  text-align: center;
  border: none;
  background: transparent;
  font-size: 1rem;
  color: var(--text-color);
  -moz-appearance: textfield;
  -webkit-appearance: none;
  appearance: none;
  padding: 0;
}

.quantity-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--primary-color);
  border-radius: 4px;
}

.quantity-input::-webkit-outer-spin-button,
.quantity-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.remove-item {
  background: rgba(255, 107, 107, 0.1);
  border: none;
  color: var(--primary-color);
  cursor: pointer;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border-radius: 50px;
  transition: var(--transition);
  font-weight: 500;
}

.remove-item i {
  margin-right: 6px;
}

.remove-item:hover {
  background: rgba(255, 82, 82, 0.15);
  transform: translateY(-1px);
}

/* Cart Summary */
.cart-summary {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 2rem;
  position: sticky;
  top: 2rem;
  box-shadow: var(--shadow-medium);
  border: 1px solid var(--border-color);
  transition: var(--transition);
  z-index: 100;
  height: fit-content;
}

.cart-summary:hover {
  box-shadow: var(--shadow-heavy);
  transform: translateY(-2px);
}

.cart-summary h3 {
  margin: 0 0 1.5rem 0;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--primary-color);
  color: var(--text-color);
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.cart-summary h3 i {
  color: var(--primary-color);
  font-size: 1.3rem;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  color: var(--text-light);
  font-size: 1.1rem;
  padding: 0.5rem 0;
}

.summary-row span:last-child {
  font-weight: 600;
  color: var(--text-color);
}

.summary-total {
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--text-color);
  margin: 1.5rem 0;
  padding: 1.5rem 0 1rem 0;
  border-top: 2px solid var(--primary-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.summary-total span:last-child {
  color: var(--primary-color);
  font-size: 1.6rem;
}

.checkout-btn {
  width: 100%;
  padding: 1.25rem 1.5rem;
  background: var(--primary-gradient);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-medium);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.checkout-btn:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(255, 107, 139, 0.4);
}

.checkout-btn:active {
  transform: translateY(-1px);
}

.checkout-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: var(--shadow-light);
  opacity: 0.6;
}

.checkout-btn i {
  font-size: 1.3rem;
}

.continue-shopping {
  text-align: center;
  margin: 0;
}

.continue-shopping a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.continue-shopping a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* Success Message */
.success-message {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--success-color);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 1000;
  animation: slideIn 0.3s ease-out forwards;
  max-width: 350px;
}

.success-message i {
  font-size: 1.5rem;
}

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

/* Responsive Design */
@media (max-width: 991px) {
  .cart-container {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .cart-summary {
    position: sticky;
    top: 1rem;
    order: -1;
  }
}

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

  .cart-page h1 {
    font-size: 2rem;
  }

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

  .cart-item-image {
    width: 100%;
    height: 200px;
    margin-bottom: 1rem;
  }

  .cart-item-actions {
    width: 100%;
    justify-content: space-between;
  }

  .cart-summary {
    padding: 1.5rem;
  }
}

@media (max-width: 480px) {
  .cart-item {
    padding: 1rem;
  }

  .cart-item-image {
    height: 160px;
  }

  .cart-item-actions {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .remove-item {
    padding: 0.4rem 0.8rem;
  }

  .success-message {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    max-width: none;
  }
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
  transition: opacity 0.3s ease;
}

.loading-spinner {
  text-align: center;
  padding: 2rem;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  animation: fadeIn 0.3s ease-out;
}

.spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 1rem;
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-left-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Cart Item Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cart-item {
  animation: fadeIn 0.3s ease-out forwards;
}

.checkout-btn:not(:disabled):hover {
  background: #c0392b;
}

.continue-shopping {
  display: block;
  text-align: center;
  margin-top: 1rem;
  color: #3498db;
  text-decoration: none;
  font-size: 0.95rem;
}

.continue-shopping:hover {
  text-decoration: underline;
}

/* Desktop Layout */
@media (min-width: 768px) {
  .cart-page {
    padding: 3rem 2rem;
  }
}

/* Success message */
.success-message {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #4caf50;
  color: white;
  padding: 12px 24px;
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translate(-50%, -20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* Cart item hover effect */
.cart-item {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cart-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Remove button hover effect */
.remove-item {
  transition: color 0.2s ease, transform 0.2s ease;
}

.remove-item:hover {
  color: #c0392b !important;
  transform: scale(1.05);
}

/* Quantity controls */
.quantity-controls {
  display: flex;
  align-items: center;
}

.quantity-btn {
  background: #f5f5f5;
  border: 1px solid #ddd;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.quantity-btn:hover {
  background: #e0e0e0;
}

.quantity-input {
  width: 40px;
  height: 30px;
  text-align: center;
  border: 1px solid #ddd;
  margin: 0 5px;
  -webkit-appearance: none;
  -moz-appearance: textfield;
  appearance: textfield;
}

.quantity-input:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Responsive styles */
@media (max-width: 767px) {
  .cart-item {
    padding: 1rem 0;
  }

  .cart-item-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
  }

  .quantity-controls {
    margin: 0;
  }

  .remove-item {
    margin: 0;
  }
}
