/**
 * Alhadil Beauty - Cart Page Styles
 * Supports both LTR and RTL layouts
 */

/* Cart Section */
.cart-section {
  padding: 60px 0;
  min-height: 500px;
}

/* Messages */
#cart-messages {
  position: fixed;
  top: 100px;
  right: 20px;
  z-index: 1050;
  max-width: 400px;
}

html[dir="rtl"] #cart-messages {
  right: auto;
  left: 20px;
}

.cart-alert {
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  margin-bottom: 10px;
  padding: 15px 20px;
  animation: slideIn 0.3s ease-out;
}

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

html[dir="rtl"] @keyframes slideIn {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

.cart-alert.success {
  background-color: rgba(40, 167, 69, 0.1);
  border: 1px solid rgba(40, 167, 69, 0.3);
  color: #28a745;
}

.cart-alert.error {
  background-color: rgba(220, 53, 69, 0.1);
  border: 1px solid rgba(220, 53, 69, 0.3);
  color: #dc3545;
}

/* Cart Items */
.cart-items {
  background-color: rgba(255, 255, 255, 0.08);
  border-radius: 15px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-color);
}

.cart-header {
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 15px;
  margin-bottom: 25px;
}

.cart-header h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-color-light);
  margin-bottom: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cart-item {
  padding: 20px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.cart-item:hover {
  background-color: rgba(255, 255, 255, 0.03);
  margin: 0 -15px;
  padding: 20px 15px;
}

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

.cart-item.removing {
  opacity: 0;
  transform: translateX(-20px);
  transition: all 0.3s ease;
}

/* Product Info */
.product-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.remove-item {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(220, 53, 69, 0.1);
  color: #dc3545;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.remove-item:hover {
  background-color: #dc3545;
  color: white;
  transform: scale(1.1);
}

.product-image {
  width: 80px;
  height: 80px;
  border-radius: 10px;
  overflow: hidden;
  background-color: rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

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

.image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-color-light);
  font-size: 2rem;
  opacity: 0.3;
}

.product-details {
  flex-grow: 1;
}

.product-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 5px;
  line-height: 1.4;
}

.product-title a {
  color: var(--text-color-light);
  text-decoration: none;
  transition: color 0.3s ease;
}

.product-title a:hover {
  color: var(--secondary-color);
}

.product-sku {
  font-size: 0.85rem;
  color: var(--text-color-light);
  opacity: 0.6;
  margin-bottom: 5px;
}

/* Product Color Info */
.product-color-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
}

.color-label {
  font-size: 0.85rem;
  color: var(--text-color-light);
  opacity: 0.7;
}

.color-swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  display: inline-block;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.color-name {
  font-size: 0.9rem;
  color: var(--text-color-light);
  font-weight: 500;
}

/* Price */
.product-price {
  text-align: center;
}

.price,
.price-new {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--secondary-color);
}

.price-old {
  text-decoration: line-through;
  color: var(--text-color-light);
  opacity: 0.6;
  font-size: 0.95rem;
  display: block;
  margin-top: 5px;
}

/* Quantity Controls */
.quantity-controls {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: 30px;
  overflow: hidden;
  background-color: rgba(255, 255, 255, 0.05);
}

.quantity-minus,
.quantity-plus {
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background-color: transparent;
  color: var(--text-color-light);
  cursor: pointer;
  transition: all 0.3s ease;
}

.quantity-minus:hover,
.quantity-plus:hover {
  background-color: var(--secondary-color);
}

.quantity-minus:disabled,
.quantity-plus:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.quantity-input {
  width: 50px;
  text-align: center;
  border: none;
  background: transparent;
  font-weight: 600;
  color: var(--text-color-light);
  outline: none;
  font-size: 1rem;
  -moz-appearance: textfield;
}

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

/* Product Total */
.product-total {
  text-align: right;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--secondary-color);
}

/* Cart Actions */
.cart-actions {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.btn-continue,
.btn-clear-cart {
  padding: 12px 25px;
  font-size: 0.95rem;
  border-radius: 30px;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  font-weight: 500;
}

.btn-continue {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-color-light);
}

