:root {
  --rico-blue: #161616;
  --rico-blue-hover: #000000;
  --rico-primary: #176855;
  --rico-muted: #64748b;
  --rico-border: #e2e8f0;
  --rico-bg: #f8fafc;
}
/* =============================================================
   ۱. دکمه و آیکون هدر (دقیقاً مطابق با تصویر)
============================================================= */
.rico-side-cart-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  direction: rtl;
  font-family: inherit;
}

.rico-side-cart-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  background: #ffffff;
  border: 1.5px solid #dcdfe4;
  border-radius: 10px;
  color: #222222;
  cursor: pointer;
  outline: none;
  line-height: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.rico-side-cart-trigger:hover {
  border-color: #b5bcc7;
  background-color: #fafbfc;
}

.rico-cart-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.rico-cart-icon-svg {
  width: 25px;
  height: 25px;
  display: block;
}

.rico-side-cart-badge {
    position: absolute;
    bottom: -7px;
    right: -10px;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    box-sizing: border-box;
    border-radius: 999px;
    background: #159fdb;
    color: #ffffff;
    font-size: 12px;
    font-weight: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    z-index: 2;
    pointer-events: none;
}

.rico-side-cart-badge[data-count="0"] {
  display: none;
}

/* =============================================================
   ۲. استایل استپر تعداد (Stepper)
============================================================= */
.rico-qty-stepper {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  height: 38px;
  width: 98px;
  box-sizing: border-box;
  padding: 3px;
  border: 1px solid #dfe5ec;
  border-radius: 9px;
  background: #ffffff;
  transition: border-color 0.2s, box-shadow 0.2s;
  direction: ltr;
}

.rico-qty-stepper:focus-within {
  border-color: var(--rico-blue);
  box-shadow: 0 0 0 2px rgba(29, 50, 101, 0.08);
}

.rico-qty-button {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 28px;
  height: 30px;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--rico-blue);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s;
  line-height: 0;
}

.rico-qty-button:hover:not(:disabled) {
  background: #f0f4f9;
  color: #111;
}

.rico-qty-button:active:not(:disabled) {
  transform: scale(0.92);
}

.rico-qty-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.rico-qty-button svg {
  display: block;
  margin: auto;
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rico-qty-value {
  flex: 1;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #17243b;
  user-select: none;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

/* =============================================================
   ۳. کشو سایدبار سبد خرید (Side Cart Drawer)
============================================================= */
.rico-side-cart-drawer {
    position: fixed;
    inset: 0;
    z-index: 999999;
    transition:all 0.32s;
    pointer-events: none;
    left: -100%;
}

.rico-side-cart-drawer.is-open {
    pointer-events: auto;
    left: 0;
}

.rico-drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(12, 22, 42, 0.45);
  opacity: 0;
  transition: opacity 0.32s ease;
}

.rico-side-cart-drawer.is-open .rico-drawer-overlay {
  opacity: 1;
}

.rico-drawer-panel {
  position: absolute;
  top: 0;
  left: 0;
  right: auto;
  width: var(--rico-drawer-width, 390px);
  max-width: 88vw;
  height: 100%;
  background: #ffffff;
  box-shadow: 12px 0 45px rgba(13, 27, 62, 0.18);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.34s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.rico-side-cart-drawer.is-open .rico-drawer-panel {
  transform: translateX(0);
}

.rico-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid #edf1f6;
  background: #fafbfd;
  flex: 0 0 auto;
}

.rico-drawer-title-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.rico-drawer-title-wrap h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--rico-blue);
}

.rico-drawer-counter {
  font-size: 12.5px;
  color: var(--rico-muted);
}

.rico-drawer-close {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0;
  border: 0;
  background: #edf2f9;
  border-radius: 50%;
  color: var(--rico-blue);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  transition: all 0.18s ease;
}

.rico-drawer-close:hover {
  background: #dbe4f3;
  transform: rotate(90deg);
}

.rico-drawer-body {
  flex: 1 1 auto;
  overflow-y: auto !important;
  padding: 18px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  touch-action: pan-y;
  overscroll-behavior: contain;
}

.rico-drawer-body::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.rico-cart-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 70px 20px;
  color: var(--rico-muted);
  text-align: center;
}

.rico-cart-empty-state svg {
  width: 58px;
  height: 58px;
  stroke: #cbd5e1;
}

.rico-cart-empty-state p {
  margin: 0;
  font-size: 14.5px;
  font-weight: 500;
}

.rico-drawer-items-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rico-cart-item-row {
  position: relative;
  display: flex;
  gap: 14px;
  padding: 14px;
  background: #ffffff;
  border: 1px solid #edf1f6;
  border-radius: 12px;
  transition: all 0.25s ease;
}

.rico-cart-item-row.is-loading-row {
  opacity: 0.55;
  pointer-events: none;
}

.rico-item-thumb {
  flex: 0 0 68px;
  width: 68px;
  height: 68px;
  border-radius: 10px;
  border: 1px solid #edf1f6;
  background: #f8fafc;
  overflow: hidden;
}

.rico-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.rico-item-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.rico-item-name {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rico-item-name a {
  color: #17243b;
  text-decoration: none;
  transition: color 0.15s;
}

.rico-item-name a:hover {
  color: var(--rico-primary);
}

.rico-item-price-unit {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--rico-blue);
  margin-top: 2px;
}

