/* =========================================================
   ANDI Dynamic Pricing & Deals — modern, robust layout
   Replace your old deal-styles.css with this file.
   No absolute positioning. Fully responsive with Flexbox.
   ========================================================= */

/* ---------------------------------------
   Theme variables (feel free to customize)
------------------------------------------*/
:root {
  --adpd-gap: .75rem;
  --adpd-muted: rgba(0,0,0,.65);
  --adpd-success: #008a00;
  --adpd-pill-bg: #03923f;
  --adpd-pill-fg: #fff;
}

/* ---------------------------------------------------------
   Reset legacy positioning from previous versions (important)
----------------------------------------------------------*/
.price-container,
.deal-time-left,
.wcpa_total {
  position: static;
  margin: 0 !important;
}

/* -------------------------
   Wrapper for price summary
--------------------------*/
.adpd-price-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--adpd-gap);
  margin-top: 20px;
}

/* Total block (final price) */
.adpd-price-wrap .wcpa_total {
  display: inline-flex;
  align-items: baseline;
  gap: .5rem;
  line-height: 1.1;
  white-space: nowrap;
}

.adpd-price-wrap .wcpa_total span:first-child {
  font-size: clamp(.85rem, 1.6vw, .95rem);
  font-weight: 500;
  color: var(--adpd-muted);
}

.adpd-price-wrap .wcpa_total .wcpa_price_outer {
  font-size: clamp(2rem, 3.2vw, 2.1rem);
  font-weight: 700;
}

/* -----------------------------------
   Old price + percent off (inline row)
------------------------------------*/
.adpd-price-wrap .price-container {
  display: inline-flex;
  align-items: stretch;
  gap: .5rem;
  position: relative;
  top: -25px;
}

.adpd-price-wrap .deal-price,
.adpd-price-wrap del.deal-price {
  font-size: clamp(.9rem, 1.6vw, 1rem);
  font-weight: 400;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  color: var(--adpd-muted);
  opacity: .8;
  white-space: nowrap;
  margin: 0;
}

/* % OFF pill */
.adpd-price-wrap .deal-percentage {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 .95rem;
  height: 1.3rem;
  min-width: 2.6rem;
  border-radius: 999px;
  font-size: clamp(.8rem, 1.4vw, .9rem);
  font-weight: 600;
  background: var(--adpd-pill-bg);
  color: var(--adpd-pill-fg);
  white-space: nowrap;
  user-select: none;
  transform: translateZ(0);
  will-change: transform;
  animation: adpd-pill-pop 7s ease-in-out infinite 1s;
}

.adpd-price-wrap .deal-percentage {
  min-width: 2.6rem;
  text-align: center;
}

.adpd-price-wrap .deal-percentage:empty {
  visibility: hidden;
}


/* soft pop animation for the pill */
@keyframes adpd-pill-pop {
  0%, 92%, 100% { transform: scale(1); }
  94% { transform: scale(1.06); }
  96% { transform: scale(0.98); }
  98% { transform: scale(1.04); }
}

/* ----------------
   Deal time / timer
-----------------*/
.adpd-price-wrap .deal-time-left {
  flex-basis: 100%;           /* force a new line under the row above */
  margin-top: -15px !important;
  font-size: clamp(.9rem, 1.6vw, .95rem);
  color: var(--adpd-success);
  white-space: nowrap;
}

#countdown_timer {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
  letter-spacing: .02em;
}

/* ------------------------
   Skeleton / loading state
-------------------------*/
[class*="skeleton"] {
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}
[class*="skeleton"]::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,.35) 50%,
    rgba(255,255,255,0) 100%);
  animation: adpd-skeleton 1.2s infinite;
}
@keyframes adpd-skeleton {
  100% { transform: translateX(100%); }
}

/* -----------------
   Responsive tweaks
------------------*/
@media (max-width: 1024px) {
  .adpd-price-wrap { gap: .6rem; }
}

@media (max-width: 768px) {
  .adpd-price-wrap { align-items: flex-start; }
  /* Explicit order on mobile (can be changed as you like) */
  .adpd-price-wrap .wcpa_total { order: 1; }
  .adpd-price-wrap .price-container { order: 2; }
  .adpd-price-wrap .deal-time-left { order: 3; }
}

@media (max-width: 549px) {
  .adpd-price-wrap .price-container {
    top: -12px;
  }
}

/* ---------------
   Accessibility
----------------*/
.adpd-visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; border: 0; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap;
}

.wcpa_options_total, .wcpa_product_total, .product-page-price {
    display: none !important;
}

.wcpa_total span:first-child {
    display: none !important;
}

.wcpa_total .wcpa_price_outer {
    color: #D52A1A !important;
    font-weight: bold;
    font-size: 1.2em;
}