/* =============================================
   SUBSITE SHOP — UI ADDITIONS
   Quick-view drawer, toast, AJAX states,
   product image quick-view overlay
   Add this to shop.css or enqueue separately
============================================= */

/* ─────────────────────────────────────────────
   PRODUCT IMAGE — Quick-View overlay on hover
───────────────────────────────────────────── */

/* Remove any pointer-events: none / cursor: default
   that may exist in shop.css on .farmtab-product-link */
.farmtab-product-link {
  display: block;
  position: relative;
  pointer-events: auto !important;
  cursor: pointer !important;
  text-decoration: none;
}

.farmtab-product-image-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s ease;
}

.farmtab-product-image-overlay-text {
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  background: rgba(0,0,0,.55);
  padding: 5px 12px;
  border-radius: 20px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .2s ease, transform .2s ease;
  letter-spacing: 0.03em;
  pointer-events: none;
}

.farmtab-product-image:hover .farmtab-product-image-overlay {
  background: rgba(0,0,0,.18);
}

.farmtab-product-image:hover .farmtab-product-image-overlay-text {
  opacity: 1;
  transform: translateY(0);
}

/* ─────────────────────────────────────────────
   PRODUCT QUICK-VIEW DRAWER
───────────────────────────────────────────── */
.farmtab-quickview-drawer {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
}

.farmtab-quickview-drawer.is-open {
  display: block;
}

.farmtab-quickview-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.5);
  animation: qvFadeIn .25s ease;
}

.farmtab-quickview-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 20px 20px 0 0;
  max-height: 92vh;
  overflow-y: auto;
  padding: 1.5rem 1.25rem 2rem;
  animation: qvSlideUp .3s ease;
  max-width: 1400px;
  margin: auto;
  display:block;
}

@keyframes qvSlideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

@keyframes qvFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.farmtab-quickview-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: #f3f4f6;
  color: #374151;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background .15s;
}

.farmtab-quickview-close:hover {
  background: #e5e7eb;
}

/* Loading spinner */
.farmtab-quickview-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 0;
}

.farmtab-qv-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #e5e7eb;
  border-top-color: #2f6f3e;
  border-radius: 50%;
  animation: qvSpin .7s linear infinite;
  display: block;
}

@keyframes qvSpin {
  to { transform: rotate(360deg); }
}

/* Quick-view product layout */
.farmtab-quickview-product {
  display: flex;
  gap: 1.5rem;
  margin-top: 0.5rem;
}

/* Media column */
.farmtab-qv-media {
  flex: 0 0 220px;
  max-width: 220px;
}

.farmtab-qv-image img {
  width: 100%;
  border-radius: 10px;
  object-fit: cover;
  aspect-ratio: 1/1;
}

.farmtab-qv-gallery {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.farmtab-qv-gallery-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid #e5e7eb;
  transition: border-color .15s;
}

.farmtab-qv-gallery-thumb:hover {
  border-color: #2f6f3e;
}

.farmtab-qv-gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Details column */
.farmtab-qv-details {
  flex: 1;
  min-width: 0;
}

.farmtab-qv-location {
  font-size: 0.78rem;
  color: #6b7280;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.farmtab-qv-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: #111827;
  margin: 0 0 6px;
  line-height: 1.25;
}

.farmtab-qv-price {
  font-size: 1.15rem;
  font-weight: 700;
  color: #14532d;
  margin-bottom: 12px;
}

.farmtab-qv-out-of-stock {
  font-size: 0.85rem;
  color: #dc2626;
  font-weight: 600;
  margin-bottom: 8px;
}

.farmtab-qv-short-desc {
  font-size: 0.9rem;
  color: #374151;
  line-height: 1.6;
  margin-bottom: 14px;
}

/* Cart area inside quick-view */
.farmtab-qv-cart-area {
  margin-bottom: 14px;
}

.farmtab-qv-cart-area .single_add_to_cart_button {
  width: 100%;
  margin-top: 1rem;
}

/* Description accordion */
.farmtab-qv-description {
  margin-bottom: 12px;
  border-top: 1px solid #f3f4f6;
  padding-top: 10px;
}

.farmtab-qv-description summary {
  font-size: 0.85rem;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  list-style: none;
  padding: 4px 0;
}

.farmtab-qv-description summary::-webkit-details-marker {
  display: none;
}

.farmtab-qv-description summary::after {
  content: ' ▾';
  font-size: 0.75rem;
}

.farmtab-qv-description[open] summary::after {
  content: ' ▴';
}

