/* Single-screen ad formats configurator */

.ad-formats-main {
  padding-bottom: calc(5.5rem + var(--cookie-h, 0px));
}

@media (min-width: 1024px) {
  .ad-formats-main {
    padding-bottom: 1.5rem;
  }
}

.ad-formats-grid {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 1024px) {
  .ad-formats-grid {
    grid-template-columns: minmax(0, 1.5fr) minmax(360px, 1fr);
    align-items: start;
  }

  .ad-formats-request {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 5.5rem);
    overflow: auto;
  }
}

@media (max-height: 650px) and (min-width: 1024px) {
  .ad-formats-request {
    position: static;
    max-height: none;
  }
}

.ad-format-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ad-format-row {
  border: 1px solid rgba(14, 165, 233, 0.25);
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.55);
  transition: border-color 160ms ease, background-color 160ms ease;
  scroll-margin-top: 5rem;
}

.dark .ad-format-row {
  background: rgba(15, 23, 42, 0.45);
  border-color: rgba(56, 189, 248, 0.25);
}

.ad-format-row.is-selected {
  border-color: rgb(14, 165, 233);
  background: rgba(14, 165, 233, 0.08);
  box-shadow: inset 0 0 0 1px rgba(14, 165, 233, 0.35);
}

.ad-format-row__main {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 2.75rem 0.75rem 0.75rem;
  min-height: 52px;
  cursor: pointer;
}

.ad-format-row__main input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.ad-format-row__body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
}

.ad-format-row__name {
  font-weight: 600;
  font-size: 1rem;
  color: inherit;
}

.ad-format-row__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--tw-prose-muted, #5b6475);
  font-variant-numeric: tabular-nums;
}

.ad-format-row__price {
  font-weight: 600;
  color: rgb(2, 132, 199);
}

.dark .ad-format-row__price {
  color: rgb(125, 211, 252);
}

.ad-format-row {
  position: relative;
}

.ad-format-info {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 1px solid rgba(14, 165, 233, 0.4);
  background: rgba(255, 255, 255, 0.8);
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
}

.dark .ad-format-info {
  background: rgba(15, 23, 42, 0.8);
  color: #e0f2fe;
}

.ad-format-detail {
  padding: 0 0.75rem 0.75rem 2.5rem;
}

.ad-duration {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ad-duration__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 44px;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(14, 165, 233, 0.3);
  font-size: 0.875rem;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.5);
}

.dark .ad-duration__chip {
  background: rgba(15, 23, 42, 0.4);
}

.ad-duration__chip:has(input:checked) {
  border-color: rgb(14, 165, 233);
  background: rgba(14, 165, 233, 0.12);
  font-weight: 600;
}

.ad-placement-map {
  position: relative;
  max-width: 360px;
}

.ad-placement-map svg {
  width: 100%;
  max-height: 220px;
  display: block;
}

.map-bg {
  fill: rgba(226, 232, 240, 0.55);
  stroke: transparent;
  cursor: pointer;
}

.map-card {
  fill: rgba(148, 163, 184, 0.35);
}

.map-zone {
  fill: rgba(255, 255, 255, 0.75);
  stroke: rgba(14, 165, 233, 0.55);
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
  cursor: pointer;
  transition: fill 160ms ease, stroke 160ms ease;
}

.dark .map-bg { fill: rgba(30, 41, 59, 0.7); }
.dark .map-card { fill: rgba(51, 65, 85, 0.6); }
.dark .map-zone { fill: rgba(15, 23, 42, 0.65); }

.map-zone.is-active,
.map-bg.is-active {
  fill: rgba(14, 165, 233, 0.28);
  stroke: rgb(14, 165, 233);
  stroke-dasharray: none;
}

.map-zone.is-hover,
.map-bg.is-hover {
  stroke: rgb(2, 132, 199);
  stroke-dasharray: none;
}

.ad-sidebar-popover {
  position: absolute;
  right: 0;
  top: 40%;
  z-index: 5;
  width: 10rem;
  padding: 0.75rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(14, 165, 233, 0.35);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.dark .ad-sidebar-popover {
  background: rgba(15, 23, 42, 0.95);
}

.ad-summary__total {
  font-variant-numeric: tabular-nums;
  min-width: 8ch;
}

.ad-summary__line {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.875rem;
}

.ad-summary__remove {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.25rem;
  color: inherit;
  opacity: 0.7;
}

.ad-summary__remove:hover,
.ad-summary__remove:focus-visible {
  opacity: 1;
}

.ad-mobile-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--cookie-h, 0px);
  z-index: 40;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.92);
  border-top: 1px solid rgba(14, 165, 233, 0.2);
  backdrop-filter: blur(8px);
}

.dark .ad-mobile-bar {
  background: rgba(15, 23, 42, 0.92);
}

.ad-mobile-bar__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

@media (min-width: 1024px) {
  .ad-mobile-bar,
  .ad-sheet {
    display: none !important;
  }

  .ad-map-details {
    display: block;
  }

  .ad-map-details > summary {
    list-style: none;
    pointer-events: none;
  }

  .ad-map-details > summary::-webkit-details-marker {
    display: none;
  }

  .ad-map-details[open] > summary,
  .ad-map-details > summary {
    margin-bottom: 0.5rem;
  }

  .ad-map-details:not([open]) .ad-placement-map {
    display: block;
  }
}

.ad-sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.ad-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.ad-sheet__panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: min(92vh, 720px);
  overflow: auto;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 1rem 1rem 0 0;
  padding: 1rem 1rem calc(1rem + var(--cookie-h, 0px));
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.12);
}

.dark .ad-sheet__panel {
  background: rgba(15, 23, 42, 0.98);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .ad-format-row,
  .map-zone,
  .map-bg {
    transition: none;
  }
}
