/* ============================================================
   AD DETAIL MODAL — Clean Modern Layout (Compact)
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

/* --- Overlay --- */
#ad-detail-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  font-family: 'Inter', -apple-system, sans-serif;
}
#ad-detail-modal.open {
  display: flex;
}

/* --- Card shell --- */
.ad-modal-card {
  position: relative;
  background: #fdfdfd;
  border-radius: 12px;
  width: 100%;
  max-width: 860px;
  height: 80vh;
  min-height: 500px;
  max-height: 750px;
  overflow: hidden;
  box-shadow: 0 16px 32px rgba(0,0,0,0.15);
  display: grid;
  grid-template-columns: 8fr 9fr;
}

/* --- Left column --- */
.ad-modal-left {
  background: #fff;
  border-right: 1px solid #eaeaea;
  display: flex;
  flex-direction: column;
  padding: 24px;
  box-sizing: border-box;
  min-height: 0;
}
#ad-modal-media {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
#ad-modal-media video,
#ad-modal-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* --- Native Carousel --- */
.ad-modal-carousel-track::-webkit-scrollbar {
  display: none;
}
.ad-modal-carousel-track {
  scrollbar-width: none;
}
.ad-modal-carousel-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  scroll-snap-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.ad-modal-carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  cursor: pointer;
  border: 1px solid rgba(0,0,0,0.1);
  transition: background 0.2s;
}
.ad-modal-carousel-dot.active {
  background: #fff;
  transform: scale(1.1);
}

/* --- Right column --- */
.ad-modal-right {
  display: flex;
  flex-direction: column;
  background: #fdfdfd;
  overflow-y: auto;
  padding: 24px;
  box-sizing: border-box;
  min-height: 0;
  color: #333;
}

/* --- Close Button --- */
.ad-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: #f4f4f5;
  color: #71717a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.ad-modal-close:hover {
  background: #e4e4e7;
  color: #18181b;
}

/* --- Header Actions --- */
.ad-modal-header-actions {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.ad-modal-brand-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  color: #18181b;
}
.ad-modal-brand-info img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #eaeaea;
}
.ad-modal-top-buttons {
  display: flex;
  gap: 6px;
}
.ad-btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  background: #fff;
  border: 1px solid #e4e4e7;
  color: #3f3f46;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}
.ad-btn-icon:hover {
  background: #f4f4f5;
  border-color: #d4d4d8;
  color: #18181b;
}
.ad-btn-icon.empty-icon {
  padding: 0;
  width: 28px;
  justify-content: center;
}

/* --- Grid Section --- */
.ad-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.ad-modal-card-box {
  background: #fff;
  border: 1px solid #f0f0f0;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.ad-box-title {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #52525b;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #f4f4f5;
}

/* --- Page + Price Card (merged) --- */
.ad-modal-page-price-card {
  background: #fff;
  border: 1px solid #f0f0f0;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.ad-modal-page-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ad-modal-page-row > img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #eaeaea;
  flex-shrink: 0;
}
.ad-modal-page-meta {
  min-width: 0;
  flex: 1;
}
.ad-modal-page-name {
  font-size: 13px;
  font-weight: 600;
  color: #18181b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ad-modal-page-stats {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: #71717a;
  margin-top: 2px;
}
.ad-modal-price-section {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
  padding-left: 12px;
  border-left: 1px solid #f0f0f0;
}
.ad-modal-price-current {
  font-size: 15px;
  font-weight: 700;
  color: #18181b;
}
.ad-modal-price-compare {
  font-size: 11px;
  color: #a1a1aa;
  text-decoration: line-through;
}
.ad-modal-price-discount {
  font-size: 10px;
  font-weight: 600;
  color: #15803d;
  background: #dcfce7;
  padding: 1px 6px;
  border-radius: 8px;
}

