/**
 * Multi-Vendor Cart Styles
 * تصميم السلة متعددة البائعين
 */

/* ====================================
   Cart Icon in Header
   ==================================== */
.ph-cart-icon-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  margin-left: 15px;
}

.ph-cart-icon {
  font-size: 20px;
  color: white; /* White for visibility in dark header */
  transition: color 0.3s ease;
}

/* SVG icon support */
.ph-cart-icon-wrapper svg.ph-cart-icon {
  width: 20px;
  height: 20px;
  fill: white; /* White for visibility in dark header */
  transition: fill 0.3s ease;
}

.ph-cart-icon:hover,
.ph-cart-icon-wrapper:hover svg.ph-cart-icon {
  color: #f1c40f;
  fill: #f1c40f;
}

.ph-cart-count {
  position: absolute;
  top: -8px;
  right: -10px;
  background: #f1c40f;
  color: #001f3f;
  font-size: 11px;
  font-weight: bold;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  animation: cartBadgePulse 0.3s ease;
}

@keyframes cartBadgePulse {
  0% {
    transform: scale(0.8);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

/* ====================================
   Cart Modal/Dropdown
   ==================================== */
.ph-cart-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999999;
  display: none;
  align-items: center;
  justify-content: center;
}

.ph-cart-modal.active {
  display: flex;
}

.ph-cart-content {
  background: white;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  border-radius: 12px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  animation: cartSlideIn 0.3s ease;
}

@keyframes cartSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ph-cart-header {
  padding: 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ph-cart-header h2 {
  margin: 0;
  font-size: 22px;
  color: #001f3f;
}

.ph-cart-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
  transition: color 0.3s;
  padding: 5px 10px;
}

.ph-cart-close:hover {
  color: #f1c40f;
}

.ph-cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.ph-cart-empty {
  text-align: center;
  padding: 40px 20px;
  color: #999;
}

.ph-cart-empty i {
  font-size: 60px;
  margin-bottom: 20px;
  opacity: 0.3;
}

.ph-cart-empty p {
  font-size: 16px;
}

/* ====================================
   Cart Items List
   ==================================== */
.ph-cart-items {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ph-cart-item {
  display: flex;
  gap: 15px;
  padding: 15px;
  border-bottom: 1px solid #eee;
  transition: background 0.2s;
}

.ph-cart-item:hover {
  background: #f9f9f9;
}

.ph-cart-item-image {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}

.ph-cart-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ph-cart-item-image.no-image {
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ccc;
  font-size: 30px;
}

.ph-cart-item-details {
  flex: 1;
  min-width: 0;
}

.ph-cart-item-title {
  font-size: 16px;
  font-weight: 600;
  color: #001f3f;
  margin: 0 0 8px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ph-cart-item-vendor {
  font-size: 13px;
  color: #666;
  margin-bottom: 8px;
}

.ph-cart-item-vendor i {
  color: #f1c40f;
  margin-left: 3px;
}

.ph-cart-item-price {
  font-size: 15px;
  font-weight: bold;
  color: #27ae60;
}

.ph-cart-item-actions {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
}

.ph-cart-item-remove {
  background: none;
  border: none;
  color: #e74c3c;
  cursor: pointer;
  font-size: 18px;
  padding: 5px;
  transition: color 0.2s;
}

.ph-cart-item-remove:hover {
  color: #c0392b;
}

/* Quantity Controls */
.ph-cart-quantity {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
}

.ph-cart-quantity-btn {
  background: #f0f0f0;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

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

.ph-cart-quantity-value {
  font-size: 14px;
  min-width: 30px;
  text-align: center;
}

/* ====================================
   Vendor Group Filter
   ==================================== */
.ph-vendor-filter {
  margin-bottom: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
}

.ph-vendor-filter-label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: #001f3f;
  font-size: 14px;
}

.ph-vendor-filter select {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  background: white;
}

/* ====================================
   Cart Footer
   ==================================== */
.ph-cart-footer {
  padding: 20px;
  border-top: 2px solid #eee;
  background: #f8f9fa;
}

.ph-cart-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.ph-cart-btn {
  flex: 1;
  padding: 12px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 150px;
}

.ph-cart-btn-share {
  background: #27ae60;
  color: white;
}

.ph-cart-btn-share:hover {
  background: #229954;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.ph-cart-btn-share:disabled {
  background: #95a5a6;
  cursor: not-allowed;
  transform: none;
}

.ph-cart-btn-clear {
  background: #e74c3c;
  color: white;
}

.ph-cart-btn-clear:hover {
  background: #c0392b;
}

/* ====================================
   Add to Cart Button - Circular Icon
   ==================================== */
.ph-add-to-cart-btn {
  /* Shape and Size - Small Circular Button */
  width: 40px;
  height: 40px;
  border-radius: 50%;
  padding: 0;
  
  /* Position - Top LEFT of card (appears TOP RIGHT in RTL) */
  position: absolute;
  top: 8px;      /* أعلى البطاقة */
  left: 8px;     /* يسار (يمين بصرياً في RTL) */
  z-index: 10;
  
  /* Brand Colors - Dark Blue */
  background: rgba(0, 31, 63, 0.9);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
  
  /* Effects - ALWAYS VISIBLE NOW */
  opacity: 1;
  transform: scale(1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  
  /* Icon Centering */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}




/* Button hover effect */
.ph-add-to-cart-btn:hover {
  background: #003366 !important;
  transform: scale(1.1) !important;
  box-shadow: 0 4px 12px rgba(0, 31, 63, 0.4);
  border-color: rgba(255, 255, 255, 0.5);
}

/* "In Cart" state - Green and always visible */
.ph-add-to-cart-btn.in-cart {
  background: rgba(39, 174, 96, 0.9);
  opacity: 1;
  transform: scale(1);
}

.ph-add-to-cart-btn.in-cart:hover {
  background: #27ae60 !important;
  transform: scale(1.1) !important;
}

/* Icon size and display - SVG support */
.ph-add-to-cart-btn svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: currentColor;
}

/* Legacy Font Awesome support (if needed) */
.ph-add-to-cart-btn i {
  font-size: 18px;
  font-family: 'Font Awesome 5 Free' !important;
  font-weight: 900 !important;
  font-style: normal !important;
  display: inline-block !important;
  line-height: 1 !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Ensure image box is positioned for absolute button */
.custom-card-img-box {
  position: relative;
}

/* Force Font Awesome shopping cart icon to display (legacy) */
.ph-add-to-cart-btn i::before,
.ph-add-to-cart-btn .fa-shopping-cart::before {
  content: "\f07a" !important;
  font-family: 'Font Awesome 5 Free' !important;
  font-weight: 900 !important;
}




/* ====================================
   Toast Notifications
   ==================================== */
.ph-cart-toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: #27ae60;
  color: white;
  padding: 15px 25px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  z-index: 1000000;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastSlideIn 0.3s ease;
}

.ph-cart-toast.error {
  background: #e74c3c;
}

.ph-cart-toast.info {
  background: #3498db;
}

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

/* ====================================
   Mobile Responsive
   ==================================== */
@media (max-width: 768px) {
  .ph-cart-content {
    width: 95%;
    max-height: 90vh;
  }

  .ph-cart-header h2 {
    font-size: 18px;
  }

  .ph-cart-item {
    gap: 10px;
    padding: 12px;
  }

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

  .ph-cart-item-title {
    font-size: 14px;
  }

  .ph-cart-actions {
    flex-direction: column;
  }

  .ph-cart-btn {
    width: 100%;
  }

  .ph-cart-toast {
    bottom: 20px;
    right: 20px;
    left: 20px;
    font-size: 14px;
  }
}

/* ====================================
   Loading State
   ==================================== */
.ph-cart-loading {
  text-align: center;
  padding: 40px;
  color: #999;
}

.ph-cart-loading i {
  font-size: 40px;
  animation: spin 1s linear infinite;
}

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

/* ====================================
   Flying Cart Icon Animation
   ==================================== */
.flying-cart-icon {
  position: fixed;
  width: 30px;
  height: 30px;
  z-index: 9999;
  pointer-events: none;
}

.flying-cart-icon svg {
  width: 100%;
  height: 100%;
  fill: #27ae60;
  filter: drop-shadow(0 2px 8px rgba(39, 174, 96, 0.5));
}

/* ====================================
   Toast Notification
   ==================================== */
.ph-toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: rgba(39, 174, 96, 0.95);
  color: white;
  padding: 15px 25px;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 10000;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ph-toast.show {
  transform: translateY(0);
  opacity: 1;
}

.ph-toast svg {
  width: 20px;
  height: 20px;
  fill: white;
}

/* ====================================
   Cart Count Pulse Animation
   ==================================== */
.ph-cart-count.pulse {
  animation: pulse 0.6s ease;
}

@keyframes pulse {
  0%, 100% { 
    transform: scale(1); 
  }
  50% { 
    transform: scale(1.3); 
    background: #27ae60;
  }
}
