/* ============================================
   COMPONENTS
   ============================================ */

/* ---- Typography ---- */
.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.logo .mark {
  color: var(--green);
}

h1, h2, h3, .product-name, .preview-name {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.price {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.subtext, .item-count, .description {
  color: var(--muted);
  font-size: 13px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease);
}

.btn-primary {
  background: var(--green);
  color: #fff;
}

.btn-primary:hover {
  background: var(--green-l);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink);
}

.btn-ghost:hover {
  background: var(--cream-hover);
}

.btn-text {
  color: var(--red);
  font-size: 13px;
  font-weight: 600;
}

.btn-text:hover {
  text-decoration: underline;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  position: relative;
}

.btn-icon:hover {
  background: var(--cream-hover);
}

.badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

/* ---- Icons (Hugeicons stroke-rounded font) ---- */
.btn-icon i {
  font-size: 20px;
  line-height: 1;
}

.qty-stepper button i {
  font-size: 13px;
  line-height: 1;
}

.kanti-ai .cancel i {
  font-size: 15px;
}

.ai-footer .send i {
  font-size: 16px;
}

.search {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--muted);
  pointer-events: none;
}

.search .search-input {
  padding-left: 38px;
  width: 100%;
  padding-top: 10px;
  padding-bottom: 10px;
  padding-right: 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--cream);
  font-size: 14px;
}

.search-input:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

/* ---- Category chips ---- */
.chip {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}

.chip:hover {
  border-color: var(--green);
}

.chip.is-active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

/* ---- Product card ---- */
.product {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--fast) var(--ease), transform var(--fast) var(--ease);
}

.product:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.product .image {
  aspect-ratio: 1 / 1;
  background: var(--green-tint);
  display: flex;
  align-items: center;
  justify-content: center;
}

.product .image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product .body {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
}

.product .description {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product .price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.product .buttons {
  display: flex;
  gap: var(--space-2);
  padding: 0 var(--space-4) var(--space-4);
}

.product .buttons .btn {
  flex: 1;
  padding: 8px 12px;
  font-size: 13px;
}

/* ---- Cart item ---- */
.cart-item {
  display: flex;
  gap: var(--space-3);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}

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

.cart-item .item-image {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  background: var(--green-tint);
  flex-shrink: 0;
  overflow: hidden;
}

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

.cart-item .product-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.qty-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: fit-content;
}

.qty-stepper button {
  width: 28px;
  height: 28px;
  font-weight: 600;
  color: var(--green);
}

.qty-stepper input {
  width: 32px;
  text-align: center;
  border: none;
  font-family: var(--font-mono);
  font-size: 13px;
}

.cart-summary .line {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--muted);
}

.cart-summary .line.total {
  color: var(--ink);
  font-weight: 700;
  font-size: 16px;
}

/* ---- Product preview modal content ---- */
.preview-name {
  font-size: 24px;
}

.preview-price {
  font-size: 20px;
  color: var(--green);
}

.preview-body {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.preview-price-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.stock-note {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--green-tint);
  color: var(--green);
}

.stock-note.is-low {
  background: #FDF3E3;
  color: #B5760A;
}

.stock-note.is-out {
  background: var(--red-tint);
  color: var(--red);
}

.preview-qty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.preview-qty label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.preview-qty .qty-stepper {
  border-color: var(--border);
}

.preview-qty input {
  width: 44px;
  font-size: 15px;
}

#previewSubtotal {
  font-family: var(--font-mono);
  font-weight: 500;
  opacity: 0.85;
}

.preview-qty.is-disabled,
.btn.is-disabled {
  opacity: 0.5;
  pointer-events: none;
}

.modal-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
}

/* ---- Checkout form ---- */
#checkoutForm h3 {
  font-size: 20px;
  margin-bottom: var(--space-4);
  padding-right: var(--space-6);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.field input,
.field textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--ink);
  font-weight: 400;
  resize: vertical;
}

.field input:focus-visible,
.field textarea:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 1px;
}

.checkout-summary {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: var(--space-3) 0;
  margin-bottom: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.checkout-summary .line {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--muted);
}

.checkout-summary .line.total {
  color: var(--ink);
  font-weight: 700;
  font-size: 16px;
}

.checkout-error {
  background: var(--red-tint);
  color: var(--red);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-4);
}

.checkout-success {
  text-align: center;
  padding: var(--space-4) 0;
}

.checkout-success h3 {
  font-size: 22px;
  margin-bottom: var(--space-2);
}

.checkout-success p {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: var(--space-5);
}

/* ---- Kanti AI widget ---- */
.ai-launcher .pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ink);
  color: #fff;
  padding: 12px 20px 12px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 600;
}

.ai-launcher .ai-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green-l);
  box-shadow: 0 0 0 rgba(0, 198, 96, 0.5);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 198, 96, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(0, 198, 96, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 198, 96, 0); }
}

.kanti-ai .head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  background: var(--ink);
  color: #fff;
}

.kanti-ai .head .title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-weight: 600;
}

.kanti-ai .ai-circle {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green-l);
}

.kanti-ai .cancel {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.kanti-ai .cancel:hover {
  background: rgba(255, 255, 255, 0.12);
}

.ai-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.5;
}

.ai-msg.from-bot {
  background: var(--green-tint);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.ai-msg.from-user {
  background: var(--ink);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.ai-footer input {
  flex: 1;
  border: none;
  padding: 10px 12px;
  background: var(--cream);
  border-radius: 999px;
  font-size: 14px;
}

.ai-footer input:focus-visible {
  outline: 2px solid var(--green);
}

.ai-footer .send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ai-footer .send:hover {
  background: var(--green-l);
}

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  color: var(--muted);
  padding: var(--space-6) var(--space-4);
  font-size: 14px;
}