/* ==============================================
   WoodMart Gift Box Builder - FIXED VERSION
   All Issues Resolved
   ============================================== */

/* ============================================
   1. FIX: ღილაკის სტილი - უფრო პატარა და მოწესრიგებული
   ============================================ */
.wmgb-add-to-box-btn {
  margin-top: 10px;
  width: auto !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent !important;
  border: 1px solid #33333333 !important;
  color: #333 !important;
  padding: 8px 16px !important;
  font-size: 12px !important;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* 2. FIX: ჰოვერზე აიქონიც თეთრდება */
.wmgb-add-to-box-btn:hover {
  background: #333 !important;
  color: #fff !important;
  border-color: #333 !important;
}

.wmgb-add-to-box-btn:hover svg path,
.wmgb-add-to-box-btn:hover svg rect {
  stroke: #fff !important;
}

.wmgb-btn-icon {
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
}

.wmgb-btn-icon svg {
  width: 16px;
  height: 16px;
  transition: all 0.3s ease;
}

.wmgb-btn-text {
  font-weight: 600;
  color: #333 !important;  /* შავი ფერი ALWAYS */
  transition: color 0.3s ease;
}

/* ჰოვერზე ტექსტიც თეთრდება */
.wmgb-add-to-box-btn:hover .wmgb-btn-text {
  color: #fff !important;
}

/* Shop/Archive page buttons */
.products .product .wmgb-add-to-box-btn,
.products .product .wmgb-shop-btn {
  margin-top: 8px;
  font-size: 12px !important;
  padding: 8px 16px !important;
  width: 100% !important;
}

/* ============================================
   Progress Bar - 250₾ ლიმიტით (SMALLER VERSION)
   ============================================ */
.wmgb-progress-container {
  background: #fff;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  padding: 15px 20px;  /* შემცირებული padding */
  margin: 15px 0;  /* შემცირებული margin */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.wmgb-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;  /* შემცირებული */
}

.wmgb-progress-title {
  font-size: 14px;  /* შემცირებული */
  font-weight: 700;
  color: #333;
}

.wmgb-progress-amount {
  font-size: 16px;  /* შემცირებული */
  font-weight: 700;
  color: #a50909;
}

.wmgb-progress-bar-wrapper {
  width: 100%;
  height: 8px;  /* 12px-დან 8px-მდე */
  background: #f0f0f0;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  margin-bottom: 6px;  /* შემცირებული */
}

.wmgb-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #a50909 0%, #d41414 100%);
  border-radius: 10px;
  transition: width 0.4s ease;
  position: relative;
}

.wmgb-progress-bar.complete {
  background: linear-gradient(90deg, #27ae60 0%, #2ecc71 100%);
}

.wmgb-progress-message {
  font-size: 12px;  /* შემცირებული */
  color: #666;
  text-align: center;
  margin: 0;
}

.wmgb-progress-message.complete {
  color: #27ae60;
  font-weight: 600;
}

/* --- Floating Widget --- */
.wmgb-floating-widget {
  position: fixed;
  bottom: 40px;
  right: 20px;
  z-index: 9999;
  font-family: inherit;
  max-width: 90vw;
}

.wmgb-widget-trigger {
  background: #fff;
  border: 2px solid #d1d1d1;
  border-radius: 10px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

.wmgb-widget-trigger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* --- Panel --- */
.wmgb-widget-panel {
  position: absolute;
  bottom: 100%;
  right: 0;
  width: 450px;
  max-width: 90vw;
  background: #fff;
  border: 2px solid #333;
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
  max-height: 500px;
  display: flex;
  flex-direction: column;
}

/* --- Header --- */
.wmgb-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e0e0e0;
  background: #fafafa;
  border-radius: 10px 10px 0 0;
}

.wmgb-panel-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #333;
}

.wmgb-close-panel {
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: #999;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.3s;
  border-radius: 4px;
}

.wmgb-close-panel:hover {
  color: #333;
  background: #f0f0f0;
}

/* --- Content Area --- */
.wmgb-panel-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* --- Panel Progress Bar (inside box widget) --- */
.wmgb-panel-progress {
  background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
  border-bottom: 1px solid #e0e0e0;
  padding: 12px 16px;
  margin: 0;
}