/* --- Stats Tags --- */
.ad-modal-tags-wrap {
  margin-bottom: 16px;
}
.ad-modal-tags-wrap:not(.expanded) .ad-modal-tags {
  max-height: 62px;
  overflow: hidden;
}
.ad-modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ad-modal-tags-toggle {
  display: none;
  width: 100%;
  margin-top: 6px;
  padding: 4px 0;
  border: none;
  background: none;
  color: #71717a;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
}
.ad-modal-tags-toggle:hover {
  color: #18181b;
}
.ad-modal-tags-wrap.has-overflow .ad-modal-tags-toggle {
  display: block;
}
.ad-modal-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  background: #f4f4f5;
  color: #3f3f46;
  white-space: nowrap;
  line-height: 1;
}
.ad-modal-tag .ad-tag-label {
  color: #a1a1aa;
}
.ad-modal-tag img {
  width: 14px;
  height: 10px;
  border-radius: 2px;
  object-fit: cover;
}
.ad-modal-tag[data-score] {
  font-weight: 600;
}
.ad-modal-tag[data-score="winning"] {
  background: #dcfce7;
  color: #15803d;
}
.ad-modal-tag[data-score="scaling"] {
  background: #dbeafe;
  color: #1d4ed8;
}
.ad-modal-tag[data-score="testing"] {
  background: #fef9c3;
  color: #a16207;
}
.ad-modal-tag[data-score="to-be-determined"] {
  background: #f4f4f5;
  color: #71717a;
}
.ad-modal-tag[data-active="true"] {
  background: #dcfce7;
  color: #15803d;
}
.ad-modal-tag[data-active="false"] {
  background: #fee2e2;
  color: #b91c1c;
}

/* --- Ad Chart --- */
.ad-modal-chart-box {
  margin-bottom: 16px; 
}
#ad-modal-canvas {
  width: 100% !important;
  max-height: 100px;
}

/* --- Landing Page Section --- */
#ad-modal-landing-wrap {
  margin-bottom: 16px;
}
.ad-modal-section-small-title {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #52525b;
  margin-bottom: 6px;
}
.ad-modal-copy-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8f8f8;
  border: 1px solid #eaeaea;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 11px;
  color: #3f3f46;
}
.ad-modal-copy-box span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.ad-modal-copy-btn {
  background: none;
  border: none;
  color: #71717a;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  margin-left: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ad-modal-copy-btn:hover {
  background: #e4e4e7;
  color: #18181b;
}

/* --- Text Section / Accordions --- */
.ad-modal-accordion {
  background: #fff;
  border: 1px solid #f0f0f0;
  border-radius: 8px;
  margin-bottom: 8px;
  /* no overflow:hidden — it clips the body height */
}
.ad-modal-accordion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
  background: #fdfdfd;
  transition: background 0.2s;
}
.ad-modal-accordion-header:hover {
  background: #f8f8f8;
}
.ad-modal-accordion-chevron {
  color: #a1a1aa;
  transition: transform 0.2s ease;
  transform: rotate(0deg);
}
.ad-modal-accordion.collapsed .ad-modal-accordion-chevron {
  transform: rotate(-90deg);
}
.ad-modal-accordion-body {
  /* takes natural height when open */
  display: block;
  padding: 0 12px 12px;
}
.ad-modal-accordion.collapsed .ad-modal-accordion-body {
  display: none;
}
.ad-modal-text-content {
  font-size: 11px;
  line-height: 1.55;
  color: #3f3f46;
  padding-right: 8px;
  border-top: 1px dashed #eaeaea;
  padding-top: 10px;
}

/* --- Scrollbar styling --- */
.ad-modal-right::-webkit-scrollbar {
  width: 4px;
}
.ad-modal-right::-webkit-scrollbar-track {
  background: transparent;
}
.ad-modal-right::-webkit-scrollbar-thumb {
  background: #d4d4d8;
  border-radius: 2px;
}

/* --- Footer --- */
.ad-modal-footer {
  margin-top: auto;
  padding-top: 12px;
  padding-bottom: 4px;
  flex-shrink: 0;
}
.ad-modal-main-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #09090b;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}
.ad-modal-main-btn:hover {
  background: #27272a;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  #ad-detail-modal {
    padding: 0;
    align-items: flex-end;
  }
  .ad-modal-card {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(180px, 35vh) 1fr;
    max-width: 100%;
    height: 95vh;
    border-radius: 12px 12px 0 0;
  }
  .ad-modal-left {
    border-right: none;
    border-bottom: 1px solid #eaeaea;
    padding: 12px;
    height: 100%;
  }
  .ad-modal-top-buttons {
    margin-right: 0;
  }
  .ad-modal-page-row {
    flex-wrap: wrap;
  }
  .ad-modal-price-section {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
    width: 100%;
  }
}

/* --- Country Flags (inside tags) --- */
.ad-modal-flag {
  width: 14px;
  height: 10px;
  border-radius: 2px;
  object-fit: cover;
  display: inline-block;
  vertical-align: middle;
}

/* --- Country Flags --- */
