/* ============================================================
   SmartShopper Enterprise — Phase 7 Stable
   Visual enhancements for the EXISTING Flash Sales section.
   Does NOT create new elements — only styles what's already there.
   ============================================================ */

/* ────────────────────────────────────────────────────────────
   1) Flash Sales section — premium polish
   ──────────────────────────────────────────────────────────── */

/* The section itself — find it by locating the section that contains
   an element with class "section-icon" containing ⚡ text. */
.section:has(.section-icon) {
  position: relative;
}

/* Make the ⚡ section-icon bigger + pulse subtly */
.section-icon[style*="offer-red"],
.section-icon[style*="--offer-red"] {
  font-size: 1.5rem !important;
  width: 3rem !important;
  height: 3rem !important;
  display: grid !important;
  place-items: center !important;
  border-radius: 14px !important;
  box-shadow: 0 6px 18px rgba(225, 45, 57, 0.30) !important;
  animation: ss7-flash-pulse 2s ease-in-out infinite;
}

@keyframes ss7-flash-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.08); box-shadow: 0 8px 24px rgba(225, 45, 57, 0.45) !important; }
}

/* The Flash Sales h2 — bigger, bolder */
.section:has(.section-icon[style*="offer-red"]) h2,
.section:has(.section-icon[style*="--offer-red"]) h2 {
  font-size: 1.65rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin: 0;
}

/* Subtitle "عروض لفترة محدودة" — softer, muted */
.section:has(.section-icon[style*="offer-red"]) p,
.section:has(.section-icon[style*="--offer-red"]) p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 2px 0 0;
  font-weight: 500;
}

/* ────────────────────────────────────────────────────────────
   2) Countdown Timer — Dark Premium look
   Target: #flash-countdown (existing element)
   ──────────────────────────────────────────────────────────── */

#flash-countdown {
  gap: 0.4rem !important;
  padding: 0.35rem 0.6rem;
  background: linear-gradient(135deg, rgba(23, 33, 43, 0.04), rgba(225, 45, 57, 0.04));
  border-radius: 14px;
  border: 1px solid var(--border);
}

/* The individual time-boxes inside #flash-countdown */
#flash-countdown > div {
  width: 2.75rem !important;
  height: 2.75rem !important;
  background: linear-gradient(180deg, #17212B 0%, #0B1419 100%) !important;
  color: #fff !important;
  border-radius: 12px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow:
    0 4px 12px rgba(23, 33, 43, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
  position: relative;
  transition: all 0.3s ease;
}

#flash-countdown > div > span:first-child {
  font-size: 0.95rem !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

#flash-countdown > div > span:last-child {
  font-size: 0.55rem !important;
  color: #9CA3AF !important;
  margin-top: 2px;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* Colon separators */
#flash-countdown > span {
  font-weight: 900 !important;
  color: var(--offer-red) !important;
  font-size: 1rem !important;
  align-self: center;
  animation: ss7-colon-blink 1s steps(2) infinite;
}

@keyframes ss7-colon-blink {
  50% { opacity: 0.4; }
}

/* Urgent state — when < 1 hour remaining (added by JS) */
#flash-countdown.ss7-urgent {
  background: linear-gradient(135deg, rgba(225, 45, 57, 0.10), rgba(225, 45, 57, 0.05));
  border-color: rgba(225, 45, 57, 0.40);
  animation: ss7-urgent-glow 1.4s ease-in-out infinite;
}

#flash-countdown.ss7-urgent > div {
  background: linear-gradient(180deg, #E12D39 0%, #B8202C 100%) !important;
  box-shadow:
    0 4px 16px rgba(225, 45, 57, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
}

#flash-countdown.ss7-urgent > div > span:last-child {
  color: rgba(255, 255, 255, 0.85) !important;
}

@keyframes ss7-urgent-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(225, 45, 57, 0.30); }
  50%      { box-shadow: 0 0 0 8px rgba(225, 45, 57, 0); }
}

