/* ==========================================================================
   MYYARN CART FLYOUT - CONSOLIDATED STYLES
   ========================================================================== */

/* 1. TOP LEVEL PANEL & ICON */
.cart-flyout .cart-block--summary__icon img {
  display: none !important;
}

.cart-flyout .cart-block--summary__icon::before {
  font-family: "themify";
  content: "\e60d"; 
  font-size: 18px;
  line-height: 1;
  display: inline-block;
  vertical-align: middle;
}

#cart-offcanvas.cart-offcanvas {
  width: 420px;
  max-width: 90vw;
}

/* 2. ITEM ROW LAYOUT */
.myyarn-offcanvas-item {
  display: grid;
  grid-template-columns: 80px 1fr auto; /* Image | Details | Price */
  gap: 15px;
  align-items: center;
  padding: 15px;
  margin-bottom: 10px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
  border: 0 !important;
}

/* 3. IMAGE & DETAILS */
.myyarn-offcanvas-item__img {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0,0,0,.04);
  display: grid;
  place-items: center;
}

.myyarn-offcanvas-item__img-el {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.myyarn-offcanvas-item__details {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.myyarn-offcanvas-item__title {
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #202223;
}

/* 4. QUANTITY SELECTOR (RESIZED & UNIFIED) */
.myyarn-offcanvas-item__controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.myyarn-qty {
  display: inline-grid;
  /* Equal sized buttons and a fixed-width input */
  grid-template-columns: 32px 40px 32px; 
  align-items: center;
  justify-items: center;
  height: 34px; /* Slimmer height */
  border: 1px solid #d7d7d7;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.myyarn-qty__btn {
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  color: #202223;
  transition: background 0.2s;
}

.myyarn-qty__btn:hover {
  background: #f4f4f4;
}

.myyarn-qty__input, 
.cart-block--offcanvas-cart-table__quantity input[type="number"].myyarn-qty__input {
  width: 100% !important;
  height: 100% !important;
  border: 0 !important;
  background: transparent !important;
  text-align: center !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  padding: 0 !important;
  margin: 0 !important;
  outline: none !important;
  color: #202223;
}

/* Hide Spinners */
.myyarn-qty__input::-webkit-outer-spin-button,
.myyarn-qty__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.myyarn-qty__input { -moz-appearance: textfield; }

/* 5. REMOVE BUTTON (TRASH) */
.myyarn-remove {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 6px;
  border-radius: 8px;
  line-height: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.myyarn-remove:hover {
  background: #fdecea !important; /* Light red hover */
}

/* 6. PRICE & TOTALS */
.myyarn-offcanvas-item__total {
  justify-self: end;
  text-align: end;
  font-weight: 700;
  color: #202223;
}

html[dir="rtl"] .myyarn-offcanvas-item__total {
  justify-self: start;
  text-align: start;
}

/* 7. MESSAGES & ALERTS */
.myyarn-limit-error {
  margin: 10px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* 8. MOBILE RESPONSIVENESS */
@media (max-width: 480px) {
  .myyarn-offcanvas-item {
    grid-template-columns: 72px 1fr;
    grid-template-areas:
      "img details"
      "img total";
  }
  .myyarn-offcanvas-item__img { grid-area: img; width: 72px; height: 72px; }
  .myyarn-offcanvas-item__details { grid-area: details; }
  .myyarn-offcanvas-item__total { grid-area: total; justify-self: end; margin-top: 5px; }
  html[dir="rtl"] .myyarn-offcanvas-item__total { justify-self: start; }
}

/* Hide the 'Update Quantities' button - JS handles this automatically */
.cart-block--offcanvas-contents__update {
  display: none !important;
}

/* Optional: If there is a large gap left at the bottom of the cart */
.cart-block--offcanvas-contents {
  padding-bottom: 10px;
}

/* Sticky Footer for Total & Checkout */
.myyarn-cart-footer {
  border-top: 1px solid #e8e8e1;
  padding: 20px;
  background: #fff;
  position: sticky;
  bottom: 0;
  z-index: 10;
}

.myyarn-cart-footer__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.myyarn-cart-footer__label {
  font-size: 16px;
  font-weight: 600;
  color: #202223;
}

.myyarn-cart-footer__value {
  font-size: 18px;
  font-weight: 700;
  color: #202223;
}

/* Make Checkout Button Shopify-like */
.cart-block--offcanvas-contents__links a {
  display: flex !important;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 50px;
  background: #202223 !important; /* Dark Shopify theme */
  color: #ffffff !important;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
  transition: opacity 0.2s;
}

.cart-block--offcanvas-contents__links a:hover {
  opacity: 0.9;
}

/* Container for the total */
.myyarn-cart-footer {
  border-top: 1px solid #ebebeb;
  padding: 20px 10px 10px;
  margin-top: 15px;
  background: #fff;
}

.myyarn-cart-footer__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.myyarn-cart-footer__label {
  font-weight: 600;
  color: #6d7175;
}

.myyarn-cart-footer__value {
  font-weight: 700;
  font-size: 20px;
  color: #202223;
}

/* Style the native checkout buttons to match */
.cart-block--offcanvas-contents__links {
  padding: 0 10px 20px;
}

.cart-block--offcanvas-contents__links a {
  display: flex !important;
  background: #202223 !important;
  color: #fff !important;
  height: 50px;
  border-radius: 8px;
  justify-content: center;
  align-items: center;
  text-decoration: none !important;
  font-weight: 600;
  margin-top: 10px;
}

/* Hide original update button */
.cart-block--offcanvas-contents__update {
  display: none !important;
}

/* Primary Checkout Button (formerly View Cart) */
.cart-block--offcanvas-contents__links a.button--checkout-primary {
  display: flex !important;
  background: #202223 !important; /* Shopify Dark */
  color: #fff !important;
  height: 54px;
  border-radius: 10px;
  justify-content: center;
  align-items: center;
  text-decoration: none !important;
  font-weight: 700;
  font-size: 18px;
  width: 100%;
  transition: transform 0.1s ease, background 0.2s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.cart-block--offcanvas-contents__links a.button--checkout-primary:active {
  transform: scale(0.98);
}

/* Hide any other redundant links in that container if they exist */
.cart-block--offcanvas-contents__links a:not(.button--checkout-primary) {
  display: none !important;
}

/* 1. Minimal Shopify Close Button */
.cart--cart-offcanvas__close {
  position: absolute;
  top: 15px;
  right: 15px; /* Change to 'left: 15px' if the site isn't handling RTL automatically */
  z-index: 10;
}

.cart--cart-offcanvas__close .button.btn {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #202223 !important; /* Shopify dark slate */
  font-size: 24px !important; /* Size of the X */
  font-weight: 300 !important; /* Thin, elegant X */
  padding: 0 !important;
  margin: 0 !important;
  line-height: 1 !important;
  cursor: pointer;
  transition: opacity 0.2s ease;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart--cart-offcanvas__close .button.btn:hover {
  opacity: 0.5;
}

/* Ensure the 'Close cart' text stays hidden */
.cart--cart-offcanvas__close .visually-hidden {
  position: absolute !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  border: 0 !important;
}

/* 2. Tighten Header Space */
.cart-offcanvas__header {
  padding-top: 10px !important;
  padding-bottom: 10px !important;
  min-height: auto !important;
}

.myyarn-cart-footer__value {
  /* This forces the symbol to the left and number to the right */
  direction: ltr !important; 
  unicode-bidi: isolate;
  display: inline-block;
  font-weight: bold;
}

/* Optional: Add space if &nbsp; isn't enough */
.myyarn-cart-footer__value .currency-symbol {
  margin-right: 2px;
}

.myyarn-limit-error {
  background: #FFF4F4;
  color: #202223;
  padding: 14px;
  margin: 10px;
  border: 1px solid #FFE0E0;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
}

/* For Hebrew/Arabic (RTL) */
[dir="rtl"] .myyarn-limit-error {
  direction: rtl;
  text-align: right;
}

/* For English/Other (LTR) */
[dir="ltr"] .myyarn-limit-error {
  direction: ltr;
  text-align: left;
}

/* Ensure the first item doesn't slide under the close button */
.cart-block--offcanvas-contents__inner {
    padding-top: 50px !important; /* Adjust height based on your button size */
    position: relative;
}

/* Optional: Specifically target the close button to ensure it stays in that padded area */
.cart--cart-offcanvas__close {
    position: absolute;
    top: 10px;
    right: 15px;
    z-index: 10;
}