/* =========================================================
   VC CART – v1.0 CLEAN & LOCKED
   Desktop table + Mobile cards
   Quantity with + / − (Woo compatible)
   ========================================================= */

/* =========================================================
   CONTAINER & TITLE
   ========================================================= */

.vcom-cart {
  max-width: 1100px;
  margin: 0 auto 80px;
}

.vcom-cart__title {
  font-size: clamp(1.6rem, 2.5vw, 2rem);
  font-weight: 700;
  margin: 28px 0 20px;
}

/* =========================================================
   COUPON
   ========================================================= */

.vcom-cart__coupon {
  display: flex;
  gap: 10px;
  max-width: 420px;
  margin-bottom: 20px;
}

.vcom-cart__coupon input {
  flex: 1;
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}

.vcom-cart__coupon button {
  height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  font-weight: 600;
}

/* =========================================================
   DESKTOP TABLE
   ========================================================= */

.vcom-cart__table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.vcom-cart__table thead th {
  padding: 12px 10px;
  border-bottom: 1px solid #e5e7eb;

  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: #6b7280;
  text-align: left;
}

.vcom-cart__table td {
  padding: 16px 10px;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: middle;
  font-size: 14px;
}

/* Column sizing */
.product-remove     { width: 40px; }
.product-thumbnail  { width: 80px; }
.product-price,
.product-quantity,
.product-subtotal {
  width: 120px;
  text-align: right;
  white-space: nowrap;
}

/* =========================================================
   THUMBNAIL & NAME
   ========================================================= */

.product-thumbnail img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 12px;
  background: #f3f4f6;
  display: block;
}

.product-name a {
  font-weight: 600;
  line-height: 1.3;
  color: inherit;
  text-decoration: none;
}

.product-name a:hover {
  text-decoration: underline;
}

/* =========================================================
   PRICE
   ========================================================= */

.product-price,
.product-subtotal {
  font-weight: 600;
}

/* =========================================================
   QUANTITY – TABLE-NATIVE, NO INPUT LOOK
   ========================================================= */

/* Table cell behaves like price/subtotal */
td.product-quantity {
  text-align: right;
  vertical-align: middle;
}

/* Woo quantity wrapper */
.product-quantity .quantity {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 74px; /* 26 + 20 + 26 */
}

/* − / + buttons (FINAL visual truth) */
.product-quantity .quantity button {
  width: 26px;
  height: 26px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: 6px;
  border: 1px solid #10b981;   /* emerald-500 */
  background: #f0fdf9;         /* very light green */
  color: #047857;              /* emerald-700 */

  font-size: 14px;
  font-weight: 700;
  line-height: 1;

  cursor: pointer;

  transition:
    background .15s ease,
    color .15s ease,
    border-color .15s ease;
}

.product-quantity .quantity button:hover {
  background: #10b981;
  color: #ffffff;
  border-color: #10b981;
}

/* Quantity number – text, not field */
.product-quantity .quantity input.qty {
  width: 20px;
  padding: 0;
  margin: 0;

  border: none;
  background: transparent;
  box-shadow: none;

  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: #111827; /* final winning color */

  pointer-events: none; /* controlled via − / + */
  appearance: textfield;
}

/* Remove native spinners */
.product-quantity .quantity input.qty::-webkit-inner-spin-button,
.product-quantity .quantity input.qty::-webkit-outer-spin-button {
  appearance: none;
  margin: 0;
}

/* =========================================================
   SUMMARY
   ========================================================= */

.vcom-cart__summary {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid #e5e7eb;

  max-width: 420px;
  margin-left: auto;
}

.vcom-cart__row {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  margin-bottom: 6px;
}

.vcom-cart__shipping-note {
  font-size: 14px;
  color: #6b7280;
  margin: 10px 0 16px;
}

.vcom-cart__cta {
  width: 100%;
  min-height: 52px;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 800;
}

.vcom-cart__trust {
  margin-top: 12px;
  font-size: 13px;
  color: #6b7280;
  text-align: center;
  line-height: 1.4;
}

/* =========================================================
   MOBILE – CARD MODE (NEW SOURCE OF TRUTH)
   ========================================================= */

@media (max-width: 768px) {

  /* Dölj table-head */
  .vcom-cart__table thead {
    display: none;
  }

  /* Gör varje rad till ett card */
  .vcom-cart__table,
  .vcom-cart__table tbody,
  .vcom-cart__table tr {
    display: block;
    width: 100%;
  }

  .vcom-cart__table tbody tr {
    position: relative;
    padding: 16px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 1px 0 rgba(0,0,0,.06);
    margin-bottom: 14px;

    display: grid;
    grid-template-columns: 80px 1fr;
    grid-template-areas:
      "thumb name"
      "thumb price"
      "thumb qty";
    gap: 6px 12px;
  }

  .product-thumbnail { grid-area: thumb; }
  .product-name      { grid-area: name; }
  .product-price     { grid-area: price; }
  .product-quantity  { grid-area: qty; }

  .product-subtotal {
    display: none;
  }

  .product-thumbnail img {
    width: 80px;
    height: 80px;
    border-radius: 14px;
    background: #f3f4f6;
  }

  .vcom-cart__table td {
    border: none;
    padding: 0;
  }

  /* Remove-knapp */
  .product-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
  }
}

