/*
* halloween.css
* Temporary Halloween event theme.
* All rules are scoped under `html.halloween` (added by commonMaster.blade.php
* when App\Helpers\Halloween::active() is true). To restore the normal theme,
* set HALLOWEEN_ENABLED=false or wait for the event window to end — nothing
* here applies without the `halloween` class on <html>.
******************************************************************************/

html.halloween {
  --halloween-orange: #ff7518;
  --halloween-orange-light: #ffa94d;
  --halloween-purple: #6d28d9;
  --halloween-purple-dark: #3b0764;
  --halloween-night: #1a1030;
}

@font-face {
  font-family: 'Scary Halloween';
  src: url('/assets/vendor/fonts/halloween/Scary Halloween Font.ttf') format('truetype');
  font-display: swap;
}

/* --------------------------------------------------------------------------
* Spooky page ambience
* ------------------------------------------------------------------------ */

/* Gradient strip along the top of the front navbar */
html.halloween .layout-navbar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--halloween-purple) 0%, var(--halloween-orange) 50%, var(--halloween-purple) 100%);
  z-index: 5;
  pointer-events: none;
}

/* Buttons become pumpkin gradient */
html.halloween .btn-primary {
  background: linear-gradient(135deg, var(--halloween-orange) 0%, #e85d04 100%) !important;
  border-color: var(--halloween-orange) !important;
  box-shadow: 0 4px 14px rgba(255, 117, 24, 0.35);
}
html.halloween .btn-primary:hover,
html.halloween .btn-primary:focus {
  background: linear-gradient(135deg, #ff8c3a 0%, var(--halloween-orange) 100%) !important;
  box-shadow: 0 6px 18px rgba(255, 117, 24, 0.5);
  transform: translateY(-1px);
}

/* Badges */
html.halloween .badge.bg-primary {
  background-color: var(--halloween-purple) !important;
}

/* Footer accent */
html.halloween .landing-footer {
  border-top: 3px solid transparent;
  border-image: linear-gradient(90deg, var(--halloween-purple), var(--halloween-orange), var(--halloween-purple)) 1;
}

/* --------------------------------------------------------------------------
* Help-center / extensions header — night scene
* (replaces the ::before / ::after artwork with halloween illustrations)
* ------------------------------------------------------------------------ */

/* (the night-sky background was removed — the section keeps its normal theme
   background; only the pumpkins artwork below is applied) */

/* Glowing moon + bats, top-left of every page (appended to <body> by
   halloween.js). Absolute so it scrolls away with the document; sits just
   under the navbar (999) so nav links render on top of it. */
html.halloween .halloween-moon {
  position: absolute;
  top: -120px;
  width: 21rem;
  height: 21rem;
  background: url('/assets/img/pages/halloween-moon.svg') no-repeat center / contain;
  pointer-events: none;
  z-index: 990;
}
html.halloween:not([dir='rtl']) .halloween-moon {
  left: -105px;
}
html.halloween[dir='rtl'] .halloween-moon {
  right: -105px;
}

/* Jack-o'-lanterns, bottom-right */
html.halloween .help-center-header:after {
  width: 9rem;
  height: 18rem;
  bottom: -40px;
  background-image: url('/assets/img/pages/halloween-pumpkins.svg');
}
html.halloween:not([dir='rtl']) .help-center-header:after {
  right: -0.5rem;
  transform: none;
}
html.halloween[dir='rtl'] .help-center-header:after {
  left: -0.5rem;
  transform: scaleX(-1);
}

html.halloween .help-center-header .extension-search-container .form-control,
html.halloween .help-center-header .input-group-text {
  border-color: rgba(255, 117, 24, 0.4);
}
html.halloween .help-center-header .form-select {
  border-color: rgba(255, 117, 24, 0.4);
}

/* --------------------------------------------------------------------------
* Halloween Deal card (extensions listing — price matches special_price)
* ------------------------------------------------------------------------ */

/* Halloween Deal card: keeps the normal card design, marked by a discount
   tag hanging down from the top-left edge + a subtle spooky glow */
html.halloween .extension-container--halloween {
  position: relative;
  border: 1px solid rgba(255, 117, 24, 0.55) !important;
  animation: halloween-card-glow 3s ease-in-out infinite alternate;
}
html.halloween .extension-container--halloween:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(109, 40, 217, 0.35), 0 0 22px rgba(255, 117, 24, 0.45);
}
/* Plugin name in the spooky font */
html.halloween .extension-container--halloween h5 {
  font-family: 'Scary Halloween', 'IBM Plex Sans', sans-serif;
  font-size: 1.35rem;
  letter-spacing: 0.04em;
}

@keyframes halloween-card-glow {
  from {
    box-shadow: 0 0 6px rgba(255, 117, 24, 0.25), 0 0 18px rgba(109, 40, 217, 0.15);
  }
  to {
    box-shadow: 0 0 14px rgba(255, 117, 24, 0.5), 0 0 32px rgba(109, 40, 217, 0.3);
  }
}

/* Discount tag hanging from the card's top-left edge */
html.halloween .halloween-deal-tag {
  position: absolute;
  top: 6px;
  left: 16px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, var(--halloween-purple) 0%, var(--halloween-purple-dark) 100%);
  border: 1px solid var(--halloween-orange);
  border-radius: 3px 3px 10px 10px;
  box-shadow: 0 4px 10px rgba(59, 7, 100, 0.45);
  transform-origin: 50% -6px;
  animation: halloween-tag-swing 4s ease-in-out infinite;
}
/* string attaching the tag to the card's top edge */
html.halloween .halloween-deal-tag::before {
  content: '';
  position: absolute;
  top: -7px;
  left: 50%;
  width: 1px;
  height: 7px;
  background: var(--halloween-orange);
}

