/* ===========================
   Mini-cart (drawer)
   =========================== */

:root {
  --vcom-border: #E5E7EB;
  --vcom-text: #0f172a;
  --vcom-muted: #64748b;
  --vcom-brand: #0f8c7a;
  --vcom-bg: #fff;
  --vcom-danger: #ef4444;
}

/* Drawer struktur */
#vc-minicart .vc-drawer__inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 16px;
  gap: 12px;
}
#vc-minicart .widget_shopping_cart_content {
  flex: 1 1 auto;
  overflow-y: auto;
}

/* Reset Woo mini-cart UL */
#vc-minicart .woocommerce-mini-cart {
  margin: 0;
  padding: 0;
  list-style: none;
}
#vc-minicart .woocommerce ul.product_list_widget li img {
  float: none !important;
  margin: 0 !important;
  max-width: none !important;
}

/* ===========================
   Varurad (grid)
   =========================== */
#vc-minicart .mini_cart_item {
  position: relative;
  display: grid !important;
  grid-template-columns: 120px 1fr; /* vänster = bild, höger = content */
  grid-template-rows: auto auto auto;
  grid-template-areas:
    "thumb title"
    "thumb unit"
    "thumb qty";
  column-gap: 14px;
  row-gap: 6px;
  align-items: start;
  padding: 14px 0;
  border-bottom: 1px solid var(--vcom-border);
}
#vc-minicart .mini_cart_item:last-child {
  border-bottom: 0;
}

/* Thumb täcker hela vänsterkolumnen */
#vc-minicart .mini_cart_item .vcom-thumb,
#vc-minicart .mini_cart_item .vcom-thumb-link {
  grid-area: thumb;
  display: block;
  width: 100%;
  height: 100%;
  align-self: stretch;
  justify-self: stretch;
}
#vc-minicart .mini_cart_item .vcom-thumb img,
#vc-minicart .mini_cart_item .vcom-thumb-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--vcom-border);
  background: #fff;
}

/* Title */
#vc-minicart .mini_cart_item .vcom-title {
  grid-area: title;
  font-weight: 700;
  font-size: .95rem;
  line-height: 1.3;
  color: var(--vcom-text);
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  align-self: start;
  margin-top: 0;
}

/* Enhetspris under titel */
#vc-minicart .mini_cart_item .vcom-unit-price {
  grid-area: unit;
  font-size: .85rem;
  color: var(--vcom-muted);
  margin-top: 2px;
}
#vc-minicart .mini_cart_item .vcom-unit-price del {
  color: var(--vcom-muted);
  margin-right: 4px;
  font-size: .8rem;
}
#vc-minicart .mini_cart_item .vcom-unit-price ins {
  text-decoration: none;
  color: var(--vcom-text);
  font-weight: 600;
}

/* Qty-rad med total + rabatt */
#vc-minicart .mini_cart_item.has-vcom-qty .quantity {
  display: none !important;
}
#vc-minicart .mini_cart_item .vcom-qty-row {
  grid-area: qty;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}
#vc-minicart .mini_cart_item .vcom-qty {
  display: flex;
  align-items: center;
  gap: 6px;
}
.vcom-qty__btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--vcom-border);
  border-radius: 999px;
  background: #fff;
  color: var(--vcom-text);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: .15s ease;
}
.vcom-qty__btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}
.vcom-qty__btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}
.vcom-qty__input {
  width: 40px;
  height: 32px;
  text-align: center;
  border: 1px solid var(--vcom-border);
  border-radius: 999px;
  font-weight: 700;
}

/* Priscol till höger i qty-row */
#vc-minicart .mini_cart_item .vcom-price-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
#vc-minicart .mini_cart_item .vcom-sale-badge {
  background: #ffe6e6;
  color: var(--vcom-danger);
  font-weight: 700;
  font-size: .75rem;
  border-radius: 999px;
  padding: 2px 6px;
}
#vc-minicart .mini_cart_item .vcom-total-price {
  font-weight: 800;
  font-size: 1rem;
  color: var(--vcom-text);
}

/* Remove-knapp */
#vc-minicart .mini_cart_item .remove_from_cart_button {
  position: absolute;
  top: 4px;
  right: 0;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--vcom-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  line-height: 0;
  color: var(--vcom-text) !important;
  transition: .15s ease;
}
#vc-minicart .mini_cart_item .remove_from_cart_button::before {
  content: "✕";
  font-size: 14px;
  line-height: 1;
}
#vc-minicart .mini_cart_item .remove_from_cart_button:hover {
  background: var(--vcom-text);
  border-color: var(--vcom-text);
  color: #fff;
}

