/* ==========================================================================
   /tools/countdown-timer (Arabic). The page uses the Lucky Wheel page's sections and
   classes (lucky-wheel.css loads first); this file only adds what a countdown needs:
   the tool beside its live example, the countdown cards on the stages, the template
   cards, and the mock panels of the how-to and ideas sections.
   ========================================================================== */

/* Hero: the form beside a live example, like the wheel tool */
.ct-tool { display: flex; flex-direction: column; gap: 20px; margin-top: 20px; }
.ct-tool .calc-container,
.ct-tool .ct-preview-container { box-sizing: border-box; width: 100%; max-width: none; margin: 0; }
.ct-tool .ct-preview-container { order: -1; }
.ct-tool .ct-preview-title { margin-top: 0; }

@media (min-width: 768px) {
  .ct-tool { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 32px; max-width: 1040px; margin-inline: auto; }
  .ct-tool .ct-preview-container { position: sticky; top: 110px; }
}

/* Embed code: paste steps, an editor bar, a short code box with a fade, a full-width copy button */
.ct-code-output { max-width: 860px; margin-inline: auto; padding: 28px 22px; background: radial-gradient(80% 60% at 50% 0%, rgba(139, 92, 246, 0.16) 0%, transparent 70%), var(--ft-card-bg, #16161f); }
.ct-paste-steps { display: grid; gap: 10px; margin: 0 0 18px; padding: 0; list-style: none; text-align: right; }
.ct-paste-steps li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 12px; background: rgba(255, 255, 255, 0.03); color: #E5E7EB; font-size: 14px; font-weight: 700; }
.ct-paste-steps b { display: grid; flex: none; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, #8B5CF6, #EC4899); color: #fff; font-size: 13px; }
.ct-code-bar { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border: 1px solid rgba(255, 255, 255, 0.08); border-bottom: 0; border-radius: 12px 12px 0 0; background: #0B0F1A; color: #9CA3AF; font: 600 12px/1 Inter, system-ui, sans-serif; direction: ltr; }
.ct-code-dots { display: flex; gap: 5px; }
.ct-code-dots i { width: 9px; height: 9px; border-radius: 50%; background: #FF5F57; }
.ct-code-dots i:nth-child(2) { background: #FEBC2E; }
.ct-code-dots i:nth-child(3) { background: #28C840; }
.ct-code-bar + .ct-code-block { max-height: 150px; margin-bottom: 16px; overflow: hidden; border-radius: 0 0 12px 12px; background: #0B0F1A; color: #A5B4FC; -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent 100%); mask-image: linear-gradient(180deg, #000 55%, transparent 100%); }
.ct-code-bar ~ .calc-btn { width: 100%; min-height: 52px; font-size: 16px; }
.numeral-toggle-btn { min-height: 44px; padding: 8px 18px; border: 1px solid rgba(139, 92, 246, 0.4); border-radius: 999px; background: rgba(139, 92, 246, 0.1); color: #C4B5FD; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }

@media (min-width: 768px) {
  .ct-paste-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ct-code-bar ~ .calc-btn { width: auto; min-width: 280px; }
}

.lwp-more .tools-cta-link { display: inline-flex; align-items: center; min-height: 44px; }

/* Countdown cards on a stage: stacked in one cell, the active one lifts in */
.cdp-stage { display: grid; place-items: center; min-height: 0; margin: 0; padding: 8px 0 0; overflow: visible; border: 0; background: none; }

.cdp-occ {
  box-sizing: border-box;
  position: relative;
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 420px;
  padding: 30px 16px 24px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, transparent);
  border-radius: 24px;
  background:
    radial-gradient(120% 80% at 100% 0%, color-mix(in srgb, var(--accent) 34%, transparent) 0%, transparent 60%),
    radial-gradient(90% 70% at 0% 100%, color-mix(in srgb, var(--accent) 20%, transparent) 0%, transparent 62%),
    var(--bg);
  color: var(--ink);
  text-align: center;
  box-shadow: 0 34px 70px -30px color-mix(in srgb, var(--accent) 70%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(0.98);
  transition: opacity 0.4s ease, transform 0.4s ease, visibility 0s 0.4s;
}

/* A soft dotted pattern and a light sweep across the card */
.cdp-occ::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(color-mix(in srgb, var(--accent) 30%, transparent) 1px, transparent 1.5px); background-size: 16px 16px; mask-image: linear-gradient(180deg, #000 0%, transparent 55%); pointer-events: none; }
.cdp-occ::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.1) 50%, transparent 60%); transform: translateX(-120%); animation: cdx-sheen 5s ease-in-out infinite; pointer-events: none; }
.cdp-occ > * { position: relative; z-index: 1; }

.cdp-occ.is-active { opacity: 1; visibility: visible; transform: none; transition: opacity 0.4s ease, transform 0.4s ease, visibility 0s; }
.cdp-occ-kicker { padding: 5px 14px; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); font-size: 13px; font-weight: 800; }
.cdp-occ-name { font-size: 27px; font-weight: 900; line-height: 1.3; text-shadow: 0 2px 18px color-mix(in srgb, var(--accent) 45%, transparent); }
.cdp-occ-rule { display: block; width: 56px; height: 3px; border-radius: 3px; background: linear-gradient(90deg, transparent, var(--accent), transparent); }
.cdp-occ-clock { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; width: 100%; margin-top: 6px; }

.cdp-occ-unit {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 2px 10px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 14px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--box) 70%, #fff 12%) 0%, var(--box) 100%);
  box-shadow: 0 10px 20px -12px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* Flip-clock split line */
.cdp-occ-unit::after { content: ""; position: absolute; top: 42%; right: 0; left: 0; height: 1px; background: rgba(0, 0, 0, 0.35); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06); }
.cdp-occ-unit:last-child { border-color: var(--accent); background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 38%, var(--box)) 0%, var(--box) 100%); }
.cdp-occ-unit b { font-size: 30px; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; text-shadow: 0 0 16px color-mix(in srgb, var(--accent) 55%, transparent); }
.cdp-occ-unit b.is-tick { animation: cdx-tick 0.45s ease; }
.cdp-occ-unit i { color: var(--accent); font-size: 12px; font-style: normal; font-weight: 700; }
.cdp-occ-foot { font-size: 14px; font-weight: 700; opacity: 0.9; }

/* "وين متجرك؟" stage: a real template per platform, linking to its page */
.cdp-tcard { width: min(520px, 100%); color: var(--ink); text-decoration: none; }
.cdp-tcard:hover { color: var(--ink); text-decoration: none; }
.cdp-tcard-img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; box-shadow: 0 14px 30px -18px rgba(0, 0, 0, 0.6); }
.cdp-tcard-go { display: inline-flex; align-items: center; min-height: 44px; margin-top: 8px; color: var(--accent); font-size: 14px; font-weight: 800; }

/* Section "كل عدّاد": step 1 is a live store window with the «فوق زر الشراء» countdown */
.cdx-live { display: block; margin-top: 14px; color: inherit; text-decoration: none; transition: transform 0.3s ease; }
.cdx-live:hover { color: inherit; text-decoration: none; transform: translateY(-3px); }

.cdx-shot-name { display: inline-flex; align-items: center; min-height: 44px; margin-top: 6px; color: #C4B5FD; font-size: 14px; font-weight: 800; text-decoration: none; }
.cdx-shot-name:hover { color: #fff; text-decoration: none; }

@keyframes cdx-sheen { 0%, 60% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
@keyframes cdx-tick { 0% { transform: translateY(-40%); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* A store page in a browser window (partials/countdown-store-window): the how-to and step 1 examples */
.cdw-stage { min-height: 0; padding: 22px 14px; }
.cdw {
  --cdw-ink: #111827;
  --cdw-brand: #B45309;
  --cdw-soft: #FFF7ED;
  --cdw-media: radial-gradient(80% 80% at 70% 30%, #FFE7C2 0%, #FBC98E 55%, #F59E6B 100%);
  --cdw-tb: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
  --cdw-ta: #F59E0B;
  position: relative;
  box-sizing: border-box;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  container-type: inline-size;
  overflow: hidden;
  border-radius: 16px;
  background: #fff;
  color: var(--cdw-ink);
  text-align: right;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 30px 70px -30px rgba(0, 0, 0, 0.85), 0 20px 60px -30px rgba(139, 92, 246, 0.6);
}

.cdw--pharmacy {
  --cdw-brand: #047857;
  --cdw-soft: #ECFDF5;
  --cdw-media: radial-gradient(80% 80% at 70% 30%, #ECFDF5 0%, #A7F3D0 60%, #6EE7B7 100%);
  --cdw-tb: linear-gradient(135deg, #065F46 0%, #047857 55%, #0D9488 100%);
  --cdw-ta: #FDE68A;
  max-width: none;
}

.cdw-chrome { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #F1F2F6; border-bottom: 1px solid #E5E7EB; direction: ltr; }
.cdw-dots { display: flex; gap: 5px; }
.cdw-dots i { width: 9px; height: 9px; border-radius: 50%; background: #FF5F57; }
.cdw-dots i:nth-child(2) { background: #FEBC2E; }
.cdw-dots i:nth-child(3) { background: #28C840; }
.cdw-url { display: inline-flex; flex: 1; align-items: center; gap: 6px; min-width: 0; padding: 4px 10px; overflow: hidden; border-radius: 999px; background: #fff; color: #6B7280; font: 600 11px/1.4 Inter, system-ui, sans-serif; white-space: nowrap; text-overflow: ellipsis; }

.cdw-store { padding: 0 14px 16px; }
.cdw-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid #F1F2F6; }
.cdw-logo { display: inline-flex; align-items: center; gap: 6px; color: var(--cdw-brand); font-size: 15px; font-weight: 900; white-space: nowrap; }
.cdw-nav { display: flex; gap: 12px; color: #6B7280; font-size: 11px; font-weight: 700; white-space: nowrap; }
.cdw-cart { position: relative; display: inline-flex; color: var(--cdw-ink); font-size: 18px; }
.cdw-cart em { position: absolute; top: -5px; left: -7px; display: grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: var(--cdw-brand); color: #fff; font-size: 9px; font-style: normal; font-weight: 800; }

.cdw-product { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 14px; padding-top: 14px; }
.cdw-media { position: relative; display: grid; place-items: center; min-height: 240px; overflow: hidden; border-radius: 14px; background: var(--cdw-media); }
.cdw-media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.22) 50%, transparent 60%); transform: translateX(-120%); animation: cdx-sheen 4.2s ease-in-out infinite; }
.cdw-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; animation: cdw-zoom 9s ease-in-out infinite alternate; }
.cdw-tag { position: absolute; top: 10px; right: 10px; z-index: 1; padding: 3px 9px; border-radius: 999px; background: #E11D48; color: #fff; font-size: 12px; font-weight: 900; direction: ltr; }

.cdw-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cdw-name { font-size: 17px; font-weight: 900; line-height: 1.35; }
.cdw-sub { color: #6B7280; font-size: 12px; }
.cdw-price { color: #E11D48; font-size: 18px; font-weight: 900; }
.cdw-price s { margin-right: 6px; color: #9CA3AF; font-size: 12px; font-weight: 600; }

.cdw-timer { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 12px; background: var(--cdw-tb); color: #fff; box-shadow: 0 12px 24px -14px rgba(0, 0, 0, 0.6); transition: background 0.5s ease, box-shadow 0.5s ease; }
.cdw-timer-head { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; }
.cdw-live { width: 8px; height: 8px; border-radius: 50%; background: var(--cdw-ta); animation: cdw-ping 1.4s ease-out infinite; }
.cdw-units { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.cdw-unit { position: relative; display: flex; flex-direction: column; align-items: center; padding: 6px 0 4px; overflow: hidden; border-radius: 8px; background: rgba(255, 255, 255, 0.1); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15); }
.cdw-unit::after { content: ""; position: absolute; top: 44%; right: 0; left: 0; height: 1px; background: rgba(0, 0, 0, 0.3); }
.cdw-unit:first-child { background: color-mix(in srgb, var(--cdw-ta) 30%, transparent); }
.cdw-unit b { color: #fff; font-size: 20px; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cdw-unit b.is-tick { animation: cdx-tick 0.45s ease; }
.cdw-unit i { color: var(--cdw-ta); font-size: 10px; font-style: normal; font-weight: 700; }

.cdw-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.cdw-swatch { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.7), 0 0 0 1px #D1D5DB; }
.cdw-swatch.is-on { box-shadow: inset 0 0 0 2px #fff, 0 0 0 2px var(--cdw-brand); }
.cdw-chip { padding: 3px 10px; border: 1px solid #D1D5DB; border-radius: 999px; color: #374151; font-size: 11px; font-style: normal; font-weight: 700; }
.cdw-chip.is-on { border-color: var(--cdw-brand); background: var(--cdw-soft); color: var(--cdw-brand); }
.cdw-buy { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; border-radius: 10px; background: var(--cdw-ink); color: #fff; font-size: 14px; font-weight: 800; }

/* How-to overlays: one floating card per step, the timer reacts to the step */
.cdw-pop {
  position: absolute;
  right: 22px;
  bottom: 26px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 44px);
  padding: 10px 12px;
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 14px;
  background: rgba(17, 24, 39, 0.94);
  color: #fff;
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.7);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.96);
  transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.34, 1.45, 0.5, 1), visibility 0s 0.45s;
}

.cdw-pop.is-active { opacity: 1; visibility: visible; transform: none; transition: opacity 0.35s ease 0.1s, transform 0.45s cubic-bezier(0.34, 1.45, 0.5, 1) 0.1s, visibility 0s; }
.cdw-pop small { display: block; color: #C4B5FD; font-size: 11px; font-weight: 700; }
.cdw-pop b { font-size: 13px; font-weight: 800; }
.cdw-pop-icon { display: grid; flex: none; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #8B5CF6, #EC4899); }
.cdw-pop-swatches { display: flex; gap: 6px; }
.cdw-pop-swatches i { width: 22px; height: 22px; border-radius: 7px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25); }
.cdw-pop-swatches i.is-on { box-shadow: 0 0 0 2px #fff; }
.cdw-pop-toggle { display: flex; padding: 3px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); font-size: 11px; }
.cdw-pop-toggle b, .cdw-pop-toggle span { padding: 3px 10px; border-radius: 999px; font-size: 11px; }
.cdw-pop-toggle b { background: #8B5CF6; }
.cdw-pop--share { flex-direction: column; align-items: stretch; gap: 6px; }
.cdw-pop code { padding: 6px 8px; border-radius: 8px; background: #0B1020; color: #A5F3FC; font-size: 11px; direction: ltr; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cdw-pop-ok { color: #34D399; font-size: 12px; font-weight: 800; }

.lwh:has([data-lwd-item="date"].is-active) .cdw-timer { box-shadow: 0 0 0 2px #8B5CF6, 0 0 0 6px rgba(139, 92, 246, 0.25); }
.lwh:has([data-lwd-item="design"].is-active) .cdw-timer { --cdw-ta: #FDE68A; background: linear-gradient(135deg, #F59E0B 0%, #B45309 100%); }
.lwh:has([data-lwd-item="share"].is-active) .cdw-timer { box-shadow: 0 0 0 2px #34D399, 0 14px 30px -12px rgba(52, 211, 153, 0.6); }

@container (max-width: 400px) {
  .cdw-nav { display: none; }
  .cdw-store { padding: 0 10px 12px; }
  .cdw-product { grid-template-columns: minmax(0, 1fr); }
  .cdw-media { min-height: 220px; }
  .cdw-pop { right: 18px; bottom: auto; top: 112px; }
  .cdw-unit b { font-size: 18px; }
}

@keyframes cdw-zoom { from { transform: scale(1); } to { transform: scale(1.06); } }
@keyframes cdw-ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--cdw-ta) 70%, transparent); } 100% { box-shadow: 0 0 0 8px transparent; } }

/* Ideas: the use-case cards are the pickers, a themed countdown is the stage */
.cdi-card { width: 100%; font: inherit; color: #fff; text-align: right; cursor: pointer; }
.cdi-card h3 { color: #fff; }
.cdi-card p { color: var(--ft-text-secondary, #C7CBD4); }
.cdi-card.is-active { box-shadow: inset -4px 0 0 var(--c), 0 0 0 2px var(--c), 0 14px 40px -16px var(--c); }

@media (max-width: 480px) {
  .cdp-occ-unit b { font-size: 24px; }
  .cdp-occ-name { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .cdp-occ,
  .cdp-occ.is-active { transition: none; transform: none; }
  .cdp-occ::after, .cdp-occ-unit b.is-tick { animation: none; }
  .cdw *, .cdw *::before, .cdw *::after { animation: none !important; }
}
