<!-- Pub casino néon : overlay dans le feed, pilotée par l'inventaire de pubs -->
<template>
  <div v-if="ad" class="casino">
    <div class="casino-head">
      <p class="casino-title">♠ {{ ad.brand }} ♠</p>
      <p class="casino-subtitle">OFFRE EXCLUSIVE</p>
    </div>

    <div class="casino-body">
      <p class="bonus">+200%</p>
      <p class="bonus-sub">{{ ad.subtitle || 'sur votre 1er dépôt • 500€ max' }}</p>

      <div class="slots">
        <span class="suit suit--diamond">♦</span>
        <span class="seven">7</span>
        <span class="seven">7</span>
        <span class="seven">7</span>
        <span class="suit suit--spade">♠</span>
      </div>

      <a class="casino-cta" :href="ad.url || '#'" target="_blank" rel="noopener noreferrer nofollow">
        {{ ad.cta || 'JOUER MAINTENANT' }} &rarr;
      </a>
      <p class="disclaimer">18+ &bull; Jeu responsable &bull; {{ prettyUrl(ad.url) }}</p>
    </div>
  </div>
</template>

<script setup lang="ts">
import { computed, onMounted, watch } from 'vue';
import { useAds } from '@/composables/useAds';

const { ads, fetchAds, reportImpression } = useAds('casino');
const ad = computed(() => ads.value[0] ?? null);

function prettyUrl(url?: string | null): string {
  return (url || 'casino-lucky.bet').replace(/^https?:\/\//, '').replace(/\/$/, '');
}

watch(ad, (a) => { if (a) reportImpression(a.id); });
onMounted(fetchAds);
</script>

<style scoped>
.casino {
  width: 248px;
  background: #100400;
  border: 2px solid #ff2200;
  border-radius: 6px;
  box-shadow: none;
}

/* ── En-tête rouge ── */
.casino-head {
  background: #1a0400;
  border-radius: 4px 4px 0 0;
  border-bottom: 1px solid #440000;
  padding: 10px 8px;
  text-align: center;
}

.casino-title {
  font-family: Arial, sans-serif;
  font-size: 15px;
  font-weight: bold;
  color: #ff5533;

  margin: 0;
}

.casino-subtitle {
  font-family: Arial, sans-serif;
  font-size: 9px;
  letter-spacing: 2px;
  color: #882200;
  margin: 4px 0 0;
}

/* ── Corps ── */
.casino-body {
  padding: 12px;
  text-align: center;
}

.bonus {
  font-family: Arial, sans-serif;
  font-size: 32px;
  font-weight: bold;
  color: #ffdd00;

  margin: 0;
}

.bonus-sub {
  font-family: Arial, sans-serif;
  font-size: 11px;
  color: #cc6600;
  margin: 4px 0 10px;
}

/* ── Machines à sous ── */
.slots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.suit {
  font-size: 24px;
}
.suit--diamond { color: #ffaa44; }
.suit--spade   { color: #ffaa44; }

.seven {
  font-size: 30px;
  font-weight: bold;
  color: #ffffff;

}

/* ── CTA ── */
.casino-cta {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 0;
  background: #220000;
  border: 1.5px solid #ff2200;
  border-radius: 19px;
  color: #ff4422;
  font-family: Arial, sans-serif;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background 0.15s;
}

.casino-cta:hover {

}

.disclaimer {
  font-family: Arial, sans-serif;
  font-size: 7px;
  color: #440000;
  margin-top: 8px;
}
</style>
