/* Bubble positioning - higher z-index in admin to appear above WP admin elements */
.op-bubble { position: fixed; right: 42px; bottom: 18px; z-index: 1050; }
body.wp-admin .op-bubble { z-index: 99999; }

/* Adjust bubble position in admin to account for admin menu */
@media screen and (min-width: 783px) {
  body.wp-admin.folded .op-bubble { right: 52px; }

}

/* Mobile admin adjustments */
@media screen and (max-width: 782px) {
  body.wp-admin .op-bubble { right: 20px; bottom: 20px; }
}

/* Animation for removing products from favorites */
@keyframes fadeOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.95);
  }
}

.op-bubble-btn {
  background: transparent; /* outer ring color will show via padding */
  color: #0d6efd;
  border: none;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  padding: 8px; /* show blue ring around inner white circle */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(13,110,253,0.16);
  background-color: #0d6efd; /* outer ring */
  cursor: pointer;
  position: relative;
}
.op-bubble-inner {
  background: transparent; /* transparent center */
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border: 3px solid #fff; /* white ring */
}
.op-bubble-inner svg { display:block; width:35px; height:35px; color: #fff; }
.op-bubble-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #dc3545;
  color: #fff;
  border-radius: 999px;
  min-width: 20px;
  height: 20px;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  padding: 0 5px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  border: 2px solid #fff;
  z-index: 10;
}
.op-bubble-btn:focus { outline: 3px solid rgba(13,110,253,0.2); outline-offset: 2px; }
.op-bubble-btn:hover { filter: brightness(1.03); }

/* Playful hint above the bubble */
.op-bubble-hint {
  position: fixed;
  right: 22px;
  bottom: 50px; /* raised slightly to sit a bit higher above the bubble */
  z-index: 9999999;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  transform-origin: center bottom;
  animation: op-bounce 1.4s infinite;
}

/* Adjust hint position in admin to match bubble offset */
@media screen and (min-width: 783px) {
  body.wp-admin.folded .op-bubble-hint { right: 32px; }
  body.wp-admin:not(.folded) .op-bubble-hint { right: 150px; }
}

@media screen and (max-width: 782px) {
  body.wp-admin .op-bubble-hint { right: 0; bottom: 56px; }
}
.op-bubble-hint { overflow: visible; }
.op-bubble-hint-text {
  background: rgba(0,112,255,0.95);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(8,30,78,0.18);
  display: inline-block;
  line-height: 1;
  white-space: nowrap;
}

.op-bubble-hint-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  transform: translateY(8px) scale(0.98) !important;
  animation: none !important;
  transition: opacity 260ms ease, transform 260ms ease, visibility 260ms ease;
}

@keyframes op-bounce {
  0% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(0); }
  75% { transform: translateX(-3px); }
  100% { transform: translateX(0); }
}

/* little downward arrow removed - now handled by JavaScript */
.op-modal { position: fixed; inset: 0; z-index: 10600; display:flex; align-items:center; justify-content:center }
.op-modal.d-none { display:none }
.op-modal.op-has-adminbar { /* when wp admin bar exists, push modal panel below it */
  align-items: flex-start;
  padding-top: calc(var(--op-adminbar-height, 46px) + 8px);
  box-sizing: border-box;
}

/* Higher z-index in admin area to appear above WP admin UI */
body.wp-admin .op-modal { z-index: 999999; }

.op-modal-backdrop { position:absolute; inset:0; background: rgba(0,0,0,0.45) }
.op-modal-panel { position:relative; width:100%; max-width:1100px; height:100%; max-height:900px; background:#fff; border-radius:10px; overflow:hidden; box-shadow:0 12px 40px rgba(0,0,0,0.3) }
#op-modal-container { height:100%; }

@media (max-width: 767px) {
  .op-modal-panel { width:100%; height:100%; border-radius:0; max-width:none; max-height:none }
}

/* Mobile adjustments for product-line to match portal page behavior */
@media (max-width: 767px) {
  .mobile-layout .op-product-line {
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    gap: .5rem !important;
  }
  .mobile-layout .op-product-line > div:first-child {
    flex: 1 0 60% !important;
    margin-bottom: 0.5rem;
  }
}

/* Smooth collapse transition for the customer details container on small screens */
@media (max-width: 767px) {
  #customer-details.op-collapsed {
    transition: max-height 0.32s ease-in-out;
  }
}

