/* ============================================================
   COURSE COUPON POPOVER (below every course card)
   Loaded once per page from professional-courses-cards/*.php
   Values: assets/json/coupons.json | JS: script.js (COURSE COUPON)
   ============================================================ */

/* Wrapper = grid item. Card fills it, popover sits in reserved space below */
.cpn-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
}

.cpn-wrap .course-card {
  flex: 1;
}

/* Reserve space only if a coupon exists in this card or in the same grid,
   so every card in a row keeps the same height (even with discount = 0) */
.cpn-wrap:has(.cpn-pop),
.courses-grid:has(.cpn-pop) .cpn-wrap {
  padding-bottom: 44px;
}

/* Small popover with arrow pointing to the card */
.cpn-pop {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  width: fit-content;
  margin: 0 auto;
  display: flex;
  align-items: center;
  font-size: .7rem;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-section);
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

.cpn-pop::before,
.cpn-pop::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top: 0;
}

.cpn-pop::before {
  top: -7px;
  border-bottom-color: var(--primary);
}

.cpn-pop::after {
  top: -6px;
  border-bottom-color: var(--bg-section);
}

.cpn-apply,
.cpn-remove {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

.cpn-apply {
  padding: 5px 12px;
}

.cpn-apply i {
  color: var(--primary);
}

.cpn-applied {
  padding: 5px 2px 5px 10px;
  color: var(--success);
}

.cpn-remove {
  padding: 2px 8px 2px 6px;
  font-size: 1rem;
  line-height: 1;
  color: var(--text-muted);
}

.cpn-remove:hover {
  color: var(--secondary);
}

/* Applied / not applied state (class toggled by script.js) */
.cpn-applied,
.cpn-remove,
.cpn-wrap.cpn-is-applied .cpn-apply {
  display: none;
}

.cpn-wrap.cpn-is-applied .cpn-applied,
.cpn-wrap.cpn-is-applied .cpn-remove {
  display: inline-block;
}