/* Totals & knappar */
#vc-minicart .mini-cart-footer,
#vc-minicart .woocommerce-mini-cart__summary {
  border-top: 1px solid var(--vcom-border);
  padding: 12px 0;
  margin-top: auto;
  font-size: 0.95rem;
  background: var(--vcom-bg);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#vc-minicart .woocommerce-mini-cart__summary p {
  display: flex;
  justify-content: space-between;
  margin: 0;
  font-size: 0.9rem;
}
#vc-minicart .woocommerce-mini-cart__summary .mini-cart-discount {
  color: var(--vcom-danger);
  font-weight: 600;
}
#vc-minicart .woocommerce-mini-cart__summary .mini-cart-total {
  font-weight: 800;
  font-size: 1rem;
  color: var(--vcom-text);
}
#vc-minicart .woocommerce-mini-cart__buttons {
  display: flex;
  gap: 12px;
}
#vc-minicart .woocommerce-mini-cart__buttons .button {
  flex: 1 1 auto;
  height: 46px;
  border-radius: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#vc-minicart .woocommerce-mini-cart__buttons .button:not(.checkout) {
  display: none !important; /* dölj "Visa varukorg" */
}
#vc-minicart .woocommerce-mini-cart__buttons .checkout {
  background: var(--vcom-brand);
  border: 1px solid var(--vcom-brand);
  color: #fff;
}

/* Mobile */
@media (max-width: 480px) {
  #vc-minicart .mini_cart_item {
    grid-template-columns: 84px 1fr !important;
  }
  #vc-minicart .mini_cart_item .vcom-thumb,
  #vc-minicart .mini_cart_item .vcom-thumb-link {
    width: 84px !important;
    height: 84px !important;
  }
  #vc-minicart .mini_cart_item img.vcom-thumb {
    width: 84px !important;
    height: 84px !important;
  }
}

#vc-minicart .woocommerce-mini-cart__summary .mini-cart-discount:last-of-type {
  border-top: 1px dashed var(--vcom-border);
  padding-top: 6px;
  margin-top: 4px;
}

/* Scrollområde för varulistan */
#vc-minicart .widget_shopping_cart_content {
  flex: 1 1 auto;
  overflow-y: auto;
  padding-bottom: 8px; /* luft så sista raden inte nuddar foten */
}

/* Sticky footer i mini-cart */
#vc-minicart .mini-cart-footer {
  position: sticky;
  bottom: 0;
  background: var(--vcom-bg);
  border-top: 1px solid var(--vcom-border);
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 -6px 12px rgba(0,0,0,.05);
  z-index: 1;
}

/* Redan befintligt – behåll */
#vc-minicart .woocommerce-mini-cart__summary p { 
  display:flex; justify-content:space-between; margin:0; font-size:0.9rem;
}
#vc-minicart .woocommerce-mini-cart__buttons {
  display:flex; gap:12px;
}
#vc-minicart .woocommerce-mini-cart__buttons .button:not(.checkout){ display:none !important; }
#vc-minicart .woocommerce-mini-cart__buttons .checkout{
  background:var(--vcom-brand); border:1px solid var(--vcom-brand); color:#fff;
  height:46px; border-radius:12px; font-weight:700; display:inline-flex; align-items:center; justify-content:center;
}

/* Gör hela inner-drawern till en kolumn och kapsla scroll korrekt */
#vc-minicart .vc-drawer__inner{
  display:flex;
  flex-direction:column;
  height:100%;
  /* Viktigt för att undvika att sticky läcker utanför: */
  overflow:hidden;
}

/* Själva Woo-innehållet blir vår SCROLL + FLEX-kolumn */
#vc-minicart .widget_shopping_cart_content{
  flex:1 1 auto;
  min-height:0;                /* låter scrollern krympa korrekt */
  display:flex;                /* <-- NYTT */
  flex-direction:column;       /* <-- NYTT */
  overflow-y:auto;
  padding-bottom:8px;
}

/* Varulistan är en vanlig block-del högst upp */
#vc-minicart .widget_shopping_cart_content > .woocommerce-mini-cart{
  flex:0 0 auto;
}

/* Footern är sista barnet i scrollern – både pushas ner och klistrar i botten */
#vc-minicart .mini-cart-footer{
  flex:0 0 auto;
  margin-top:auto;             /* tryck ner när listan är kort */
  position:sticky;             /* klistra när listan är lång och scrollar */
  bottom:0;
  background:var(--vcom-bg);
  border-top:1px solid var(--vcom-border);
  padding:12px 0;
  box-shadow:0 -6px 12px rgba(0,0,0,.05);
  z-index:1;
}

/* Dölj "Visa varukorg"-länken som hamnar under knappen efter AJAX-add */
.vcom-product-card .added_to_cart.wc-forward,
.products .added_to_cart.wc-forward,
.single-product .added_to_cart.wc-forward {
  display: none !important;
}

/* ===========================
   Mini-cart close button (cirkulär)
   =========================== */
#vc-minicart .vc-drawer__close {
  margin-left: auto;            
  appearance: none;
  background: #fff0f5;          /* ljus rosa grund */
  border: 1px solid #f5c6d6;    /* rosaaktig border */
  width: 36px;
  height: 36px;
  font-size: 1.3rem;            /* lagom stort kryss */
  line-height: 1;
  color: #d6336c;               /* mörkare rosa kryss */
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;           /* gör cirkel */
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}

#vc-minicart .vc-drawer__close:hover {
  background: #fce4ec;          /* lite starkare rosa på hover */
  color: #ad1457;               /* mörkare text */
  border-color: #f5a3c0;        /* tydligare border */
}