/* Progress Bar Styles */
.acd-progress-bar-container {
  width: 100%;
  height: 20px;
  background-color: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin: 10px 0;
  overflow: hidden;
  position: relative;
}
.acd-progress-bar {
  height: 100%;
  background-color: #4caf50;
  transition: width 0.3s ease;
}
.acd-progress-text {
  font-size: 13px;
  margin-top: 5px;
  color: #333;
  font-weight: 500;
}

/* Mini Cart Styles */
.acd-mini-cart-progress-bar-container {
  margin-top: 10px;
  margin-bottom: 10px;
  padding: 0 10px;
  clear: both;
}
.acd-mini-cart-progress-bar-container .acd-progress-bar-container {
  height: 10px;
}
.acd-mini-cart-progress-bar-container .acd-progress-text {
  font-size: 11px;
}

/* Discount Badge Styles */
.acd-discount-badge {
  display: inline-block;
  background-color: #4caf50;
  color: #fff !important;
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: 5px;
  font-size: 0.8em;
  font-weight: 600;
  line-height: 1.5;
  vertical-align: middle;
}

/* Original Price with Strikethrough */
.acd-original-price {
  text-decoration: line-through;
  opacity: 0.7;
  margin-right: 5px;
  display: inline-block;
}

/* Mini Cart Price Formatting */
.woocommerce-mini-cart__total.total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
}
.acd-mini-cart-totals {
  text-align: right;
  display: flex;
  align-items: center;
}
.acd-mini-cart-item-total {
  display: block;
  text-align: right;
}

/* Cart Items Price Adjustments */
.woocommerce-cart-form__cart-item .product-price,
.woocommerce-cart-form__cart-item .product-subtotal {
  position: relative;
}

/* Maximum Discount Style */
.acd-max-discount {
  border-color: #4caf50 !important;
}
.acd-max-discount .acd-progress-bar {
  background-color: #4caf50 !important;
}

/* Progress Bar Animation */
@keyframes acd-progress-bar-stripes {
  from {
    background-position: 40px 0;
  }
  to {
    background-position: 0 0;
  }
}

/* Responsive Adjustments */
@media screen and (max-width: 768px) {
  .acd-progress-bar-container {
    height: 15px;
  }
  .acd-progress-text {
    font-size: 12px;
  }
  .acd-discount-badge {
    padding: 1px 4px;
    font-size: 0.75em;
  }
  .acd-original-price {
    font-size: 0.85em;
  }

  /* Fix for mini-cart in mobile view */
  .widget_shopping_cart_content {
    position: relative !important;
    z-index: 1000;
  }

  /* Improved flexbox for mobile */
  .woocommerce-mini-cart__total.total {
    flex-wrap: wrap;
  }
  .acd-mini-cart-totals {
    width: 100%;
    margin-top: 5px;
    justify-content: flex-end;
  }

  /* Mobile cart page styles */
  .woocommerce-cart table.cart td.product-subtotal {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
  }

  /* Fix for badge position in mobile cart */
  .product-subtotal .acd-discount-badge {
    margin-top: 3px;
  }
}

/* Fix for mini cart float */
.woocommerce-mini-cart::after {
  content: "";
  display: table;
  clear: both;
}

/* Ensure mini cart items are positioned correctly */
.woocommerce-mini-cart-item {
  position: relative;
}

/* Ensure no overlap with other elements */
.woocommerce .woocommerce-cart-form__cart-item .product-price,
.woocommerce .woocommerce-cart-form__cart-item .product-subtotal {
  vertical-align: middle;
}

/* Ensure progress bar has adequate spacing */
.acd-progress-bar-container + .acd-progress-text {
  margin-bottom: 15px;
}

/* Theme compatibility fixes */
.theme-twentytwenty .acd-discount-badge,
.theme-twentytwentyone .acd-discount-badge,
.theme-twentytwentytwo .acd-discount-badge {
  vertical-align: middle;
}

/* Fix for specific theme issues with mini-cart */
body.theme-astra .woocommerce-mini-cart__total.total,
body.theme-oceanwp .woocommerce-mini-cart__total.total,
body.theme-storefront .woocommerce-mini-cart__total.total {
  display: flex;
  flex-wrap: nowrap;
}

/* Fix checkout display issues */
.woocommerce-checkout-review-order-table .cart-subtotal,
.woocommerce-checkout-review-order-table .order-total {
  position: relative;
}

/* Product Discount Info */
.acd-product-discount-info {
  background-color: #f9f9f9;
  border: 1px solid #ddd;
  padding: 15px;
  margin-top: 20px;
  border-radius: 5px;
}

.acd-product-discount-info h4 {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: bold;
}

.acd-product-discount-info ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.acd-product-discount-info ul li {
  margin: 5px 0;
  font-size: 14px;
}

/* ...existing code... */

.acd-sale-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #e74c3c;
  color: #fff !important;
  padding: 4px 12px;
  border-radius: 3px;
  font-weight: bold;
  font-size: 0.95em;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  letter-spacing: 0.5px;
  pointer-events: none;
  user-select: none;
}
.woocommerce .products .product .acd-sale-badge {
  left: 0;
  top: 0;
  border-radius: 0 0 6px 0;
  font-size: 0.85em;
  padding: 3px 10px;
}

