/* ==========================================================================
   A-Z QuickBuy Stylesheet
   ========================================================================== */

/* container */
.azqb-grid {
  display: flex;
  flex-direction: column;
  width: 100%;
  border: 1px solid #e6e6e6;
  font-size: 15px;
  border-radius: 6px;
  overflow: hidden;
}

/* header + rows */
.azqb-header,
.azqb-row {
  display: flex;
}

.azqb-header {
  background: #efe9e9;
  color: #2c382b;
  font-weight: 700;
  border-bottom: 1px solid #e6e6e6;
  text-transform: none;
  letter-spacing: 0;
}

.azqb-hcol,
.azqb-col {
  padding: 0.4em;
  border-right: 1px solid #e6e6e6;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #e6e6e6;
}

.azqb-hcol:last-child,
.azqb-col:last-child {
  border-right: none;
}

/* =========================================================
   SORT ICON STATE SYNC
   ========================================================= */
.azqb-hcol.sortable {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  user-select: none;
}

.azqb-hcol .sort-icons {
  display: flex;
  flex-direction: column;
  line-height: 1;
  font-size: 10px;
  opacity: 0.35;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.azqb-hcol.sortable:hover .sort-icons { opacity: 0.7; }

.azqb-hcol.sortable.active.asc .sort-icons .up {
  color: #2c382b;
  opacity: 1;
}
.azqb-hcol.sortable.active.asc .sort-icons .down { opacity: 0.25; }

.azqb-hcol.sortable.active.desc .sort-icons .down {
  color: #2c382b;
  opacity: 1;
}
.azqb-hcol.sortable.active.desc .sort-icons .up { opacity: 0.25; }

.azqb-hcol.sortable.active {
  font-weight: 700;
  color: #2c382b;
}

/* alternating rows */
.azqb-row.even { background: #fafafa; border-bottom: 1px solid #e6e6e6; }
.azqb-row.odd  { background: #ffffff; border-bottom: 1px solid #e6e6e6; }

/* image */
.azqb-col.image img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 2px;
  border: 0;
  display: block;
}

/* name link */
.azqb-name-link {
  color: #2c382b;
  text-decoration: none;
  font-weight: 600;
  line-height: 1.3;
}
.azqb-name-link:hover { text-decoration: underline; }
.azqb-variation { font-size: 13px; color: #555; }

/* --- Row masking to prevent bleed-through (FINAL CLEAN VERSION) --- */
.azqb-grid {
  position: relative;
  overflow: visible !important;
}

.azqb-row {
  position: relative;
  z-index: 1;
  overflow: visible !important;
}

/* Active row mask fix — keep row in flow but lift above others */
.azqb-row.azqb-row-mask {
  position: relative;  /* ✅ keep it in normal layout flow */
  z-index: 9000;       /* lift above other rows */
  background: #fff;    /* solid white background so nothing bleeds through */
}

/* Keep from being clipped by Divi wrappers */
.et_pb_row,
.et_pb_section,
.et_pb_module,
.et_pb_column {
overflow: visible !important;
}

/* =========================================================
   FIXED POPUP POSITION + CLEAN Z-INDEX STACKING
   ========================================================= */
.azqb-col.summary {
  position: relative;
  overflow: visible;
  z-index: 5;
}

/* Popup — properly anchored to Summary cell only */
.azqb-more-popup {
  position: absolute;
  top: 0;
  left: 0;
  display: none;
  background: #ffffff;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 1.2em 1em 2em 1em;
  width: calc(170% + 10px);        /* spans Summary + Price */
  min-height: 100%;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  overflow-y: auto;
  opacity: 0;
  transform: scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 9999;
}

/* When active, popup shows */
.azqb-more-popup.active {
  display: block;
  opacity: 1;
  transform: scale(1);
}

/* Scrollbar look */
.azqb-more-popup::-webkit-scrollbar {
  width: 6px;
}
.azqb-more-popup::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}
.azqb-more-popup::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}

/* Close button — fixed to top-right inside popup */
.azqb-close-popup {
  position: absolute;
  top: 6px;
  right: 8px;                 /* ✅ properly aligned on right */
  border: none;
  background: transparent;
  color: #333;
  font-size: 18px;
  font-weight: bold;
  line-height: 1;
  cursor: pointer;
  z-index: 10000;
}
.azqb-close-popup:hover {
  color: #759073;             /* green hover accent */
}

/* =========================================================
   SUMMARY COLUMN (Final Solid Popup + Divi-safe Fix)
   ========================================================= */

/* truncated preview text */
.azqb-summary-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
  max-height: calc(1.4em * 3);
}

/* "More" link (button-style) */
.azqb-more-link {
  align-self: flex-end;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 600;
  background: #fff;
  color: #000;
  border-radius: 5px;
  border: 1px solid #ccc;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  line-height: 1.2;
  height: auto;
  transition: all 0.2s ease;
  position: absolute;
  bottom: 3px;  /* lowered inside summary */
  right: 3px;
}

.azqb-more-link::after {
  content: "▾";
  background: #759073;
  color: #fff;
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 3px;
  line-height: 1;
}

.azqb-more-link:hover {
  background: #f3f3f3;
  border-color: #999;
}

.azqb-more-popup.active {
  display: block;
  opacity: 1;
  transform: scale(1);
}