.wmgb-panel-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.wmgb-panel-progress-title {
  font-size: 13px;
  font-weight: 600;
  color: #333;
}

.wmgb-panel-progress-amount {
  font-size: 14px;
  font-weight: 700;
  color: #a50909;
}

.wmgb-panel-progress-bar-wrapper {
  width: 100%;
  height: 6px;
  background: #e9ecef;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 4px;
}

.wmgb-panel-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #a50909 0%, #d41414 100%);
  border-radius: 10px;
  transition: width 0.4s ease;
}

.wmgb-panel-progress-bar.complete {
  background: linear-gradient(90deg, #27ae60 0%, #2ecc71 100%);
}

.wmgb-panel-progress-message {
  font-size: 11px;
  color: #666;
  text-align: center;
  margin: 0;
}

.wmgb-panel-progress-message.complete {
  color: #27ae60;
  font-weight: 600;
}

/* --- Items Wrapper --- */
.wmgb-box-items {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

/* --- Empty State --- */
.wmgb-empty-message {
  text-align: center;
  padding: 40px 20px;
  color: #999;
  font-size: 14px;
}

/* ======================================================
   BOX ITEM STRUCTURE
   ====================================================== */
.wmgb-box-item {
  display: grid;
  grid-template-columns: 80px 1fr 150px;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  margin-bottom: 12px;
  background: #fafafa;
  transition: all 0.3s;
}

.wmgb-box-item:hover {
  background: #f5f5f5;
  border-color: #d0d0d0;
}

/* --- Image --- */
.wmgb-item-image {
  width: 70px;
  height: 70px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e0e0e0;
}

.wmgb-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- Text Details --- */
.wmgb-item-details {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  height: 100%;
}

/* ✅ Variation Attributes Styling */
.wmgb-item-attributes {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
  font-size: 12px;
  color: #666;
}

.wmgb-attribute {
  display: block;
  line-height: 1.4;
}

.wmgb-attribute strong {
  color: #333;
  font-weight: 600;
}

.wmgb-item-name {
  font-size: 15px;
  font-weight: 600;
  color: #222 !important;  /* შავი ფერი ALWAYS */
  margin: 0 0 4px 0;
  line-height: 1.4;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
}

.wmgb-item-price {
  font-size: 14px;
  color: #666 !important;  /* ნაცრისფერი ALWAYS */
}

/* --- Right Actions --- */
.wmgb-item-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  margin-left: auto;
  height: 100%;
}

/* --- Quantity Controls --- */
.wmgb-quantity-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
}

.wmgb-qty-minus,
.wmgb-qty-plus {
  background: #000;
  border: none;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  transition: all 0.2s;
}

.wmgb-qty-minus:hover,
.wmgb-qty-plus:hover {
  background: #c00000;
  color: #fff;
}

.wmgb-quantity-input {
  width: 45px;
  height: 28px;
  text-align: center;
  border: none;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: #a50909;
}

/* --- Total & Remove --- */
.wmgb-item-total {
  font-size: 15px;
  font-weight: 700;
  color: #333;
  white-space: nowrap;
}

/* 3. FIX: წაშლის ღილაკი ჩანდეს და მუშაობდეს */
.wmgb-remove-item {
  background: #fff !important;
  border: 2px solid #e74c3c !important;
  color: #e74c3c !important;
  cursor: pointer;
  padding: 0 !important;
  border-radius: 50%;
  transition: all 0.3s;
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  min-height: 32px !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 24px !important;
  font-weight: bold;
  line-height: 1;
  position: relative;
}

.wmgb-remove-item:hover {
  background: #e74c3c !important;
  border-color: #e74c3c !important;
  color: #fff !important;
  transform: scale(1.15) rotate(90deg);
}

/* Remove dashicons completely */
.wmgb-remove-item .dashicons {
  display: none !important;
}

/* ======================================================
   Footer & Total
   ====================================================== */
.wmgb-panel-footer {
  padding: 16px 20px;
  border-top: 2px solid #e0e0e0;
  background: #f9f9f9;
}

.wmgb-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.wmgb-total-price {
  font-size: 22px;
  font-weight: 700;
  color: #27ae60;
}
/* Add to Cart Button - Dynamic styling based on minimum amount */