.btn-continue:hover {
  background-color: var(--text-color-light);
  color: var(--primary-color);
  transform: translateY(-2px);
}

.btn-clear-cart {
  background-color: rgba(220, 53, 69, 0.1);
  border: 1px solid rgba(220, 53, 69, 0.3);
  color: #dc3545;
}

.btn-clear-cart:hover {
  background-color: #dc3545;
  color: white;
  transform: translateY(-2px);
}

/* Cart Summary */
.cart-summary {
  background-color: rgba(255, 255, 255, 0.08);
  border-radius: 15px;
  padding: 30px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-color);
  position: sticky;
  top: 100px;
}

.cart-summary h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 25px;
  color: var(--text-color-light);
  text-align: center;
}

/* Cart Totals */
.cart-totals {
  margin-bottom: 25px;
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding: 10px 0;
}

.total-label {
  font-size: 1rem;
  color: var(--text-color-light);
  opacity: 0.8;
}

.total-value {
  font-weight: 600;
  color: var(--text-color-light);
  font-size: 1.05rem;
}

.free-shipping {
  color: #28a745;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.9rem;
}

.grand-total {
  border-top: 2px solid var(--border-color);
  padding-top: 20px;
  margin-top: 20px;
}

.grand-total .total-label {
  font-size: 1.2rem;
  font-weight: 600;
}

.grand-total .total-value {
  font-size: 1.5rem;
  color: var(--secondary-color);
  font-weight: 700;
}

/* Checkout Button */
.btn-checkout {
  display: block;
  width: 100%;
  padding: 15px;
  background-color: var(--secondary-color);
  color: white;
  border: none;
  border-radius: 30px;
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
}

.btn-checkout:hover {
  background-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
  color: white;
}

/* Empty Cart */
.empty-cart {
  text-align: center;
  padding: 80px 0;
}

.empty-cart-icon {
  font-size: 6rem;
  color: var(--secondary-color);
  opacity: 0.2;
  margin-bottom: 30px;
}

.empty-cart h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 15px;
  color: var(--text-color-light);
}

.empty-cart p {
  font-size: 1.1rem;
  margin-bottom: 30px;
  color: var(--text-color-light);
  opacity: 0.7;
}

.btn-shop-now {
  display: inline-block;
  padding: 15px 40px;
  background-color: var(--secondary-color);
  color: white;
  border: none;
  border-radius: 30px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  font-size: 1.1rem;
}

.btn-shop-now:hover {
  background-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
  color: white;
}

/* Loading States */
.loading {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
}

.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--secondary-color);
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 0.8s linear infinite;
}

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

/* RTL Support */
html[dir="rtl"] .product-info {
  flex-direction: row-reverse;
}

html[dir="rtl"] .product-total {
  text-align: left;
}

html[dir="rtl"] .text-md-end {
  text-align: left !important;
}

html[dir="rtl"] .product-color-info {
  flex-direction: row-reverse;
}

/* Responsive */
@media (max-width: 991px) {
  .cart-summary {
    margin-top: 30px;
    position: static;
  }
}

@media (max-width: 767px) {
  .cart-section {
    padding: 40px 0;
  }

  .cart-items {
    padding: 20px;
  }

  .cart-header {
    display: none;
  }

  .cart-item {
    padding: 15px 0;
  }

  .cart-item:hover {
    margin: 0;
    padding: 15px 0;
  }

  .product-info {
    flex-wrap: wrap;
  }

  .product-image {
    width: 60px;
    height: 60px;
  }

  .product-price,
  .product-quantity,
  .product-total {
    margin-top: 15px;
    width: 33.33%;
    text-align: center;
  }

  .product-total {
    text-align: right;
  }

  html[dir="rtl"] .product-total {
    text-align: left;
  }

  .cart-actions .row > div {
    margin-bottom: 10px;
  }

  .btn-continue,
  .btn-clear-cart {
    width: 100%;
  }

  #cart-messages {
    right: 10px;
    left: 10px;
    max-width: calc(100% - 20px);
  }

  .product-color-info {
    margin-top: 8px;
  }

  .color-swatch {
    width: 18px;
    height: 18px;
  }

  .color-name {
    font-size: 0.85rem;
  }
}