/* ────────────────────────────────────────────────────────────
   3) "View all" link — Premium green button
   Target: .section-link inside the Flash Sales section
   ──────────────────────────────────────────────────────────── */

.section:has(.section-icon[style*="offer-red"]) .section-link,
.section:has(.section-icon[style*="--offer-red"]) .section-link {
  display: inline-flex !important;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 1.1rem;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: #fff !important;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: 0 4px 12px rgba(11, 122, 67, 0.25);
  transition: all 0.2s ease;
  border: none;
}

.section:has(.section-icon[style*="offer-red"]) .section-link:hover,
.section:has(.section-icon[style*="--offer-red"]) .section-link:hover {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(11, 122, 67, 0.35);
}

/* ────────────────────────────────────────────────────────────
   4) Product cards inside Flash Sales — light red accent
   NOTE: We scope this ONLY to the Flash Sales section, so the
   regular product grid on other pages is untouched.
   ──────────────────────────────────────────────────────────── */

.section:has(.section-icon[style*="offer-red"]) .product-grid .product-card,
.section:has(.section-icon[style*="--offer-red"]) .product-grid .product-card {
  border: 1.5px solid rgba(225, 45, 57, 0.18);
  transition: all 0.25s ease;
  position: relative;
}

.section:has(.section-icon[style*="offer-red"]) .product-grid .product-card:hover,
.section:has(.section-icon[style*="--offer-red"]) .product-grid .product-card:hover {
  border-color: rgba(225, 45, 57, 0.45);
  box-shadow: 0 12px 28px rgba(225, 45, 57, 0.18);
  transform: translateY(-3px);
}

/* Discount badge — clearer inside Flash Sales */
.section:has(.section-icon[style*="offer-red"]) .product-grid .product-card .discount-badge,
.section:has(.section-icon[style*="--offer-red"]) .product-grid .product-card .discount-badge,
.section:has(.section-icon[style*="offer-red"]) .product-grid .product-card [class*="discount"],
.section:has(.section-icon[style*="--offer-red"]) .product-grid .product-card [class*="discount"] {
  background: var(--offer-red) !important;
  color: #fff !important;
  font-weight: 800 !important;
  font-size: 0.8rem !important;
  padding: 0.25rem 0.55rem !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 10px rgba(225, 45, 57, 0.35) !important;
}

/* ────────────────────────────────────────────────────────────
   5) "Shop by Category" section — keep "All Categories" link
   visible exactly once (no JS duplication).
   Just a subtle polish on the existing link.
   ──────────────────────────────────────────────────────────── */

.section .section-head .section-link {
  transition: all 0.2s ease;
}

/* The first .section-link on the page (Categories section) */
.section:first-of-type .section-link {
  color: var(--primary);
  font-weight: 700;
}

.section:first-of-type .section-link:hover {
  color: var(--primary-dark);
  transform: translateX(-2px);
}

/* ────────────────────────────────────────────────────────────
   6) Admin button — injected by JS into the topbar
   ──────────────────────────────────────────────────────────── */

.ss7-admin-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.7rem;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: #fff !important;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(11, 122, 67, 0.20);
  white-space: nowrap;
}

.ss7-admin-link:hover {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(11, 122, 67, 0.30);
}

.ss7-admin-link svg {
  width: 13px;
  height: 13px;
}

/* Dark mode tweaks */
html.dark #flash-countdown > div {
  background: linear-gradient(180deg, #14201A 0%, #0D1512 100%) !important;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.40),
    inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

html.dark #flash-countdown > div > span:first-child {
  color: var(--primary-light) !important;
}

html.dark #flash-countdown > span {
  color: var(--gold) !important;
}

/* Responsive */
@media (max-width: 768px) {
  #flash-countdown > div {
    width: 2.25rem !important;
    height: 2.25rem !important;
  }
  #flash-countdown > div > span:first-child {
    font-size: 0.8rem !important;
  }
  .section:has(.section-icon[style*="offer-red"]) h2,
  .section:has(.section-icon[style*="--offer-red"]) h2 {
    font-size: 1.35rem;
  }
}
