/* ============================================================
   چرخ گستر سهند - Cart Page
   نسخه: 1.0 - انیمیشن‌های صنعتی + UI/UX مدرن
   ============================================================ */

:root {
  --atlas-deep-blue: #0a1a2f;
  --atlas-mid-blue: #0d2240;
  --atlas-tech-blue: #134074;
  --atlas-gold: #d4af37;
  --atlas-gold-light: #e5c767;
  --atlas-copper: #b87333;
  --atlas-white: #ffffff;
  --atlas-light-gray: #e8ecf1;
  --atlas-text-on-dark: #ccd6e0;
  --atlas-text-muted: #8899aa;
  --atlas-green: #2ecc71;
  --atlas-red: #e74c3c;
  --transition-smooth: 0.5s cubic-bezier(0.25, 0.8, 0.25, 1.2);
  --border-radius: 18px;
  --font-primary: 'IRANSans', 'Vazirmatn', 'Tahoma', sans-serif;
}

/* ==================== صفحه اصلی ==================== */
.cart-page {
  background: linear-gradient(180deg, #060e1a 0%, var(--atlas-deep-blue) 40%, var(--atlas-mid-blue) 100%);
  min-height: 100vh;
  font-family: var(--font-primary);
  direction: rtl;
  padding: 1rem;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

/* ==================== چرخ‌دنده‌های پس‌زمینه ==================== */
.cart-gears-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.03;
}

.cart-gear {
  position: absolute;
  color: var(--atlas-gold);
}

.cart-gear-1 {
  top: -100px;
  right: -80px;
  width: 400px;
  height: 400px;
  animation: cartGearSlow 30s linear infinite;
}

.cart-gear-2 {
  bottom: -120px;
  left: -60px;
  width: 350px;
  height: 350px;
  color: var(--atlas-copper);
  animation: cartGearMedium 22s linear infinite reverse;
}

.cart-gear-3 {
  top: 50%;
  left: -30px;
  width: 150px;
  height: 150px;
  animation: cartGearFast 10s linear infinite;
}

@keyframes cartGearSlow {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes cartGearMedium {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(-360deg);
  }
}

@keyframes cartGearFast {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* ==================== کانتینر ==================== */
.cart-container {
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* ==================== هدر ==================== */
.cart-header {
  text-align: center;
  padding: 2.5rem 0 3rem;
}

.cart-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(212, 175, 55, 0.1);
  color: var(--atlas-gold);
  padding: 0.4rem 1.3rem;
  border-radius: 50px;
  font-size: 0.8rem;
  letter-spacing: 2px;
  border: 1px solid rgba(212, 175, 55, 0.25);
  margin-bottom: 1rem;
}

.cart-badge-dot {
  width: 7px;
  height: 7px;
  background: var(--atlas-gold);
  border-radius: 50%;
  animation: cartDotPulse 2s ease-in-out infinite;
}

@keyframes cartDotPulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.8);
    opacity: 0.3;
  }
}

.cart-title {
  color: var(--atlas-white);
  font-size: 2.2rem;
  font-weight: 900;
  margin-bottom: 0.5rem;
}

.cart-title-accent {
  background: linear-gradient(135deg, var(--atlas-gold) 0%, var(--atlas-gold-light) 50%, var(--atlas-copper) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.cart-count {
  color: var(--atlas-text-muted);
  font-size: 0.95rem;
}

.cart-count strong {
  color: var(--atlas-gold);
}

/* ==================== جدول سبد خرید ==================== */
.cart-table-wrapper {
  background: linear-gradient(145deg, rgba(19, 64, 116, 0.25), rgba(10, 26, 47, 0.6));
  border: 1px solid rgba(212, 175, 55, 0.12);
  border-radius: var(--border-radius);
  overflow: hidden;
  margin-bottom: 2rem;
  position: relative;
}

.cart-table-wrapper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--atlas-gold), var(--atlas-copper));
  z-index: 2;
}

.cart-table {
  width: 100%;
  border-collapse: collapse;
}

/* ==================== هدر جدول ==================== */
.cart-table thead th {
  background: rgba(0, 0, 0, 0.3);
  color: var(--atlas-gold);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 1.2rem 1rem;
  text-align: center;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  white-space: nowrap;
}

/* ==================== ردیف‌های جدول ==================== */
.cart-table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: all 0.4s ease;
  position: relative;
}

.cart-table tbody tr:hover {
  background: rgba(212, 175, 55, 0.03);
}

