/* ============================================================
   PIXEL PRONTO — templates.css
   Página Templates alinhada ao novo visual da index.html
   Não altera back-end: mantém consumo de api/templates.php
   ============================================================ */

.nav-active {
  color: #fff !important;
  font-weight: 800;
}

.templates-hero {
  width: 100%;
  padding: 96px 0 70px;
}

.templates-hero-grid {
  display: grid;
  grid-template-columns: 1.02fr .98fr;
  gap: 52px;
  align-items: center;
}

.templates-hero-copy h1 {
  max-width: 900px;
  font-size: clamp(2.6rem, 5vw, 4.7rem);
  line-height: .95;
}

.templates-hero-copy p {
  max-width: 700px;
  margin-top: 24px;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.75;
}

.templates-hero-panel {
  position: relative;
  min-height: 520px;
}

.templates-window-card {
  width: min(100%, 560px);
  min-height: 410px;
  padding: 28px;
  border: 1px solid var(--border);
  background: linear-gradient(145deg, rgba(255,255,255,.13), rgba(255,255,255,.05));
  border-radius: 0;
  box-shadow: var(--shadow);
  transform: rotate(-1deg);
  overflow: hidden;
}

.templates-window-card::before {
  content: "";
  position: absolute;
  width: 240px;
  height: 240px;
  right: -70px;
  top: -80px;
  border-radius: 999px;
  background: rgba(236, 72, 153, .25);
  filter: blur(40px);
}

.window-dots {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 8px;
  margin-bottom: 34px;
}

.window-dots span {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #fb7185;
}

.window-dots span:nth-child(2) {
  background: #fbbf24;
}

.window-dots span:nth-child(3) {
  background: #34d399;
}

.templates-window-card .product-pill,
.templates-window-card h2,
.templates-window-card p,
.template-bars {
  position: relative;
  z-index: 1;
}

.templates-window-card h2 {
  max-width: 420px;
  font-size: clamp(2rem, 4vw, 3.3rem);
  line-height: 1;
}

.templates-window-card p {
  max-width: 380px;
  margin-top: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.template-bars {
  display: grid;
  gap: 14px;
  margin-top: 36px;
}

.template-bars span {
  display: block;
  width: var(--width);
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--purple), var(--pink));
  box-shadow: 0 14px 36px rgba(236, 72, 153, .22);
}

.template-ticket-one {
  top: 64px;
  right: 0;
}

.template-ticket-two {
  left: 18px;
  bottom: 55px;
}

.templates-store-section {
  padding-top: 86px;
}

.templates-store-header {
  align-items: end;
  margin-bottom: 30px;
}

.templates-store-header h2 {
  max-width: 850px;
  font-size: clamp(2.35rem, 4vw, 4.1rem);
  line-height: 1;
}

.templates-store-header p {
  max-width: 680px;
}

.templates-filter {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.filter-btn {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.08);
  color: var(--muted);
  font-size: .88rem;
  font-weight: 800;
  cursor: pointer;
  transition: .3s var(--ease);
}

.filter-btn:hover {
  color: #fff;
  background: rgba(255,255,255,.13);
  transform: translateY(-2px);
}

.filter-btn.active {
  color: #fff;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  border-color: transparent;
  box-shadow: 0 18px 40px rgba(236, 72, 153, .18);
}

.templates-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.tpl-card {
  position: relative;
  display: flex;
  min-height: 100%;
  flex-direction: column;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.07);
  border-radius: 0;
  overflow: hidden;
  cursor: pointer;
  transition: .35s var(--ease);
}

.tpl-card::after {
  content: "";
  position: absolute;
  inset: auto 18px 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(236,72,153,.75), transparent);
  opacity: 0;
  transition: .35s var(--ease);
}

.tpl-card:hover {
  transform: translateY(-8px);
  background: rgba(255,255,255,.1);
  box-shadow: var(--shadow);
}

.tpl-card:hover::after {
  opacity: 1;
}

.tpl-card:focus-visible {
  outline: 3px solid var(--pink);
  outline-offset: 4px;
}

.tpl-card-image {
  position: relative;
  height: 230px;
  overflow: hidden;
  background: rgba(255,255,255,.06);
  border-bottom: 1px solid var(--border);
}

