@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazir.woff2') format('woff2'), url('../fonts/Vazir.woff') format('woff');
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --ks-bg: #ffffff;
  --ks-zebra: #f8fafc;
  --ks-border: #e5e7eb;
  --ks-text: #0f172a;
  --ks-muted: #64748b;
  --ks-primary: #0071a1;
  --ks-success: #16a34a;
  --ks-danger: #dc2626;
  --ks-radius: 14px;
  --ks-shadow: 0 10px 26px rgba(2, 6, 23, .08);
}

.ks-wrap,
.ks-modal,
.ks-floating-button,
.ks-toast {
  font-family: 'Vazirmatn', Tahoma, sans-serif;
}

.ks-wrap {
  max-width: 980px;
  margin: 0 auto;
  color: var(--ks-text);
  padding-top: 10px;
}

.ks-card,
.ks-welcome {
  background: var(--ks-bg);
  border: 1px solid var(--ks-border);
  border-radius: var(--ks-radius);
  box-shadow: var(--ks-shadow);
  overflow: hidden;
}

.ks-welcome {
  margin: 12px auto 14px;
  padding: 14px;
  background: linear-gradient(135deg, rgba(0, 113, 161, .10), rgba(22, 163, 74, .08));
  text-align: center;
}

.ks-w-title {
  font-size: 15px;
  font-weight: 900;
  margin: 0 0 4px;
}

.ks-w-sub {
  font-size: 13px;
  margin: 0;
  color: var(--ks-muted);
}

.ks-info-box,
.ks-extra-info-box {
  margin-bottom: 10px;
}

.ks-info-box p,
.ks-extra-info-box p {
  margin: 0;
  padding: 10px;
  border-radius: 12px;
  background: #f5f5f5;
  border-right: 4px solid var(--ks-success);
}

.ks-extra-info-box p {
  background: #e0f7fa;
  border-right-color: var(--ks-primary);
}

.ks-search-wrapper {
  margin: 14px 0;
}

#ks-search {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--ks-border);
  border-radius: 12px;
  outline: none;
  font-size: 14px;
}

#ks-search:focus,
.ks-stepper input:focus {
  border-color: rgba(0, 113, 161, .35);
  box-shadow: 0 0 0 4px rgba(0, 113, 161, .10);
}

.ks-list {
  width: 100%;
}

.ks-empty,
.ks-empty-cart,
.ks-cart-placeholder {
  margin: 0;
  padding: 20px;
  text-align: center;
  color: var(--ks-muted);
}

.ks-row {
  display: grid;
  grid-template-columns: 1.8fr .9fr .8fr 1fr .9fr;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--ks-border);
}

.ks-row.ks-no-stock {
  grid-template-columns: 1.8fr .9fr 1fr .9fr;
}

.ks-row:nth-child(even) {
  background: var(--ks-zebra);
}

.ks-row:last-child {
  border-bottom: 0;
}

.ks-product {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ks-product-text {
  min-width: 0;
}

.ks-thumb img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}

.ks-title {
  min-width: 0;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.ks-meta,
.ks-stock {
  font-size: 12px;
  color: var(--ks-muted);
  white-space: nowrap;
}

.ks-price {
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
}

.ks-price del {
  color: #9ca3af;
  font-weight: 600;
  margin-left: 6px;
}

.ks-price ins {
  text-decoration: none;
  color: var(--ks-success);
  font-weight: 900;
  font-size: 15px;
}

.ks-stock b {
  color: var(--ks-text);
  font-weight: 900;
}

.ks-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ks-stepper input {
  width: 64px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--ks-border);
  text-align: center;
  font-size: 14px;
  outline: none;
  appearance: textfield;
  font-weight: 800;
}

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

.ks-stepper button,
.ks-add,
.ks-modal-footer a,
.ks-modal-footer button,
.ks-cart-remove {
  border: 0;
  cursor: pointer;
  font-weight: 900;
  transition: all .15s ease;
}

.ks-stepper button {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 6px 16px rgba(2, 6, 23, .10);
}

.ks-plus,
.qplus {
  background: var(--ks-success);
}

.ks-minus,
.qminus {
  background: var(--ks-danger);
}

.ks-stepper button:hover,
.ks-add:hover,
.ks-modal-footer a:hover,
.ks-modal-footer button:hover {
  filter: brightness(1.05);
}

.ks-stepper button:active,
.ks-add:active {
  transform: scale(.97);
}

.ks-add {
  height: 40px;
  border-radius: 12px;
  background: var(--ks-success);
  color: #fff;
  font-size: 13px;
  padding: 0 12px;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(2, 6, 23, .12);
}

.ks-add.added {
  background: #0f766e !important;
  box-shadow: 0 8px 18px rgba(15, 118, 110, .35) !important;
}