.cart-table tbody tr.removing {
  animation: cartRowRemove 0.5s ease forwards;
}

@keyframes cartRowRemove {
  0% {
    transform: translateX(0);
    opacity: 1;
  }

  50% {
    transform: translateX(-30px);
    opacity: 0.5;
    background: rgba(231, 76, 60, 0.1);
  }

  100% {
    transform: translateX(100px);
    opacity: 0;
  }
}

.cart-table tbody tr.adding {
  animation: cartRowAdd 0.5s ease;
}

@keyframes cartRowAdd {
  0% {
    transform: translateX(50px);
    opacity: 0;
    background: rgba(46, 204, 113, 0.1);
  }

  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

.cart-table tbody td {
  color: var(--atlas-text-on-dark);
  padding: 1.2rem 1rem;
  text-align: center;
  vertical-align: middle;
  font-size: 0.9rem;
}

/* ==================== نام محصول ==================== */
.cart-product-name {
  color: var(--atlas-white);
  font-weight: 600;
  font-size: 0.95rem;
}

/* ==================== کنترل تعداد ==================== */
.cart-quantity-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  overflow: hidden;
}

.cart-qty-btn {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.04);
  border: none;
  color: var(--atlas-gold);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-primary);
}

.cart-qty-btn:hover {
  background: rgba(212, 175, 55, 0.2);
  color: var(--atlas-white);
}

.cart-qty-btn:active {
  transform: scale(0.9);
}

.cart-qty-input {
  width: 50px;
  height: 36px;
  background: transparent;
  border: none;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--atlas-white);
  text-align: center;
  font-family: var(--font-primary);
  font-size: 0.9rem;
  font-weight: 600;
  outline: none;
}

/* حذف اسپینرهای مرورگر - روش استاندارد */
.cart-qty-input::-webkit-outer-spin-button,
.cart-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* برای فایرفاکس */
.cart-qty-input {
  -moz-appearance: textfield !important;
  appearance: textfield;
}

/* ==================== دکمه به‌روزرسانی ==================== */
.cart-update-btn {
  background: rgba(212, 175, 55, 0.1);
  color: var(--atlas-gold);
  border: 1px solid rgba(212, 175, 55, 0.2);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  font-family: var(--font-primary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 0.4rem;
}

.cart-update-btn:hover {
  background: var(--atlas-gold);
  color: var(--atlas-deep-blue);
}

/* ==================== قیمت‌ها ==================== */
.cart-price {
  color: var(--atlas-text-on-dark);
  font-weight: 500;
}

.cart-subtotal {
  color: var(--atlas-gold);
  font-weight: 700;
  font-size: 1rem;
}

/* ==================== دکمه حذف ==================== */
.cart-remove-btn {
  width: 38px;
  height: 38px;
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid rgba(231, 76, 60, 0.2);
  border-radius: 10px;
  color: var(--atlas-red);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-remove-btn:hover {
  background: var(--atlas-red);
  color: white;
  transform: rotate(90deg);
  box-shadow: 0 5px 20px rgba(231, 76, 60, 0.3);
}

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

/* ==================== فوتر سبد خرید ==================== */
.cart-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  background: linear-gradient(145deg, rgba(19, 64, 116, 0.25), rgba(10, 26, 47, 0.6));
  border: 1px solid rgba(212, 175, 55, 0.12);
  border-radius: var(--border-radius);
  padding: 1.5rem 2rem;
}

/* ==================== دکمه حذف همه ==================== */
.cart-clear-btn {
  background: transparent;
  color: var(--atlas-red);
  border: 1px solid rgba(231, 76, 60, 0.3);
  padding: 0.7rem 1.5rem;
  border-radius: 10px;
  font-family: var(--font-primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
}

.cart-clear-btn:hover {
  background: var(--atlas-red);
  color: white;
  border-color: var(--atlas-red);
  box-shadow: 0 8px 25px rgba(231, 76, 60, 0.25);
}

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

/* ==================== قیمت کل ==================== */
.cart-total-block {
  text-align: left;
}

.cart-total-label {
  color: var(--atlas-text-muted);
  font-size: 0.8rem;
  letter-spacing: 1px;
  margin-bottom: 0.3rem;
  display: block;
}

.cart-total-price {
  color: var(--atlas-gold);
  font-size: 1.8rem;
  font-weight: 900;
}

.cart-total-currency {
  font-size: 0.9rem;
  margin-right: 0.3rem;
  opacity: 0.7;
}

/* ==================== دکمه ادامه خرید ==================== */
.cart-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.cart-continue-btn {
  background: transparent;
  color: var(--atlas-text-on-dark);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.8rem 1.8rem;
  border-radius: 50px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
}

.cart-continue-btn:hover {
  border-color: var(--atlas-gold);
  color: var(--atlas-gold);
}

.cart-checkout-btn {
  background: linear-gradient(135deg, var(--atlas-gold), var(--atlas-copper));
  color: var(--atlas-deep-blue);
  padding: 0.8rem 2rem;
  border-radius: 50px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  box-shadow: 0 8px 25px rgba(212, 175, 55, 0.3);
  position: relative;
  overflow: hidden;
}

.cart-checkout-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 35px rgba(212, 175, 55, 0.45);
  color: var(--atlas-deep-blue);
}

.cart-checkout-btn::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent 40%, rgba(255, 255, 255, 0.3) 50%, transparent 60%);
  animation: cartBtnShine 3s ease-in-out infinite;
}