.wmgb-add-to-cart-btn {
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

/* Disabled state - gray background (under 250₾) */
.wmgb-add-to-cart-btn:disabled {
  background: #9e9e9e !important;
  color: #fff !important;
  cursor: not-allowed;
  opacity: 1;
}

/* Enabled state - red background with white text (250₾+) */
.wmgb-add-to-cart-btn:not(:disabled) {
  background: #a50909 !important;
  color: #fff !important;
}

.wmgb-add-to-cart-btn:hover:not(:disabled) {
  background: #870606 !important;
  color: #fff !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Min items notice */
.wmgb-min-items-notice {
  text-align: center;
  margin-top: 8px;
  font-size: 12px;
  color: #999;
}

/* ======================================================
   4. FIX: Checkout page - Gift box image
   ====================================================== */
.woocommerce-checkout .cart_item img {
  max-width: 64px !important;
  height: auto;
}

/* Add gift icon for gift box products */
.cart_item [data-title*="სასაჩუქრე ყუთი"] img,
.cart_item [data-title*="Gift Box"] img {
  content: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64"><rect x="8" y="24" width="48" height="32" rx="2" fill="%23a50909"/><rect x="4" y="18" width="56" height="8" rx="2" fill="%23d41414"/><path d="M32 18 L32 56" stroke="%23fff" stroke-width="3"/><path d="M8 28 L56 28" stroke="%23fff" stroke-width="2"/><circle cx="32" cy="12" r="6" fill="%23ffd700"/><path d="M28 8 Q32 4 36 8" fill="none" stroke="%23ffd700" stroke-width="2"/></svg>');
  width: 64px;
  height: 64px;
  object-fit: contain;
}

/* ======================================================
   Responsive Adjustments
   ====================================================== */
@media (max-width: 768px) {
  .wmgb-box-item {
    grid-template-columns: 60px 1fr;
    gap: 10px;
  }

  .wmgb-item-actions {
    grid-column: 1 / -1;
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  
  .wmgb-progress-container {
    padding: 15px;
    margin: 15px 0;
  }
  
  .wmgb-progress-title {
    font-size: 14px;
  }
  
  .wmgb-progress-amount {
    font-size: 16px;
  }
}

/* Notification styles */
.wmgb-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #fff;
  border-left: 4px solid #27ae60;
  padding: 16px 20px;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 99999;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
  max-width: 300px;
}

.wmgb-notification.show {
  opacity: 1;
  transform: translateX(0);
}

.wmgb-notification-success {
  border-left-color: #27ae60;
}

.wmgb-notification-error {
  border-left-color: #e74c3c;
}

/* Loading state */
.wmgb-floating-widget.loading {
  pointer-events: none;
  opacity: 0.6;
}

/* Widget info */
.wmgb-widget-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wmgb-widget-title {
  font-size: 14px;
  font-weight: 700;
  color: #333;
}

.wmgb-widget-count {
  font-size: 12px;
  color: #666;
}

.wmgb-widget-total {
  font-size: 16px;
  font-weight: 700;
  color: #a50909;
  margin-left: auto;
}


/* ============================================
   CART & CHECKOUT - Full Size BOX4.png Image
   ============================================ */
.woocommerce-cart-form__cart-item img[src*="gift-box"],
.woocommerce-checkout-review-order-table img[src*="gift-box"],
.woocommerce-cart-form__cart-item img[src*="BOX4"],
.woocommerce-checkout-review-order-table img[src*="BOX4"],
.woocommerce-cart-form__cart-item img[alt*="სასაჩუქრე"],
.woocommerce-checkout-review-order-table img[alt*="სასაჩუქრე"] {
  width: 100% !important;
  height: auto !important;
  max-width: 150px !important;
  object-fit: contain !important;
  display: block !important;
}

.woocommerce-cart-form__cart-item .product-thumbnail,
.woocommerce-checkout-review-order-table .product-thumbnail {
  min-width: 100px;
  max-width: 150px;
}


/* ============================================
   CRITICAL: Hide button on single product & WoodMart Swatches
   ============================================ */
.single-product .wmgb-add-to-box-btn,
body.single-product .wmgb-add-to-box-btn,
.wd-swatches-product .wmgb-add-to-box-btn {
  display: none !important;
}

/* Show EVERYWHERE else (shop, archive, quick view) */
.wmgb-add-to-box-btn {
  display: inline-flex !important;
}