/* Header toggle for customer details (mobile only) */
@media (max-width: 767px) {
  /* Make header relative to allow absolute positioning of the toggle */
  #op-modal-container .card-header { position: relative; }
  .op-customer-toggle { display: inline-flex; align-items:center; justify-content:center; padding: .25rem .5rem; position: absolute; right: .5rem; top: 50%; transform: translateY(-50%); }
}
@media (min-width: 768px) {
  .op-customer-toggle { display: none !important; }
}

/* Mobile customer details teaser */
/* Mobile teaser removed per user request - no teaser styles */

/* Edit order modal should appear above bubble modal */
#op-order-edit-modal.modal {
  z-index: 1070 !important;
}
#op-order-edit-modal ~ .modal-backdrop {
  z-index: 1065 !important;
}

/* When bubble modal is open add a body class to help prevent background scroll */
body.op-modal-open {
  overflow: hidden !important;
}

/* Order-summary catalogue button (placed in the order summary header) */
.op-order-summary-catalogue-btn { 
  padding: 4px 8px;
  font-size: 0.85rem;
  margin-top: 6px;
  display: inline-block;
}

/* catalogue modal panel tweaks */
.op-catalogue-panel { max-width: 1000px; display:flex; flex-direction:column; padding:0; height: 80vh; min-height: 320px; }
.op-catalogue-header { flex: 0 0 auto; position: sticky; top: 0; z-index: 4; background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%); border-bottom: 1px solid #e9f0fb; padding: 10px 12px; }
.op-catalogue-header strong { font-size: 1.05rem; letter-spacing: 0.2px; }
.op-catalogue-header .btn { border-radius: 6px; }
.op-catalogue-body { display:flex; gap:0; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.op-catalogue-cats { width: 260px; min-width: 220px; border-right: 1px solid #eee; overflow:auto; min-height: 0; }
.op-catalogue-products { flex:1; overflow:auto; min-height: 0; }
.op-catalogue-cat-list .op-catalogue-cat { width:100%; text-align:left; }
.op-catalogue-cat { transition: background 180ms ease, transform 120ms ease; border-radius: 8px; padding: 8px 10px; }
.op-catalogue-cat:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(12,40,100,0.06); }
.op-catalogue-cat img.op-cat-thumb { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; border: 1px solid #eef6ff; }
.op-catalogue-product-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

.op-catalogue-product {
  position: relative; /* positioning context for bottom-right action button */
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px;
  padding-bottom: 52px; /* reserve space for absolute action button */
  border: 1px solid #f0f5fb;
  border-radius: 10px;
  background: linear-gradient(180deg, #fff 0%, #fbfdff 100%);
  transition: box-shadow 180ms ease, transform 140ms ease;
}

.op-catalogue-product:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(10,34,80,0.08);
}

.op-catalogue-product .op-catalogue-product-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.op-catalogue-product-img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.op-catalogue-product .op-catalogue-product-info > div > .fw-bold { font-size: 0.98rem; }
.op-catalogue-product .op-catalogue-product-info .text-muted.small { color: #3769a8; font-weight: 600; margin-top: 6px; }

/* Price badge (uses existing price text element) */
.op-catalogue-product .op-catalogue-price {
  background: linear-gradient(90deg,#fff3e0,#fff7f0);
  color: #c85a00;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
  display: inline-block;
  margin-left: 8px;
}

/* Position Add button bottom-right of the product card */
.op-catalogue-product .op-catalogue-product-info { 
  padding-right: 12px; /* avoid overlap with the positioned actions */
}
/* Actions container positioned bottom-right of card */
.op-catalogue-product .op-catalogue-actions {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 3;
}
.op-catalogue-product .op-catalogue-actions .op-catalogue-add {
  position: relative; /* keep button layout natural inside actions container */
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.op-catalogue-product .op-catalogue-actions .op-catalogue-add:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(13,110,253,0.12); }
.op-catalogue-product .op-catalogue-actions .op-catalogue-add:active { transform: translateY(0); }

/* Compact layout tweaks on small screens */
@media (max-width: 767px) {
  .op-catalogue-product { padding-bottom: 62px; }
  .op-catalogue-product-img { width: 56px; height: 56px; }
  .op-catalogue-product .op-catalogue-actions { right: 10px; bottom: 10px; }
}

/* Highlight active category and make it appear disabled */
.op-catalogue-cat {
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

.op-fav-btn {
  border-color: #0d6efd;
}

.op-catalogue-cat.op-catalogue-cat-active,
.op-catalogue-cat[aria-current="true"] {
  background: #0d6efd;
  color: #fff;
  pointer-events: none;
  box-shadow: 0 6px 14px rgba(13,110,253,0.12);
  border-color: #0d6efd;
}

.op-catalogue-cat.op-catalogue-cat-active .op-fav-unselected,
.op-catalogue-cat[aria-current="true"] .op-fav-unselected {
  display: none;
}

.op-catalogue-cat.op-catalogue-cat-active .op-fav-selected,
.op-catalogue-cat[aria-current="true"] .op-fav-selected {
  display: inline-block;
}

.op-fav-btn .op-fav-unselected {
  display: inline-block;
}

.op-fav-btn .op-fav-selected {
  display: none;
}

.op-fav-btn .op-fav-icon {
  vertical-align: middle;
  margin-right: 4px;
}

/* Inline products drawer inside each category for mobile accordion behavior */
.op-catalogue-cat-wrapper { margin-bottom: 6px; }
.op-catalogue-inline-products { display: none; padding: 8px 6px 12px 6px; border-radius: 6px; background: #fafafa; margin-top: 6px; }
.op-catalogue-inline-products.op-catalogue-inline-open { display: block; }
.op-catalogue-inline-products .op-catalogue-product-grid { grid-template-columns: 1fr; }

/* Make the inline drawer visually distinct */
.op-catalogue-inline-products .op-catalogue-product { border: 1px solid #eee; box-shadow: none; }

@media (max-width: 767px) {
  .op-catalogue-body { flex-direction:column; height: 70vh; }
  .op-catalogue-cats { width:100%; min-width:0; border-right:none; border-bottom:1px solid #eee; }
  .op-catalogue-product-grid { grid-template-columns: 1fr; }
  /* On mobile hide the right-hand products panel (we render inline drawers) */
  .op-catalogue-products { display: none; }
  /* Make the category list full-width and touch friendly */
  .op-catalogue-cat { padding: 10px; font-size: 0.95rem; }
}


.form-check-input[type=checkbox]{
  margin-top: 10px;
}

/* Ensure favorite hearts in search results are clickable */
.op-favorite-heart,
.op-favorite-star {
  pointer-events: auto !important;
  z-index: 10;
  padding: 4px;
  min-width: 24px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Make emoji images inside hearts inherit pointer events */
.op-favorite-heart img,
.op-favorite-star img {
  pointer-events: none;
}

/* Ensure view buttons are clickable */
.op-product-view-btn {
  pointer-events: auto !important;
  z-index: 10;
}

.op-product-view-btn svg {
  pointer-events: none;
}

/* Product Preview Modal */
#op-product-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
}

#op-product-preview-modal.op-modal-open {
  display: flex;
}

.op-preview-content {
  position: relative;
  width: 90%;
  max-width: 1200px;
  height: 90%;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
}

.op-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  border-bottom: 1px solid #e9f0fb;
  flex-shrink: 0;
}

.op-preview-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: #333;
  font-weight: 600;
}

.op-preview-close {
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.op-preview-close:hover {
  background: #f0f0f0;
  color: #333;
}

.op-preview-body {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#op-preview-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.op-preview-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: #0d6efd;
}

.op-preview-loading .spinner-border {
  width: 3rem;
  height: 3rem;
}

/* WooCommerce button "added" state styling */
.op-woo-added,
.op-woo-added.single_add_to_cart_button,
.op-woo-added.ajax_add_to_cart,
.op-woo-added.add_to_cart_button {
  background-color: #198754 !important;
  border-color: #198754 !important;
  color: #fff !important;
}

.op-woo-added:hover,
.op-woo-added.single_add_to_cart_button:hover,
.op-woo-added.ajax_add_to_cart:hover,
.op-woo-added.add_to_cart_button:hover {
  background-color: #198754 !important;
  border-color: #198754 !important;
  opacity: 0.9;
}

/* Animation for button state transitions */
.single_add_to_cart_button,
.ajax_add_to_cart,
.add_to_cart_button {
  transition: all 0.3s ease;
}

@media (max-width: 767px) {
  .op-preview-content {
    width: 95%;
    height: 95%;
    border-radius: 8px;
  }
  
  .op-preview-header {
    padding: 12px 16px;
  }
  
  .op-preview-header h3 {
    font-size: 1rem;
  }
}