@keyframes halloween-tag-swing {
  0%, 100% {
    transform: rotate(-3.5deg);
  }
  50% {
    transform: rotate(3.5deg);
  }
}

/* --------------------------------------------------------------------------
* Decorations injected by halloween.js
* ------------------------------------------------------------------------ */

/* Fixed layer holding all decorations — never blocks clicks */
.halloween-decor-layer {
  position: fixed;
  inset: 0;
  z-index: 1080;
  pointer-events: none;
  overflow: hidden;
}

/* Spider hanging from the top-right, gently bobbing */
.halloween-spider {
  position: fixed;
  top: 0;
  right: 6%;
  z-index: 1080;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: halloween-spider-bob 5s ease-in-out infinite;
}
.halloween-spider::before {
  content: '';
  width: 1px;
  height: var(--halloween-web-length, 90px);
  background: rgba(120, 120, 120, 0.7);
}
.halloween-spider span {
  font-size: 1.9rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}
@keyframes halloween-spider-bob {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(14px);
  }
}

/* Countdown banner: a vertical pull-tab on the left edge (all viewports) that
   expands into a horizontal slide-out panel. It never overlaps the navbar. */
.halloween-banner {
  position: fixed;
  top: 8rem;
  left: 0;
  /* Below .layout-navbar (999) as a safety net only — no overlap by design */
  z-index: 998;
  cursor: pointer;
  text-decoration: none;
  transform-origin: left center;
  /* drop-shadows trace the clip-path shapes: dark shadow + orange edge glow */
  filter: drop-shadow(2px 4px 8px rgba(0, 0, 0, 0.4)) drop-shadow(0 0 2px rgba(255, 117, 24, 0.55));
}
.halloween-banner:hover {
  filter: drop-shadow(2px 4px 8px rgba(0, 0, 0, 0.4)) drop-shadow(0 0 2px rgba(255, 117, 24, 0.55)) brightness(1.15);
}
.halloween-banner:hover .halloween-banner__label {
  text-decoration: underline;
}

/* Expanded: pennant flag sliding out from the left edge */
.halloween-banner:not(.halloween-banner--collapsed) {
  animation: halloween-banner-slide-in 0.35s ease-out;
}
.halloween-banner__body {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 10px 26px 10px 46px;
  background: linear-gradient(180deg, var(--halloween-purple) 0%, var(--halloween-purple-dark) 100%);
  /* pennant tail pointing right — borders are clipped away, the orange glow
     on .halloween-banner's drop-shadow serves as the outline instead */
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 50%, calc(100% - 18px) 100%, 0 100%);
}
/* Ghost peeking out over the top edge of the flag */
.halloween-banner__emoji {
  position: absolute;
  top: -13px;
  left: 7px;
  width: 2.1rem;
  height: auto;
  transform: rotate(-7deg);
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4));
  z-index: 1;
}
.halloween-banner__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.halloween-banner__count {
  font-family: 'Scary Halloween', 'IBM Plex Sans', sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--halloween-orange-light);
  text-shadow: 0 0 10px rgba(255, 117, 24, 0.55);
  line-height: 1.1;
}
.halloween-banner__total {
  font-size: 0.68rem;
  font-weight: 600;
  color: rgba(255, 233, 200, 0.7);
}
.halloween-banner__label {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 233, 200, 0.85);
}

/* Collapsed: vertical pull-tab — mobile only */
.halloween-banner__tab {
  display: none;
}
@media (max-width: 767.98px) {
  .halloween-banner--collapsed .halloween-banner__body,
  .halloween-banner--collapsed .halloween-banner__emoji {
    display: none;
  }
  .halloween-banner--collapsed .halloween-banner__tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 8px 22px;
    background: linear-gradient(180deg, var(--halloween-purple) 0%, var(--halloween-purple-dark) 100%);
    /* ribbon notch cut into the bottom of the pull-tab */
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 90%, 0 100%);
  }
  .halloween-banner--collapsed .halloween-banner__tab-text {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 233, 200, 0.95);
    white-space: nowrap;
  }
  .halloween-banner--collapsed .halloween-banner__tab-emoji {
    font-size: 1.05rem;
    line-height: 1;
  }
}
@keyframes halloween-banner-slide-in {
  from {
    transform: translateX(-100%);
    opacity: 0.4;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Corner cobwebs */
.halloween-web {
  position: fixed;
  z-index: 1080;
  pointer-events: none;
  font-size: 4rem;
  line-height: 1;
  opacity: 0.85;
}
.halloween-web--tl {
  top: 0;
  left: 0;
}
.halloween-web--tr {
  top: -1rem;
  right: -1rem;
  transform: scaleX(-1);
}

/* Accessibility: no motion for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  html.halloween .extension-container--halloween,
  html.halloween .halloween-deal-tag,
  html.halloween .halloween-banner,
  .halloween-spider {
    animation: none !important;
  }
}