/* =========================================================
   HIDE UPDATE CART ROW (UX)
   ========================================================= */

.woocommerce-cart-form .actions {
  position: absolute;
  left: -9999px;
}

/* =========================================================
   CART – Updating state (stable & subtle)
   ========================================================= */

/* Lås interaktion under uppdatering */
.vcom-cart.is-updating {
  pointer-events: none;
}

/* Dämpa quantity visuellt (men behåll layouten) */
.vcom-cart.is-updating .product-quantity {
  opacity: 0.6;
}

/* Valfritt: liten puls för feedback (kan tas bort) */
@keyframes vcom-pulse {
  0% { opacity: 0.55; }
  50% { opacity: 0.75; }
  100% { opacity: 0.55; }
}

.vcom-cart.is-updating .product-quantity {
  animation: vcom-pulse 1.1s ease-in-out infinite;
}

/* =========================================================
   CART PRICE – SALE / REGULAR
   ========================================================= */

.cart-price {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.cart-price__regular {
  color: #9ca3af;
  font-size: 13px;
}

.cart-price__sale {
  color: #111827;
  font-weight: 700;
  font-size: 14px;
}

.cart-savings {
  font-size: 12px;
  color: #059669; /* emerald-600 */
  font-weight: 500;
}

.vcom-cart__savings {
  color: #059669;
  font-weight: 600;
}

.vcom-cart__freeshipping {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #0369a1; /* blå – informativ */
}

.vcom-cart__row.vcom-cart__freeshipping {
  justify-content: flex-start;
  gap: 6px;
  flex-wrap: wrap;
}

.vcom-cart__row.vcom-cart__freeshipping strong {
  white-space: nowrap;
}

.vcom-cart__freeshipping--hit {
  color: #059669; /* grön – success */
}

@media (max-width: 768px) {

  .vcom-cart__row.vcom-cart__freeshipping {
    font-size: 14px;
    line-height: 1.3;
  }

}

.cart-thumb {
  position: relative;
  display: inline-block;
}

.cart-sale-badge {
  position: absolute;
  top: -6px;
  left: -6px;

  background: #e11d48; /* pink/röd */
  color: #fff;

  font-size: 12px;
  font-weight: 800;
  padding: 4px 6px;
  border-radius: 8px;

  line-height: 1;
}

.cart-item--sale {
  background: linear-gradient(
    to right,
    rgba(16,185,129,0.06),
    transparent 60%
  );
}

.vcom-cart__upsell {
  margin-top: 16px;
  padding: 14px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px dashed #e5e7eb;
}

.upsell-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.upsell-item {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 10px;
  align-items: center;
}

.upsell-meta {
  display: flex;
  flex-direction: column;
}

.upsell-name {
  font-size: 14px;
  font-weight: 600;
}

.upsell-price {
  font-size: 13px;
  color: #059669;
  font-weight: 600;
}

.upsell-add {
  padding: 6px 12px;
  font-size: 13px;
}

/* =========================================================
   DESKTOP CART LAYOUT – ACTIVATE GRID
   ========================================================= */

@media (min-width: 960px) {

  .vcom-cart__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px; /* FINAL source of truth */
    gap: 40px;
    align-items: start;
  }

  .vcom-cart__main {
    max-width: none;
  }

  .vcom-cart__table {
    width: 100%;
  }

  .vcom-cart__summary {
    margin-top: 0;

    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 24px;
  }

}

@media (max-width: 768px) {

  .vcom-cart__table tbody tr {
    padding: 12px;
    gap: 6px 8px;
  }

  .product-name a {
    font-size: 14px;
    line-height: 1.25;
  }

  .cart-price {
    gap: 1px;
  }

  .cart-savings {
    font-size: 11px;
  }

  .vcom-cart__summary {
    margin-top: 24px;
  }

  .vcom-cart__row {
    font-size: 14px;
    margin-bottom: 4px;
  }

  .vcom-cart__cta {
    margin-top: 16px;
    position: sticky;
    bottom: 12px;
    z-index: 20;
  }

  .vcom-cart__upsell {
    margin-top: 20px;
  }

}


/* =========================================================
   REMOVE ITEM – CLEAR & TOUCH FRIENDLY
========================================================= */

.product-remove a.remove {
  width: 32px;
  height: 32px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: 50%;
  border: 1px solid var(--vcom-border);
  background: var(--vcom-bg);

  font-size: 18px;
  font-weight: 700;
  line-height: 1;

  color: var(--vcom-muted);
  text-decoration: none;

  transition:
    background .15s ease,
    color .15s ease,
    border-color .15s ease,
    transform .1s ease;
}

.product-remove a.remove:hover,
.product-remove a.remove:focus {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

.product-remove a.remove:active {
  transform: scale(0.94);
}

/* Mobile – större touch target */
@media (max-width: 768px) {
  .product-remove a.remove {
    width: 36px;
    height: 36px;
    font-size: 20px;
  }
}

.vcom-cart__total {
  font-size: 1.2rem;
  font-weight: 700;
  border-top: 1px solid var(--vcom-border);
  padding-top: 16px;
  margin-top: 16px;
}