.tpl-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .55s var(--ease), filter .55s var(--ease);
}

.tpl-card:hover .tpl-card-image img {
  transform: scale(1.06);
  filter: saturate(1.08) contrast(1.04);
}

.tpl-card-badge {
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 1;
  display: inline-flex;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  background: rgba(18, 9, 31, .72);
  color: #f4eaff;
  font-size: .78rem;
  font-weight: 800;
  backdrop-filter: blur(12px);
}

.tpl-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 22px;
}

.tpl-card-title {
  font-size: 1.25rem;
  line-height: 1.2;
}

.tpl-card-desc {
  flex: 1;
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.65;
  font-size: .96rem;
}

.tpl-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 22px;
}

.tpl-card-price {
  color: #fff;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -.03em;
}

.tpl-btn-details {
  min-height: 44px;
  padding: 0 18px;
  font-size: .9rem;
  white-space: nowrap;
}

.tpl-card.hidden {
  display: none;
}

.templates-loading,
.templates-empty {
  grid-column: 1 / -1;
  padding: 34px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.07);
  color: var(--muted);
  text-align: center;
}

.templates-cta-section {
  padding-top: 20px;
}

.templates-cta-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 34px;
  align-items: center;
  padding: 42px;
  border: 1px solid var(--border);
  border-radius: 0;
  background:
    radial-gradient(circle at top right, rgba(236,72,153,.18), transparent 34%),
    rgba(255,255,255,.07);
  box-shadow: var(--shadow);
}

.templates-cta-text h2 {
  max-width: 760px;
  font-size: clamp(2rem, 3vw, 3.4rem);
  line-height: 1;
}

.templates-cta-text p {
  max-width: 680px;
  margin-top: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.templates-cta-actions {
  display: grid;
  gap: 12px;
  min-width: 220px;
}

.tpl-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(5, 2, 12, .72);
  backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  transition: .3s var(--ease);
  overflow-y: auto;
}

.tpl-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.tpl-modal {
  position: relative;
  width: min(1020px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 0;
  background: #12091f;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(22px) scale(.97);
  transition: .35s var(--ease);
}

.tpl-modal-overlay.active .tpl-modal {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.tpl-modal::-webkit-scrollbar {
  width: 8px;
}

.tpl-modal::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.18);
  border-radius: 999px;
}

.tpl-modal-close {
  position: sticky;
  top: 14px;
  float: right;
  z-index: 10;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin: 14px 14px 0 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.1);
  color: #fff;
  cursor: pointer;
  transition: .3s var(--ease);
}

.tpl-modal-close:hover {
  color: #fff;
  background: rgba(251, 113, 133, .25);
  transform: rotate(8deg) scale(1.04);
}

.tpl-modal-gallery {
  clear: both;
  padding: 0 28px;
}

.tpl-gallery-main {
  position: relative;
  height: 390px;
  border: 1px solid var(--border);
  border-radius: 0;
  overflow: hidden;
  background: rgba(255,255,255,.06);
}

.tpl-gallery-main-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity .25s var(--ease);
}

.tpl-gallery-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(18, 9, 31, .78);
  color: #fff;
  cursor: pointer;
  transform: translateY(-50%);
  transition: .3s var(--ease);
}

.tpl-gallery-nav:hover {
  background: rgba(255,255,255,.14);
  transform: translateY(-50%) scale(1.06);
}

.tpl-gallery-prev { left: 14px; }
.tpl-gallery-next { right: 14px; }

.tpl-gallery-counter {
  position: absolute;
  right: 14px;
  bottom: 14px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(18, 9, 31, .78);
  color: #fff;
  font-weight: 800;
  font-size: .82rem;
}

.tpl-gallery-thumbs {
  display: flex;
  gap: 10px;
  padding-bottom: 4px;
  margin-top: 12px;
  overflow-x: auto;
}

.tpl-thumb {
  flex: 0 0 86px;
  height: 62px;
  border: 2px solid transparent;
  border-radius: 0;
  overflow: hidden;
  opacity: .62;
  cursor: pointer;
  transition: .3s var(--ease);
}

.tpl-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tpl-thumb:hover,
.tpl-thumb.active {
  opacity: 1;
  border-color: var(--pink);
}

.tpl-modal-content {
  padding: 26px 28px 34px;
}