/* Scrollbar styling */
.azqb-more-popup::-webkit-scrollbar { width: 6px; }
.azqb-more-popup::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}
.azqb-more-popup::-webkit-scrollbar-thumb:hover { background: #aaa; }

/* Close button */
.azqb-close-popup {
  position: absolute;
  top: 6px;
  right: 10px;               /* ✅ fixes left-alignment issue */
  border: none;
  background: transparent;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: #333;
  font-weight: bold;
  z-index: 10000;            /* ensures above text */
}

.azqb-close-popup:hover {
  color: #759073; /* subtle green hover */
}

/* Ensure popups are visible inside Divi modules */
.et_pb_row,
.et_pb_section,
.et_pb_module,
.et_pb_column {
  overflow: visible !important;
}

/* =========================================================
   PRICE DISPLAY
   ========================================================= */
.azqb-col.price {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.4;
}

.azqb-price-line { display: block; width: 100%; }
.azqb-price-line.sale {
  color: #c62828;
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 3px;
}
.azqb-price-line.regular {
  color: #777;
  text-decoration: line-through;
  font-size: 14px;
}
.azqb-price-line.normal {
  color: #2c382b;
  font-weight: 600;
  font-size: 15px;
}
.azqb-sale-label { font-size: 12px; color: #777; margin-left: 4px; }

/* =========================================================
   BUY COLUMN
   ========================================================= */
.azqb-col.buy {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.azqb-col.buy .azqb-qty {
  width: 60px;
  text-align: center;
  height: 32px;
  border: 1px solid #ccc;
  border-radius: 6px;
  margin-bottom: 8px;
  font-size: 15px;
}

/* Add to Cart button */
/*
.button.add_to_cart_button.ajax_add_to_cart {
  background: #759073 !important;
  color: #ffffff !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  border-radius: 50px !important;
  border: none !important;
  padding: 1px 5px !important;
  letter-spacing: 0.5px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.2);
  transition: all 0.25s ease-in-out;
  display: inline-block;
  text-decoration: none !important;
  cursor: pointer;
}
.button.add_to_cart_button.ajax_add_to_cart:hover,
.button.add_to_cart_button.ajax_add_to_cart:focus {
  background: #6b8469 !important;
  transform: translateY(-1px);
  box-shadow: 0 5px 10px rgba(0,0,0,0.25);
}
.button.add_to_cart_button.ajax_add_to_cart:active {
  transform: scale(0.97);
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
*/
/* =========================================================
   BOTTOM BAR
   ========================================================= */
.azqb-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
  border: 1px solid #e6e6e6;
  padding: 0.5em;
  background: #f9f9f9;
}
.azqb-left { display: flex; align-items: center; gap: 0.5em; }
.azqb-right { display: flex; align-items: center; gap: 0.75em; flex-wrap: wrap; }
.azqb-pager { display: flex; gap: 0.35em; }
.azqb-page {
  padding: 0.25em 0.55em;
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.azqb-page:hover { background: #ddd; }
.azqb-page.current {
  background: #2c382b;
  border-color: #2c382b;
  color: #fff;
}

/* green checkmark */
.azqb-added-check {
  display: none;
  margin-left: 6px;
  color: #2e7d32;
  font-size: 18px;
  font-weight: bold;
  vertical-align: middle;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 768px) {
  .azqb-header, .azqb-row { flex-direction: column; }
  .azqb-hcol, .azqb-col { width: 100% !important; border-bottom: 1px solid #e6e6e6; }
  .azqb-bottom { flex-direction: column; align-items: flex-start; gap: 0.6em; }
}

/* =========================================================
   SEARCH BAR & RESET LINK
   ========================================================= */
.azqb-searchbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 6px 8px;
  background: #fff;
  border: 0 solid #e6e6e6;
}
.azqb-search-label {
  color: #2c382b;
  font-weight: 600;
  font-size: 14px;
}
.azqb-search {
  flex: 1;
  max-width: 210px;
  padding: 6px 10px !important;
  border-radius: 15px;
  border: 1px solid #ccc;
  font-size: 15px;
}
.azqb-search:focus {
  outline: none;
  border-color: #759073;
  box-shadow: 0 0 0 2px rgba(117,144,115,0.25);
}

/* Reset link */
.azqb-reset-link {
  margin-left: 8px;
  color: #2c382b;
  text-decoration: none;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  font-weight: 600;
}
.azqb-reset-link.visible {
  opacity: 1;
  visibility: visible;
}
.azqb-reset-link:hover {
  text-decoration: none;
  font-weight: 500;
}

/* =========================================================
   CLEAN 3-LINE SUMMARY + SEPARATE MORE ROW
   ========================================================= */
.azqb-col.summary {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.4em;
  min-height: 7em;  /* gives space for text + button row */
  background: #fff;
  position: relative;
  overflow: visible;
}

.azqb-summary-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.azqb-more-row {
  display: flex;
  justify-content: flex-end;
  padding-right: 3px;
  padding-bottom: 3px;
  margin-top: 2px;
}

.azqb-more-row:empty {
  display: none;
}

.azqb-more-link {
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 600;
  background: #fff;
  color: #000;
  border-radius: 5px;
  border: 1px solid #ccc;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.azqb-more-link::after {
  content: "▾";
  background: #759073;
  color: #fff;
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 3px;
  line-height: 1;
}

.azqb-more-link:hover {
  background: #f3f3f3;
  border-color: #999;
}