@keyframes cartBtnShine {
  0% {
    transform: translateX(-100%) rotate(45deg);
  }

  100% {
    transform: translateX(100%) rotate(45deg);
  }
}

/* ==================== سبد خرید خالی ==================== */
.cart-empty {
  text-align: center;
  padding: 5rem 2rem;
  background: linear-gradient(145deg, rgba(19, 64, 116, 0.25), rgba(10, 26, 47, 0.6));
  border: 1px solid rgba(212, 175, 55, 0.12);
  border-radius: var(--border-radius);
  position: relative;
  overflow: hidden;
}

.cart-empty::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--atlas-gold), transparent);
}

.cart-empty-icon {
  width: 120px;
  height: 120px;
  margin: 0 auto 1.5rem;
  color: var(--atlas-gold);
  opacity: 0.4;
  animation: cartEmptyFloat 3s ease-in-out infinite;
}

@keyframes cartEmptyFloat {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-15px);
  }
}

.cart-empty-icon svg {
  width: 100%;
  height: 100%;
}

.cart-empty-title {
  color: var(--atlas-white);
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.8rem;
}

.cart-empty-text {
  color: var(--atlas-text-muted);
  font-size: 0.95rem;
  margin-bottom: 2rem;
  line-height: 1.8;
}

.cart-shop-btn {
  background: linear-gradient(135deg, var(--atlas-gold), var(--atlas-copper));
  color: var(--atlas-deep-blue);
  padding: 0.8rem 2.5rem;
  border-radius: 50px;
  text-decoration: none;
  font-weight: 800;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  box-shadow: 0 8px 25px rgba(212, 175, 55, 0.3);
}

.cart-shop-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 35px rgba(212, 175, 55, 0.45);
  color: var(--atlas-deep-blue);
}

.cart-shop-btn svg {
  width: 20px;
  height: 20px;
}

/* ==================== Notification Toast ==================== */
.cart-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: linear-gradient(145deg, var(--atlas-tech-blue), var(--atlas-deep-blue));
  border: 1px solid var(--atlas-gold);
  border-radius: 14px;
  padding: 1rem 1.8rem;
  color: var(--atlas-white);
  font-family: var(--font-primary);
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
  transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  opacity: 0;
}

.cart-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.cart-toast.success {
  border-color: var(--atlas-green);
}

.cart-toast.error {
  border-color: var(--atlas-red);
}

.cart-toast.success .cart-toast-icon {
  color: var(--atlas-green);
}

.cart-toast.error .cart-toast-icon {
  color: var(--atlas-red);
}

.cart-toast-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

/* ==================== Responsive ==================== */

/* تبلت */
@media (max-width: 992px) {
  .cart-table thead {
    display: none;
  }

  .cart-table tbody tr {
    display: block;
    padding: 1rem;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 14px;
  }

  .cart-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    text-align: right;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.04);
  }

  .cart-table tbody td:last-child {
    border-bottom: none;
  }

  .cart-table tbody td::before {
    content: attr(data-label);
    color: var(--atlas-gold);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 1px;
  }

  .cart-footer {
    flex-direction: column;
    text-align: center;
  }

  .cart-total-block {
    text-align: center;
  }

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

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

/* موبایل */
@media (max-width: 480px) {
  .cart-page {
    padding: 0.5rem;
  }

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

  .cart-total-price {
    font-size: 1.4rem;
  }

  .cart-quantity-wrapper {
    flex-wrap: wrap;
  }
}