.ks-add[disabled] {
  opacity: .6;
  cursor: not-allowed;
  box-shadow: none;
}

.ks-floating-button {
  position: fixed;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  border: 0;
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .18);
  cursor: pointer;
  font-size: 14px;
  font-weight: 900;
}

.ks-cart-button {
  bottom: 8px;
  right: 18px;
  background: var(--ks-success);
}

.ks-checkout-button {
  bottom: 8px;
  right: 150px;
  background: var(--ks-primary);
}

.ks-badge {
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 900;
}

.ks-toast {
  position: fixed;
  bottom: 82px;
  right: 18px;
  z-index: 9999;
  background: #0b1220;
  color: #fff;
  padding: 10px 12px;
  border-radius: 14px;
  box-shadow: 0 12px 26px rgba(0, 0, 0, .25);
  font-size: 13px;
  opacity: 0;
  transform: translateY(8px);
  transition: all .2s ease;
}

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

.ks-toast.ok {
  background: #0f766e;
}

.ks-toast.bad {
  background: #b91c1c;
}

.ks-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}

.ks-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.ks-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(4px);
}

.ks-modal-content {
  position: relative;
  width: 90%;
  max-width: 720px;
  max-height: 85vh;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(.92);
  transition: transform .25s ease;
}

.ks-modal.is-open .ks-modal-content {
  transform: scale(1);
}

.ks-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--ks-border);
  background: linear-gradient(135deg, rgba(0, 113, 161, .08), rgba(22, 163, 74, .06));
}

.ks-modal-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 900;
  color: var(--ks-text);
}

.ks-modal-close,
.ks-cart-remove {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 24px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fee;
  color: var(--ks-danger);
}

.ks-modal-close:hover,
.ks-cart-remove:hover {
  background: var(--ks-danger);
  color: #fff;
}

.ks-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}

.ks-cart-item {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--ks-border);
  border-radius: 14px;
  margin-bottom: 10px;
  background: var(--ks-zebra);
}

.ks-cart-thumb img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 12px;
}

.ks-cart-info {
  min-width: 0;
}

.ks-cart-info .title {
  font-size: 14px;
  font-weight: 800;
  margin: 0 0 4px;
  color: var(--ks-text);
}

.ks-cart-info .price {
  font-size: 13px;
  color: var(--ks-success);
  font-weight: 900;
  margin: 0 0 6px;
}

.qty-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-control button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 10px;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qty-control span {
  font-size: 14px;
  font-weight: 900;
  min-width: 28px;
  text-align: center;
}

.ks-cart-total {
  margin-top: 16px;
  padding: 14px;
  background: linear-gradient(135deg, rgba(0, 113, 161, .08), rgba(22, 163, 74, .06));
  border-radius: 14px;
  text-align: center;
}

.ks-cart-total p {
  margin: 0;
  font-size: 15px;
  font-weight: 900;
  color: var(--ks-text);
}

.ks-cart-total span {
  color: var(--ks-success);
  font-size: 18px;
}

.ks-modal-footer {
  margin-top: 14px;
  display: flex;
  gap: 10px;
}

.ks-modal-footer a,
.ks-modal-footer button {
  flex: 1;
  padding: 12px;
  text-align: center;
  color: #fff;
  font-weight: 900;
  border-radius: 12px;
  text-decoration: none;
}

.ks-mc-checkout {
  background: var(--ks-primary);
}

.ks-mc-continue {
  background: var(--ks-success);
}

@media (max-width: 720px) {
  .ks-wrap {
    margin: 0 12px;
  }

  .ks-row {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
  }

  .ks-thumb img {
    width: 44px;
    height: 44px;
  }

  .ks-price,
  .ks-stock {
    text-align: center;
  }

  .ks-stepper {
    justify-content: center;
  }

  .ks-stepper button,
  .ks-stepper input {
    height: 44px;
    border-radius: 14px;
  }

  .ks-stepper button {
    width: 44px;
    font-size: 22px;
  }

  .ks-stepper input {
    width: 72px;
    font-size: 15px;
  }

  .ks-add {
    width: 100%;
    height: 46px;
    font-size: 14px;
    border-radius: 14px;
  }

  .ks-floating-button {
    right: 12px;
    left: 12px;
    justify-content: center;
  }

  .ks-cart-button {
    bottom: 8px;
  }

  .ks-checkout-button {
    right: 12px;
    bottom: 64px;
  }

  .ks-toast {
    right: 12px;
    left: 12px;
    bottom: 122px;
    text-align: center;
  }

  .ks-modal-footer,
  .ks-cart-item {
    grid-template-columns: 1fr;
  }
}