.rico-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.rico-item-remove-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  color: #a0aec0;
  cursor: pointer;
  border-radius: 8px;
  line-height: 0;
  transition: all 0.18s ease;
}

.rico-item-remove-btn:hover {
  color: #d94a54;
  background: #fff1f2;
}

.rico-item-remove-btn svg {
  display: block;
  margin: auto;
  width: 18px;
  height: 18px;
}

.rico-drawer-footer {
  padding: 18px 22px;
  border-top: 1px solid #edf1f6;
  background: #fafbfd;
  flex: 0 0 auto;
}

.rico-drawer-totals {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-size: 14.5px;
}

.rico-total-label {
  color: var(--rico-muted);
  font-weight: 500;
}

.rico-total-amount {
  font-size: 17px;
  font-weight: 800;
  color: #17243b;
}

.rico-drawer-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rico-cart-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 46px;
  border-radius: 11px;
  font-size: 14.5px;
  font-weight: 400;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.rico-btn-checkout {
  background: var(--rico-blue);
  color: #fff;
  border: 0;
  box-shadow: 0 4px 14px rgba(29, 50, 101, 0.2);
}

.rico-btn-checkout:hover {
  background: var(--rico-blue-hover);
  transform: translateY(-1px);
}

.rico-btn-view-cart {
  background: #fff;
  color: var(--rico-blue);
  border: 1px solid var(--rico-border);
}

.rico-btn-view-cart:hover {
  border-color: var(--rico-blue);
  background: #f7f9fb;
}

/* =============================================================
   ۴. صفحه سبد خرید (Cart Page)
============================================================= */
.rico-cart-page-container {
  width: 100%;
  direction: rtl;
  font-family: inherit;
  box-sizing: border-box;
}

.rico-cart-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 26px;
  align-items: start;
}

.rico-cart-table-card,
.rico-cart-summary-card {
  background: #fff;
  border: 1px solid var(--rico-border);
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.02);
  box-sizing: border-box;
}

.rico-cart-table-header {
  padding-bottom: 14px;
  border-bottom: 1px solid #edf1f6;
  font-size: 15.5px;
  font-weight: 700;
  color: var(--rico-blue);
}

.rico-cart-page-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 0;
  border-bottom: 1px solid #edf1f6;
  transition: all 0.25s ease;
}

.rico-cart-page-row:last-child {
  border-bottom: 0;
}

.rico-cart-page-row.is-loading-row {
  opacity: 0.55;
  pointer-events: none;
}

.rico-page-thumb {
  flex: 0 0 75px;
  width: 75px;
  height: 75px;
  border-radius: 10px;
  border: 1px solid #edf1f6;
  overflow: hidden;
}

.rico-page-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.rico-page-info {
  flex: 1;
  min-width: 0;
}

.rico-page-title {
  margin: 0 0 6px;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.5;
}

.rico-page-title a {
  color: #17243b;
  text-decoration: none;
}

.rico-page-price-unit {
  font-size: 13.5px;
  color: var(--rico-muted);
  display: flex;
}

.rico-page-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.rico-page-line-total {
  font-size: 15.5px;
  font-weight: 800;
  color: #17243b;
  min-width: 95px;
  text-align: left;
}

.rico-cart-summary-card h3 {
  margin: 0 0 18px;
  font-size: 16px;
  font-weight: 700;
  color: var(--rico-blue);
}

.rico-summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 14px;
  color: #4b5869;
}

.rico-summary-discount {
  color: #169b62;
  font-weight: 600;
}

.rico-summary-divider {
  height: 1px;
  background: #edf1f6;
  margin: 16px 0;
}

.rico-summary-total {
  font-size: 16px;
  font-weight: 800;
  color: #17243b;
  margin-bottom: 22px;
}

.rico-cart-empty-wrap {
  text-align: center;
  padding: 70px 20px;
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--rico-border);
}

.rico-cart-empty-wrap svg {
  width: 64px;
  height: 64px;
  stroke: #ccd4e0;
  margin-bottom: 16px;
}

.rico-cart-empty-wrap h3 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--rico-blue);
}

.rico-cart-empty-wrap p {
  color: var(--rico-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

.rico-cart-empty-wrap .rico-btn-checkout {
  display: inline-flex;
  padding: 0 32px;
}

@media (max-width: 767px) {
  .rico-cart-main-grid {
    grid-template-columns: 1fr;
  }
  .rico-cart-page-row {
    flex-wrap: wrap;
    gap: 12px;
  }
  .rico-page-actions {
    width: 100%;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px dashed #edf1f6;
  }

  .rico-side-cart-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 47px;
    height: 47px;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    background: #ffffff;
    border: 1.5px solid #dcdfe4;
    border-radius: 10px;
    color: #222222;
    cursor: pointer;
    outline: none;
    line-height: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    transition: border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.rico-side-cart-badge {
    position: absolute;
    bottom: -6px;
    right: -15px;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    box-sizing: border-box;
    border-radius: 999px;
    background: #159fdb;
    display: flex;
    align-items: center;
    border: 2px solid #ffffff;
}
}