/* ============================================================
   MarketPlace DV — custom styles layered on top of Tailwind
   ============================================================ */

:root {
  --brand-1: #6366f1;
  --brand-2: #8b5cf6;
  --brand-3: #ec4899;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.font-display {
  font-family: 'Space Grotesk', 'Inter', ui-sans-serif, sans-serif;
}

::selection {
  background: rgba(99, 102, 241, 0.25);
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #c7c9d9;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
.dark ::-webkit-scrollbar-thumb {
  background: #3f4155;
  border: 2px solid transparent;
  background-clip: content-box;
  border-radius: 999px;
}

/* ---------- Brand gradient helpers ---------- */
.text-gradient {
  background: linear-gradient(120deg, var(--brand-1), var(--brand-2) 50%, var(--brand-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.bg-gradient-brand {
  background: linear-gradient(120deg, var(--brand-1), var(--brand-2) 50%, var(--brand-3));
}

.bg-gradient-brand-soft {
  background: linear-gradient(120deg, rgba(99,102,241,.12), rgba(139,92,246,.12) 50%, rgba(236,72,153,.12));
}

.hero-mesh {
  background:
    radial-gradient(at 15% 20%, rgba(99,102,241,.18) 0, transparent 45%),
    radial-gradient(at 85% 15%, rgba(236,72,153,.14) 0, transparent 45%),
    radial-gradient(at 50% 90%, rgba(139,92,246,.16) 0, transparent 50%);
}
.dark .hero-mesh {
  background:
    radial-gradient(at 15% 20%, rgba(99,102,241,.25) 0, transparent 45%),
    radial-gradient(at 85% 15%, rgba(236,72,153,.18) 0, transparent 45%),
    radial-gradient(at 50% 90%, rgba(139,92,246,.22) 0, transparent 50%);
}

/* ---------- Glassmorphism ---------- */
.glass {
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.5);
}
.dark .glass {
  background: rgba(17, 19, 32, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ---------- Card hover ---------- */
.card-lift {
  transition: transform .35s cubic-bezier(.22,1,.36,1), box-shadow .35s cubic-bezier(.22,1,.36,1);
}
.card-lift:hover {
  transform: translateY(-6px);
  box-shadow: 0 24px 48px -16px rgba(30, 27, 75, 0.18);
}
.dark .card-lift:hover {
  box-shadow: 0 24px 48px -16px rgba(0, 0, 0, 0.55);
}

/* ---------- Animations ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .5; transform: scale(.8); }
}
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

.animate-fade-up   { animation: fadeUp .7s cubic-bezier(.22,1,.36,1) both; }
.animate-fade-in   { animation: fadeIn .5s ease both; }
.animate-float     { animation: float 6s ease-in-out infinite; }
.animate-marquee   { animation: marquee 30s linear infinite; }

.stagger-1 { animation-delay: .08s; }
.stagger-2 { animation-delay: .16s; }
.stagger-3 { animation-delay: .24s; }
.stagger-4 { animation-delay: .32s; }
.stagger-5 { animation-delay: .4s; }

/* ---------- Reveal on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .7s cubic-bezier(.22,1,.36,1), transform .7s cubic-bezier(.22,1,.36,1);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Skeleton loading ---------- */
.skeleton {
  position: relative;
  overflow: hidden;
  background-color: #e8eaf3;
  border-radius: .5rem;
}
.dark .skeleton {
  background-color: #23263a;
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent);
  background-size: 400px 100%;
  background-repeat: no-repeat;
  animation: shimmer 1.4s infinite;
}
.dark .skeleton::after {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent);
  background-size: 400px 100%;
  background-repeat: no-repeat;
}

/* ---------- Mega menu ---------- */
.mega-menu {
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s;
  pointer-events: none;
}
.mega-trigger:hover .mega-menu,
.mega-trigger:focus-within .mega-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

/* ---------- Dropdown ---------- */
.dropdown-menu {
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px) scale(.98);
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
}
.dropdown.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* ---------- Tooltip ---------- */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: .3rem .6rem;
  font-size: .72rem;
  font-weight: 500;
  white-space: nowrap;
  border-radius: .45rem;
  background: #1e2030;
  color: #f4f4f6;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 60;
}
.dark [data-tooltip]::after {
  background: #f4f4f6;
  color: #1e2030;
}
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Accordion ---------- */
.accordion-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .3s cubic-bezier(.22,1,.36,1);
}
.accordion-body > div {
  overflow: hidden;
}
.accordion.open .accordion-body {
  grid-template-rows: 1fr;
}
.accordion-chevron {
  transition: transform .3s ease;
}
.accordion.open .accordion-chevron {
  transform: rotate(180deg);
}

/* ---------- Modal ---------- */
.modal-backdrop {
  opacity: 0;
  transition: opacity .25s ease;
}
.modal-backdrop.show {
  opacity: 1;
}
.modal-panel {
  opacity: 0;
  transform: translateY(16px) scale(.97);
  transition: opacity .25s ease, transform .25s cubic-bezier(.22,1,.36,1);
}
.modal-backdrop.show .modal-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ---------- Toast ---------- */
.toast {
  transform: translateY(12px);
  opacity: 0;
  transition: transform .3s cubic-bezier(.22,1,.36,1), opacity .3s ease;
}
.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ---------- Favorite button ---------- */
.fav-btn.active svg {
  fill: #ec4899;
  stroke: #ec4899;
}
.fav-btn.active {
  animation: fav-pop .3s ease;
}
@keyframes fav-pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* ---------- Live preview overlay on cards ---------- */
.template-card .card-overlay {
  opacity: 0;
  transition: opacity .3s ease;
}
.template-card:hover .card-overlay {
  opacity: 1;
}
.template-card .preview-img {
  transition: transform .5s cubic-bezier(.22,1,.36,1);
}
.template-card:hover .preview-img {
  transform: scale(1.05);
}

/* ---------- Focus visibility (a11y) ---------- */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--brand-1);
  outline-offset: 2px;
  border-radius: .375rem;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 100;
  transition: top .2s ease;
}
.skip-link:focus {
  top: 1rem;
}

/* ---------- Grid pattern backdrop ---------- */
.grid-pattern {
  background-image:
    linear-gradient(to right, rgba(99,102,241,.07) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(99,102,241,.07) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 40%, transparent 100%);
}

/* ---------- Switch toggle ---------- */
.switch {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: #cbd2e0;
  transition: background .2s ease;
  cursor: pointer;
  flex-shrink: 0;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #fff;
  transition: transform .2s cubic-bezier(.22,1,.36,1);
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.dark .switch {
  background: #3f4155;
}
.switch.on {
  background: var(--brand-1);
}
.switch.on::after {
  transform: translateX(18px);
}

/* ---------- Range slider ---------- */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: #e2e5f0;
}
.dark input[type="range"] {
  background: #3f4155;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--brand-1);
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--brand-1);
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
  cursor: pointer;
}

/* ---------- Rating stars ---------- */
.stars svg {
  width: 14px;
  height: 14px;
}