.tpl-modal-header {
  margin-bottom: 24px;
}

.tpl-modal-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tpl-modal-badge {
  display: inline-flex;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid rgba(139, 92, 246, .35);
  background: rgba(139, 92, 246, .16);
  color: #f4eaff;
  font-weight: 800;
  font-size: .85rem;
}

.tpl-modal-price {
  color: #fff;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  font-weight: 800;
}

.tpl-modal-title {
  font-size: clamp(1.8rem, 3vw, 2.65rem);
  line-height: 1;
}

.tpl-modal-desc {
  max-width: 860px;
  margin-top: 16px;
  color: var(--muted);
  line-height: 1.75;
}

.tpl-modal-details {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.tpl-detail-item {
  padding: 18px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.07);
}

.tpl-detail-item strong {
  display: block;
  margin-bottom: 7px;
  color: #fff;
  font-size: .82rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.tpl-detail-item span {
  color: var(--muted);
  line-height: 1.55;
}

.tpl-modal-delivery {
  margin-bottom: 26px;
  padding: 22px;
  border: 1px solid rgba(236,72,153,.24);
  background: rgba(236,72,153,.08);
}

.tpl-modal-delivery-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.tpl-modal-delivery-header h3 {
  font-size: 1.05rem;
}

.tpl-modal-delivery-steps {
  display: grid;
  gap: 10px;
}

.tpl-delivery-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.tpl-delivery-step-num {
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: #fff;
  font-size: .82rem;
  font-weight: 800;
}

.tpl-delivery-step-text {
  padding-top: 4px;
  color: var(--muted);
  line-height: 1.65;
}

.tpl-delivery-step-text strong {
  color: #fff;
}

.tpl-modal-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.tpl-modal-buy-btn,
.tpl-modal-whatsapp-btn {
  flex: 1;
  min-width: 190px;
}

.tpl-modal-buy-btn.disabled {
  pointer-events: none;
  opacity: .55;
}

@media (max-width: 1024px) {
  .templates-hero-grid,
  .templates-store-header,
  .templates-cta-card {
    grid-template-columns: 1fr;
  }

  .templates-hero-panel {
    min-height: 460px;
  }

  .templates-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .templates-filter {
    justify-content: flex-start;
  }

  .templates-cta-actions {
    display: flex;
    flex-wrap: wrap;
    min-width: auto;
  }
}

@media (max-width: 760px) {
  .templates-hero {
    padding: 64px 0 46px;
  }

  .templates-hero-copy h1 {
    font-size: clamp(2.7rem, 16vw, 4.1rem);
  }

  .templates-hero-copy p {
    font-size: 1rem;
  }

  .templates-hero-panel {
    min-height: auto;
  }

  .templates-window-card {
    min-height: auto;
    padding: 24px;
    transform: none;
  }

  .templates-window-card h2 {
    font-size: 2rem;
  }

  .template-ticket-one,
  .template-ticket-two {
    position: static;
    margin-top: 14px;
  }

  .templates-store-section {
    padding-top: 70px;
  }

  .templates-store-header h2,
  .templates-cta-text h2 {
    font-size: 2.35rem;
  }

  .templates-filter {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .filter-btn {
    flex: 0 0 auto;
  }

  .templates-cards-grid {
    grid-template-columns: 1fr;
  }

  .tpl-card-image {
    height: 220px;
  }

  .tpl-modal-overlay {
    align-items: flex-start;
    padding: 84px 12px 24px;
  }

  .tpl-modal {
    max-height: calc(100vh - 108px);
  }

  .tpl-modal-gallery {
    padding: 0 16px;
  }

  .tpl-gallery-main {
    height: 240px;
  }

  .tpl-modal-content {
    padding: 22px 16px 28px;
  }

  .tpl-modal-details {
    grid-template-columns: 1fr;
  }

  .tpl-modal-actions {
    display: grid;
  }

  .tpl-modal-buy-btn,
  .tpl-modal-whatsapp-btn,
  .templates-cta-actions .btn {
    width: 100%;
  }
}

@media (max-width: 540px) {
  .tpl-card-footer,
  .tpl-modal-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .tpl-btn-details {
    width: 100%;
  }

  .templates-cta-card {
    padding: 28px 22px;
  }
}