/* Styles for the discount list container */
.styled-discount-list {
  background-color: #f7fafd;
  border: 1px solid #d1e3ff;
  border-left: 5px solid #4a90e2;
  padding: 20px;
  margin-top: 25px;
  margin-bottom: 25px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Header style */
.styled-discount-list h4 {
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 1.1em;
  color: #333;
  font-weight: 600;
  border-bottom: 1px dashed #cce0ff;
  padding-bottom: 10px;
}

/* Unordered list styling */
.styled-discount-list ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* List item styling */
.styled-discount-list ul li.discount-item {
  background-color: #fff;
  border: 1px solid #e1e8ed;
  padding: 12px 15px;
  margin-bottom: 10px;
  border-radius: 6px;
  font-size: 0.95em;
  line-height: 1.5;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  display: flex; /* Use flexbox for alignment */
  align-items: center; /* Vertically align icon and text */
}

/* Add a subtle hover effect */
.styled-discount-list ul li.discount-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* Styling for the Dashicon span */
.styled-discount-list ul li.discount-item .dashicons {
  margin-right: 10px; /* Space between icon and text */
  font-size: 18px; /* Adjust icon size */
  line-height: 1; /* Ensure proper alignment */
  color: #4a90e2; /* Default icon color */
  flex-shrink: 0; /* Prevent icon from shrinking */
}

/* Style specific discount types differently using Dashicon colors (Optional Examples) */
.styled-discount-list ul li.discount-type-tier .dashicons {
  color: #f39c12; /* Orange color for tier */
}

.styled-discount-list ul li.discount-type-product-qty .dashicons {
  color: #2ecc71; /* Green color */
}

.styled-discount-list ul li.discount-type-bundle .dashicons {
  color: #e74c3c; /* Red color */
}

.styled-discount-list ul li.discount-type-bogo .dashicons {
  color: #3498db; /* Blue color */
}

.styled-discount-list ul li.discount-type-attribute .dashicons {
  color: #9b59b6; /* Purple color */
}

/* Remove margin from the last list item */
.styled-discount-list ul li.discount-item:last-child {
  margin-bottom: 0;
}

/* Add colors for NEW discount type icons */
.styled-discount-list ul li.discount-type-cart-qty .dashicons {
  color: #1abc9c; /* Teal color */
}
.styled-discount-list ul li.discount-type-role .dashicons {
  color: #e67e22; /* Carrot orange */
}
.styled-discount-list ul li.discount-type-location .dashicons {
  color: #3498db; /* Peter river blue */
}
.styled-discount-list ul li.discount-type-payment .dashicons {
  color: #27ae60; /* Nephritis green */
}
.styled-discount-list ul li.discount-type-first-order .dashicons {
  color: #f1c40f; /* Sun flower yellow */
}
.styled-discount-list ul li.discount-type-history .dashicons {
  color: #8e44ad; /* Wisteria purple */
}
.styled-discount-list ul li.discount-type-fixed .dashicons {
  color: #2c3e50; /* Midnight blue */
}

/* Frontend Notifications */
.acd-notification {
  position: fixed; /* Keep fixed for banners */
  z-index: 99999; /* Slightly lower than admin bar (100000 typically) but higher than most site content */
  padding: 10px 20px; /* Adjust padding as needed */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: none;
  text-align: center;
  font-size: 0.95em; /* Slightly smaller font for banners */
  line-height: 1.4;
  box-sizing: border-box;
  transition: transform 0.3s ease-out, opacity 0.3s ease-out; /* Smooth transitions */
}

.acd-notification-content {
  display: inline-block;
  margin-right: 35px; /* Space for close button */
  vertical-align: middle;
  max-width: calc(
    100% - 40px
  ); /* Ensure content doesn't overflow close button */
}
.acd-notification-content a {
  color: inherit;
  text-decoration: underline;
  font-weight: bold;
}
.acd-notification-content a:hover {
  opacity: 0.8;
}

.acd-notification-popup {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 8px;
  min-width: 300px;
  max-width: 90%; /* Max width for popup on smaller screens */
  width: auto; /* Let content define width up to max-width */
}

.acd-notification-banner_top {
  top: 0; /* Sticks to the top */
  left: 0;
  right: 0;
  width: 100%;
  border-radius: 0; /* No radius for top/bottom banners */
  /* Ensure it's above #wpadminbar if fixed, or body padding handles it */
}

/* If WordPress admin bar is present and fixed, adjust banner top position */
body.admin-bar .acd-notification-banner_top {
  top: 32px; /* Default height of admin bar */
}
@media screen and (max-width: 782px) {
  body.admin-bar .acd-notification-banner_top {
    top: 46px; /* Admin bar height on smaller screens */
  }
}
@media screen and (max-width: 600px) {
  /* Further adjustments if needed for very small screens */
}

.acd-notification-banner_bottom {
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  border-radius: 0;
}

.acd-notification-close {
  position: absolute;
  top: 50%;
  right: 10px; /* Closer to edge for banners */
  transform: translateY(-50%);
  background: transparent;
  border: none;
  font-size: 22px; /* Slightly smaller close button */
  cursor: pointer;
  padding: 0 5px;
  line-height: 1;
  opacity: 0.7;
  font-weight: bold;
}

.acd-notification-popup .acd-notification-close {
  top: 8px; /* Adjust for popup */
  right: 8px;
  transform: none;
}

.acd-notification-close:hover {
  opacity: 1;
}

/* Mini cart discount styles */
.acd-mini-cart-totals {
  display: inline-block;
}

.acd-original-price {
  text-decoration: line-through;
  opacity: 0.7;
  margin-right: 5px;
  color: #999;
}

.acd-mini-cart-subtotal {
  display: inline-block;
}

/* Ensure proper alignment in mini cart */
.woocommerce-mini-cart__total .amount {
  font-weight: bold;
}
