/* ============================================================
   PLÅTVISION – VARIATIONSTABELL v1.2.0
   Endast .pv-variation-table. Huvudfärg: #012D1D.
   ============================================================ */

.pv-variation-table {
  --pv-vt-green: #012D1D;
  --pv-vt-green-hover: #064b32;
  --pv-vt-border: #e1e7e4;
  --pv-vt-text: #15251d;
  --pv-vt-muted: #64736a;
  color: var(--pv-vt-text);
  width: 100%;
  margin: 12px 0 24px;
  font-family: inherit;
  box-sizing: border-box;
}

.pv-variation-table *,
.pv-variation-table *::before,
.pv-variation-table *::after { box-sizing: border-box; }

/* 1. Rubrik */
.pv-variation-table .pv-vt-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 14px;
}
.pv-variation-table .pv-vt-heading h3 {
  font-size: 20px;
  line-height: 1.35;
  font-weight: 700;
  color: var(--pv-vt-green);
  margin: 0;
}
.pv-variation-table .pv-vt-heading span {
  font-size: 13px;
  color: var(--pv-vt-muted);
}

/* 2. Tabell */
.pv-variation-table .pv-vt-table-wrap {
  overflow: hidden;
  border: 1px solid var(--pv-vt-border);
  border-radius: 12px;
  background: #fff;
}
.pv-variation-table .pv-vt-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  margin: 0;
  table-layout: auto;
  background: transparent;
}
.pv-variation-table .pv-vt-table thead th {
  background: var(--pv-vt-green);
  color: #fff;
  border: 0;
  padding: 16px 17px;
  font-weight: 600;
  font-size: 14px;
  text-align: left;
  letter-spacing: .01em;
  white-space: nowrap;
}
.pv-variation-table .pv-vt-table thead th:last-child { text-align: right; }
.pv-variation-table .pv-vt-table tbody tr:nth-child(even) { background: #f7faf8; }
.pv-variation-table .pv-vt-table tbody tr + tr { border-top: 1px solid #edf0ee; }
.pv-variation-table .pv-vt-table tbody td {
  padding: 14px 17px;
  font-size: 15px;
  line-height: 1.4;
  vertical-align: middle;
  border: 0;
  color: var(--pv-vt-text);
}
.pv-variation-table .pv-vt-size { font-weight: 700; }
.pv-variation-table .pv-vt-price { white-space: nowrap; }
.pv-variation-table .pv-vt-price .amount { color: inherit; font-weight: 500; }
.pv-variation-table .pv-vt-quantity-cell { text-align: right; }

/* 3. Kvantitetsväljare */
.pv-variation-table .pv-vt-qty {
  display: inline-flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.pv-variation-table .pv-vt-minus,
.pv-variation-table .pv-vt-plus {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 38px;
  height: 40px;
  min-width: 38px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: var(--pv-vt-green);
  background: #e9f2ed;
  font-family: inherit;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  box-shadow: none;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.pv-variation-table .pv-vt-minus:hover,
.pv-variation-table .pv-vt-plus:hover {
  color: #fff;
  background: var(--pv-vt-green);
}
.pv-variation-table .pv-vt-input {
  width: 72px;
  min-width: 72px;
  height: 40px;
  padding: 6px;
  margin: 0;
  border: 1px solid #d6ddd8;
  border-radius: 7px;
  background: #fff;
  color: var(--pv-vt-text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: normal;
  text-align: center;
  appearance: textfield;
  -moz-appearance: textfield;
  box-shadow: none;
}
.pv-variation-table .pv-vt-input::-webkit-inner-spin-button,
.pv-variation-table .pv-vt-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.pv-variation-table .pv-vt-input:focus-visible,
.pv-variation-table button:focus-visible {
  outline: 2px solid var(--pv-vt-green);
  outline-offset: 2px;
}
.pv-variation-table .pv-vt-unavailable { font-size: 13px; color: var(--pv-vt-muted); }

/* 4. Summering och beställningsknapp */
.pv-variation-table .pv-vt-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 16px;
}
.pv-variation-table .pv-vt-summary { display: flex; flex-direction: column; gap: 2px; }
.pv-variation-table .pv-vt-count { font-size: 13px; color: var(--pv-vt-muted); }
.pv-variation-table .pv-vt-total { font-size: 23px; color: var(--pv-vt-green); line-height: 1.3; }
.pv-variation-table .pv-vt-total .amount { color: inherit; }
.pv-variation-table .pv-vt-submit {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 13px 21px;
  border: 1px solid var(--pv-vt-green);
  border-radius: 9px;
  background: var(--pv-vt-green);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.35;
  box-shadow: none;
  cursor: pointer;
  transition: background .16s ease, opacity .16s ease;
}
.pv-variation-table .pv-vt-submit:hover:not(:disabled) {
  background: var(--pv-vt-green-hover);
  border-color: var(--pv-vt-green-hover);
  color: #fff;
}
.pv-variation-table .pv-vt-submit:disabled { opacity: .48; cursor: not-allowed; }
.pv-variation-table .pv-vt-feedback { margin-top: 12px; color: var(--pv-vt-green); font-size: 14px; }
.pv-variation-table .pv-vt-feedback:empty { display: none; }
.pv-variation-table .pv-vt-feedback--error { color: #9d2e2e; }
.pv-variation-table .pv-vt-feedback a {
  font-weight: 700;
  color: var(--pv-vt-green);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.pv-variation-table .pv-vt-error { color: #9d2e2e; }

/* 5. Mobil: varje variation blir en lättläst rad/ett kort */
@media (max-width: 700px) {
  .pv-variation-table .pv-vt-heading h3 { font-size: 18px; }
  .pv-variation-table .pv-vt-table thead { display: none; }
  .pv-variation-table .pv-vt-table,
  .pv-variation-table .pv-vt-table tbody { display: block; }
  .pv-variation-table .pv-vt-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px 14px;
    padding: 15px 14px;
  }
  .pv-variation-table .pv-vt-table tbody td {
    display: block;
    padding: 0;
    font-size: 14px;
    min-width: 0;
  }
  .pv-variation-table .pv-vt-table tbody td::before {
    content: attr(data-label) ': ';
    color: var(--pv-vt-muted);
    font-size: 12px;
    font-weight: 400;
  }
  .pv-variation-table .pv-vt-sku { grid-column: 1; grid-row: 2; }
  .pv-variation-table .pv-vt-size { grid-column: 1; grid-row: 1; }
  .pv-variation-table .pv-vt-price { grid-column: 1; grid-row: 3; }
  .pv-variation-table .pv-vt-quantity-cell {
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: center;
  }
  .pv-variation-table .pv-vt-quantity-cell::before { display: block; margin-bottom: 6px; }
  .pv-variation-table .pv-vt-qty { gap: 4px; }
  .pv-variation-table .pv-vt-minus,
  .pv-variation-table .pv-vt-plus { width: 32px; min-width: 32px; height: 36px; }
  .pv-variation-table .pv-vt-input { width: 52px; min-width: 52px; height: 36px; }
  .pv-variation-table .pv-vt-footer { align-items: stretch; }
  .pv-variation-table .pv-vt-submit { flex: 1 1 100%; }
}


/* ============================================================
   6. Jämförpris per m² i Elementors produktpris (v1.2.1)
   Endast egna .pv-vt-m2-klasser. Påverkar inte tabell/kassa/APF.
   ============================================================ */
.pv-vt-m2-price {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 9px;
  row-gap: 3px;
  font-family: inherit;
  line-height: 1.4;
  vertical-align: baseline;
}

/* Ordinarie pris och reapris ska ligga BREDVID varandra. */
.pv-vt-m2-price .pv-vt-m2-amount {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: nowrap;
  white-space: nowrap;
  color: #012D1D;
  font-weight: 650;
}

/* Högre specificitet än WooCommerce/Elementors generella del/ins-regler. */
.woocommerce .price .pv-vt-m2-amount del,
.pv-vt-m2-price .pv-vt-m2-amount del {
  display: inline-flex;
  align-items: baseline;
  color: #808a84;
  font-weight: 400;
  opacity: 1;
  text-decoration: line-through;
  background: transparent;
}

.woocommerce .price .pv-vt-m2-amount ins,
.pv-vt-m2-price .pv-vt-m2-amount ins {
  display: inline-flex;
  align-items: baseline;
  color: #c62828;
  font-weight: 700;
  text-decoration: none;
  background: transparent;
}

/* Även valutasymbol och prisbelopp (inklusive Tax Switchs wrappers) är röda. */
.pv-vt-m2-price .pv-vt-m2-amount ins .amount,
.pv-vt-m2-price .pv-vt-m2-amount ins .woocommerce-Price-currencySymbol {
  color: #c62828;
}

.pv-vt-m2-price .pv-vt-m2-suffix {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: nowrap;
  white-space: nowrap;
  color: #64736a;
  font-size: .75em;
  font-weight: 400;
}
.pv-vt-m2-price .pv-vt-m2-suffix .price-unit-suffix {
  display: inline;
  color: inherit;
  font-size: 1em;
}
.pv-vt-m2-price .pv-vt-m2-suffix .wts-price-wrapper {
  display: inline-flex;
  vertical-align: baseline;
}

/* På riktigt smala skärmar får hela suffixet flytta sig tillsammans. */
@media (max-width: 380px) {
  .pv-vt-m2-price { column-gap: 6px; }
  .pv-vt-m2-price .pv-vt-m2-amount { gap: 7px; }
}


/* ============================================================
   7. Arkivpris i Elementor/WooCommerce (v1.2.2)
   Återanvänder samma m²-HTML som på produktsidan.
   ============================================================ */
.woocommerce ul.products li.product .price .pv-vt-m2-price,
.elementor-widget-woocommerce-archive-products .price .pv-vt-m2-price {
  display: inline-flex;
  justify-content: center;
  max-width: 100%;
  vertical-align: baseline;
}

/* Ordinarie/reapris får inte ärva arkivkortets allmänna röda prisfärg. */
.woocommerce ul.products li.product .price .pv-vt-m2-amount del,
.elementor-widget-woocommerce-archive-products .price .pv-vt-m2-amount del {
  color: #808a84;
  opacity: 1;
}
.woocommerce ul.products li.product .price .pv-vt-m2-amount del .amount,
.woocommerce ul.products li.product .price .pv-vt-m2-amount del bdi {
  color: inherit;
}
.woocommerce ul.products li.product .price .pv-vt-m2-amount ins,
.elementor-widget-woocommerce-archive-products .price .pv-vt-m2-amount ins {
  color: #c62828;
  text-decoration: none;
  background: transparent;
}
.woocommerce ul.products li.product .price .pv-vt-m2-amount ins .amount,
.woocommerce ul.products li.product .price .pv-vt-m2-amount ins bdi {
  color: inherit;
}
