/**
 * WDM Discount & Price Manager - Frontend Styles
 */

/* Fix tooltip bị ẩn dưới theme container */
.row:has(.wdm-coupons-slider-wrapper),
.row:has(.wdm-coupons-wrapper),
.row:has(.wdm-product-coupons-wrapper) {
  overflow: visible !important;
  position: relative !important;
  z-index: 1 !important;
}

/* Coupons Grid */
.wdm-coupons-wrapper {
  margin: 20px 0;
}

.wdm-coupons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 15px;
}

.wdm-coupons-slider {
  display: flex;
  overflow-x: auto;
  gap: 20px;
  padding-bottom: 10px;
}

.wdm-coupons-slider::-webkit-scrollbar {
  height: 8px;
}

.wdm-coupons-slider::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}

/* Coupon Card - Layout 2 cột */
.wdm-coupon-card {
  background: #fff;
  border: 2px solid #2196f3;
  border-radius: 12px;
  padding: 12px;
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 12px;
  align-items: center;
  transition: all 0.3s ease;
  position: relative;
}

.wdm-coupon-card:hover {
  border-color: #1976d2;
  box-shadow: 0 4px 12px rgba(33, 150, 243, 0.2);
  transform: translateY(-2px);
}

.wdm-coupon-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  overflow: hidden;
  background: #f5f5f5;
}

.wdm-coupon-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wdm-coupon-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wdm-coupon-code {
  font-size: 16px;
  font-weight: 700;
  color: #2196f3;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.wdm-coupon-description {
  font-size: 12px;
  color: #666;
  line-height: 1.3;
}

.wdm-coupon-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}

.wdm-coupon-expiry {
  font-size: 11px;
  color: #2196f3;
  font-weight: 500;
  white-space: nowrap;
}

.wdm-copy-coupon {
  background: #2196f3;
  border: none;
  color: #fff;
  padding: 6px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.3s;
  text-transform: none;
  white-space: nowrap;
}

.wdm-copy-coupon:hover {
  background: #1976d2;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.wdm-copy-coupon:active {
  transform: translateY(0);
}

.wdm-copy-coupon.copied {
  background: #4caf50;
}

/* Responsive cho Coupon Card */
@media (max-width: 480px) {
  .wdm-coupon-card {
    grid-template-columns: 60px 1fr;
  }

  .wdm-coupon-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .wdm-copy-coupon {
    width: 100%;
    padding: 8px 16px;
  }
}

/* Deals Grid */
.wdm-deals-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

/* No results */
.wdm-no-coupons,
.wdm-no-deals {
  text-align: center;
  padding: 40px 20px;
  color: #666;
  font-size: 16px;
}

/* Responsive */
@media (max-width: 768px) {
  .wdm-coupons-grid {
    grid-template-columns: 1fr;
  }

  .wdm-deals-wrapper {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

/* Coupon Suggestions on Cart Page */
.wdm-coupon-suggestions,
.wdm-coupon-available {
  margin-bottom: 20px;
  padding: 15px 20px;
  border-radius: 6px;
  animation: wdm-fadeIn 0.4s ease-in-out;
}

.wdm-coupon-suggestions {
  background: #fff3cd;
  border-left: 4px solid #ffc107;
  color: #856404;
}

.wdm-coupon-available {
  background: #d4edda;
  border-left: 4px solid #28a745;
  color: #155724;
}

.wdm-coupon-suggestions ul,
.wdm-coupon-available ul {
  list-style: none;
  margin: 10px 0 0 0;
  padding: 0;
}

.wdm-coupon-suggestions li,
.wdm-coupon-available li {
  padding: 8px 0;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.1);
}

.wdm-coupon-suggestions li:last-child,
.wdm-coupon-available li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.wdm-coupon-suggestions strong,
.wdm-coupon-available strong {
  font-weight: 600;
}

@keyframes wdm-fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Tooltip for Coupon Conditions */
[data-tooltip] {
  position: relative;
  cursor: help;
}

[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  max-width: 280px;
  width: max-content;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-tooltip]::after {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(0px);
  border: 6px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.9);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  pointer-events: none;
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
}

[data-tooltip]:hover::before {
  transform: translateX(-50%) translateY(-12px);
}

/* Mobile: Hide tooltip or show on tap */
@media (max-width: 768px) {

  [data-tooltip]::before,
  [data-tooltip]::after {
    display: none;
  }
}