.farmtab-qv-description-body {
  font-size: 0.85rem;
  color: #4b5563;
  line-height: 1.6;
  padding: 8px 0 0;
}

.farmtab-qv-permalink {
  font-size: 0.8rem;
  color: #6b7280;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.farmtab-qv-permalink:hover {
  color: #2f6f3e;
}

.farmtab-qv-error {
  text-align: center;
  color: #dc2626;
  padding: 2rem;
  font-size: 0.9rem;
}

/* Mobile: stack image above details */
@media (max-width: 600px) {
  .farmtab-quickview-panel {
    padding: 1.25rem 1rem 2rem;
  }

  .farmtab-quickview-product {
    flex-direction: column;
    gap: 1rem;
  }

  .farmtab-qv-media {
    flex: 0 0 auto;
    max-width: 100%;
  }

  .farmtab-qv-image img {
    max-height: 240px;
    object-fit: cover;
    width: 100%;
  }

  .farmtab-qv-title {
    font-size: 1.1rem;
  }
}

/* ─────────────────────────────────────────────
   CART DRAWER — desktop always-on override
   (removes the previous width-check that
    sent desktop users to /cart)
───────────────────────────────────────────── */

/* The cart button is always a <button>, never <a> */
.farmtab-cart-link,
#farmtab-cart-drawer-toggle {
  pointer-events: auto !important;
  cursor: pointer !important;
  background: none;
  border: none;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  position: relative;
  color: inherit;
  padding: 0;
}

/* On desktop, the mobile-cart-drawer is still used
   but we give it a right-side panel style for large screens */
@media (min-width: 961px) {
  .mobile-cart-drawer.is-open {
    display: block;
  }

  .mobile-cart-panel {
    /* Switch from bottom-sheet to right sidebar on desktop */
    position: absolute;
    top: 0;
    right: 0;
    bottom: auto;
    left: auto;
    width: 360px;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    padding: 1.5rem;
    animation: cartSlideInRight .3s ease;
    overflow-y: auto;
  }

  @keyframes cartSlideInRight {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
  }
}

/* ─────────────────────────────────────────────
   AJAX BUTTON STATES
───────────────────────────────────────────── */
button.loading {
  opacity: 0.7;
  pointer-events: none;
}

button.loading::after {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255,255,255,.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: qvSpin .6s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}

button.btn-added {
  background: #14532d !important;
}

/* ─────────────────────────────────────────────
   TOAST NOTIFICATION
───────────────────────────────────────────── */
.farmtab-cart-toast {
  position: fixed;
  bottom: -100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 11000;
  transition: bottom .3s cubic-bezier(.34,1.56,.64,1);
  min-width: 280px;
  max-width: 420px;
  width: calc(100% - 2rem);
}

.farmtab-cart-toast.is-visible {
  bottom: 1.5rem;
}

.farmtab-toast-inner {
  background: #1f2937;
  color: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}

.farmtab-toast-img {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.farmtab-toast-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.farmtab-toast-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  color: #fff;
}

.farmtab-toast-text strong {
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff !important;
}

.farmtab-toast-text span {
  font-size: 0.78rem;
  color: rgba(255,255,255,.7);
}

.farmtab-toast-cart-btn {
  background: #2f6f3e;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background .15s;
}

.farmtab-toast-cart-btn:hover {
  background: #235530;
}

.farmtab-toast-error .farmtab-toast-inner {
  background: #7f1d1d;
}

.sidebar-cart-item-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 5px;
}
 
.cart-qty-btn {
  width: 26px;
  height: 26px;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  background: #f9fafb;
  color: #374151;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s, border-color .12s;
  flex-shrink: 0;
  padding: 0;
}
 
.cart-qty-btn:hover {
  background: #e5e7eb;
  border-color: #9ca3af;
}
 
.cart-qty-input {
  width: 40px;
  height: 26px;
  text-align: center;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  font-size: 0.82rem;
  color: #111827;
  background: #fff;
  padding: 0 2px;
  -moz-appearance: textfield;
}
 
.cart-qty-input::-webkit-outer-spin-button,
.cart-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
 
.cart-qty-input:focus {
  outline: none;
  border-color: #2f6f3e;
}
 
.cart-remove-btn {
  margin-left: auto;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: #9ca3af;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s, color .12s;
  padding: 0;
  flex-shrink: 0;
}
 
.cart-remove-btn:hover {
  background: #fee2e2;
  color: #dc2626;
}