/* =====================================================================
   ROLOX MOTORSPORT - Pubs ("Mode trou du cul") + Commentaires (v0.19)
   ===================================================================== */

/* ---------- Overlay publicite plein ecran ---------- */
.ad-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .82);
  backdrop-filter: blur(2px);
  padding: 20px;
}
.ad-overlay.show { display: flex; }

.ad-overlay__box {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface, #fff);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
  animation: adPop .25s ease;
}
@keyframes adPop {
  from { transform: scale(.92); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.ad-overlay__badge {
  display: flex; align-items: center; gap: 6px;
  background: var(--flame, #ff5722);
  color: #fff;
  font-size: 12px; font-weight: 800;
  letter-spacing: .04em; text-transform: uppercase;
  padding: 8px 14px;
}

.ad-overlay__img {
  display: block;
  width: 100%;
  max-height: 60vh;
  object-fit: contain;
  background: #111;
}

.ad-overlay__bar {
  height: 6px;
  background: var(--bg-surface-2, #ebebef);
  overflow: hidden;
}
.ad-overlay__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--flame, #ff5722), var(--turbo, #ffb800));
  transition: width .1s linear;
}

.ad-overlay__close {
  width: 100%;
  border: none;
  padding: 15px;
  font-family: inherit;
  font-size: 15px; font-weight: 700;
  color: #fff;
  background: var(--text-tertiary, #8888a0);
  cursor: not-allowed;
  transition: background .15s ease;
}
.ad-overlay__close:not([disabled]) {
  background: var(--flame, #ff5722);
  cursor: pointer;
}
.ad-overlay__close:not([disabled]):hover { background: var(--flame-dark, #d84315); }

/* ---------- Bouton admin "Mode trou du cul" ---------- */
.adtoggle-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%;
  margin-top: 12px;
  padding: 14px;
  border: 2px dashed var(--border-strong, #b8b8c0);
  border-radius: var(--radius-md, 12px);
  background: var(--bg-surface, #fff);
  color: var(--text-secondary, #55556a);
  font-family: inherit;
  font-size: 14px; font-weight: 700;
  cursor: pointer;
  transition: all .15s ease;
}
.adtoggle-btn:hover { background: var(--bg-surface-2, #ebebef); }
.adtoggle-btn.is-on {
  border-style: solid;
  border-color: var(--flame, #ff5722);
  background: #fff5f0;
  color: var(--flame-dark, #d84315);
}

/* ---------- Commentaires ---------- */
.comments { margin-top: 22px; border-top: 1px solid var(--border, #d9d9e0); padding-top: 16px; }
.comments__title {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 12px; font-size: 15px; font-weight: 800;
  color: var(--text-primary, #0a0a0f);
}
.comments__loading, .comments__empty {
  font-size: 13px; color: var(--text-tertiary, #8888a0);
  padding: 8px 0;
}
.comments__list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }

.comment { display: flex; gap: 10px; }
.comment__avatar {
  flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--flame, #ff5722); color: #fff; font-weight: 800; font-size: 14px;
}
.comment__bubble {
  flex: 1; min-width: 0;
  background: var(--bg-elevated, #fafafc);
  border: 1px solid var(--border-light, #e4e4e9);
  border-radius: 12px; padding: 8px 12px;
}
.comment__head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
}
.comment__pseudo { font-size: 13px; font-weight: 700; color: var(--text-primary, #0a0a0f); }
.comment__me {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  background: var(--flame, #ff5722); color: #fff;
  padding: 1px 5px; border-radius: 6px; margin-left: 2px;
}
.comment__when { font-size: 11px; color: var(--text-tertiary, #8888a0); }
.comment__del {
  margin-left: auto; border: none; background: none; cursor: pointer;
  color: var(--text-tertiary, #8888a0); font-size: 12px; padding: 2px 4px;
}
.comment__del:hover { color: var(--danger, #ef4444); }
.comment__text { font-size: 14px; line-height: 1.4; color: var(--text-secondary, #55556a); white-space: pre-wrap; word-break: break-word; }
.comment__audio { width: 100%; margin-top: 2px; }
.comment__photo { display: block; width: 100%; max-height: 320px; object-fit: contain; object-position: center; background: #f3f3f5; border-radius: 10px; margin-top: 2px; }

/* Composer */
.comment-composer {
  background: var(--bg-elevated, #fafafc);
  border: 1px solid var(--border-light, #e4e4e9);
  border-radius: 12px; padding: 12px;
}
.comment-composer__tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.comment-tab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border, #d9d9e0); background: var(--bg-surface, #fff);
  color: var(--text-secondary, #55556a);
  border-radius: 8px; padding: 8px 6px; font-family: inherit; font-size: 12px; font-weight: 700;
  cursor: pointer; transition: all .12s ease;
}
.comment-tab.is-active { background: var(--flame, #ff5722); border-color: var(--flame, #ff5722); color: #fff; }

.comment-rec-btn.is-recording { color: var(--danger, #ef4444); border-color: var(--danger, #ef4444); }
.comment-rec-status { font-size: 12px; color: var(--text-tertiary, #8888a0); margin-top: 6px; }
.comment-send-btn { margin-top: 10px; }

/* =====================================================================
   v0.19.1 - Photo de profil, commentaires inline, fallback audio
   ===================================================================== */

/* ---------- Bouton photo de profil ---------- */
.profile-card__avatar-btn {
  position: relative;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  display: inline-block;
  margin-bottom: 16px;            /* dégage la place sous l'avatar pour le pseudo */
  line-height: 0;                 /* évite un décalage parasite */
}
.profile-card__avatar-cam {
  position: absolute;
  right: 0; bottom: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--flame, #ff5722);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  border: 3px solid var(--bg-surface, #fff);
  z-index: 3;                     /* au-dessus de la photo (qui a z-index:1) */
}

/* ---------- Commentaires inline sous les cartes du fil ---------- */
.social-card__comments { margin-top: 6px; }
.social-card__comments .comments {
  margin-top: 8px;
  border-top: 1px dashed var(--border-light, #e4e4e9);
  padding-top: 10px;
}
.social-card__comments-meta {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13px; font-weight: 700;
  color: var(--text-tertiary, #8888a0);
}

/* Bouton "Commenter" (mode fil, composer replie) */
.comments__open-composer {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--bg-surface-2, #ebebef);
  color: var(--text-secondary, #55556a);
  border: none; border-radius: 999px;
  padding: 7px 14px; margin-top: 4px;
  font-family: inherit; font-size: 13px; font-weight: 700;
  cursor: pointer; transition: background .12s ease;
}
.comments__open-composer:hover { background: var(--border, #d9d9e0); }

/* Lien "Voir les N commentaires précédents" */
.comments__more {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none;
  color: var(--flame, #ff5722);
  font-family: inherit; font-size: 12px; font-weight: 700;
  cursor: pointer; padding: 4px 0; margin-bottom: 6px;
}
.comments__more:hover { text-decoration: underline; }

/* Avatar commentaire en image (le bg-image est posé en style inline) */
.comment__avatar { overflow: hidden; }

/* =====================================================================
   v0.20 - Recadrage circulaire de la photo de profil
   ===================================================================== */
.crop-stage {
  position: relative;
  width: 300px; max-width: 100%;
  margin: 0 auto 16px;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  background: #111;
  touch-action: none;            /* le drag ne scrolle pas la page */
  cursor: grab;
}
.crop-stage:active { cursor: grabbing; }
.crop-stage canvas { display: block; width: 100%; height: 100%; }
/* masque : assombrit hors du cercle pour visualiser le recadrage */
.crop-stage__mask {
  position: absolute; inset: 0; pointer-events: none;
  background: rgba(0, 0, 0, .45);
  -webkit-mask: radial-gradient(circle at center, transparent 0 49.5%, #000 50%);
          mask: radial-gradient(circle at center, transparent 0 49.5%, #000 50%);
}
.crop-stage__mask::after {
  content: ''; position: absolute; inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255,255,255,.7) inset;
}
/* v0.23 : variante carrée (recadrage des photos du fil social) */
.crop-stage--square .crop-stage__mask {
  -webkit-mask: none;
          mask: none;
  background: none;
}
.crop-stage--square .crop-stage__mask::after {
  border-radius: 10px;
  box-shadow: 0 0 0 2px rgba(255,255,255,.7) inset, 0 0 0 9999px rgba(0,0,0,.35);
}
.crop-zoom {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 8px; border-radius: 999px; outline: none; cursor: pointer;
  background: var(--bg-surface-2, #ebebef);
  margin: 4px 0 10px;
}
.crop-zoom::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--flame, #ff5722); border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.3); cursor: pointer;
}
.crop-zoom::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--flame, #ff5722); border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.3); cursor: pointer;
}
.crop-hint {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--text-tertiary, #8888a0); margin: 0;
}
.crop-hint i { color: var(--flame, #ff5722); }

/* =====================================================================
   v0.20 - Espace admin "Envoyer une pub" (Lou / Bastien)
   ===================================================================== */
.admin-ads { margin-top: 8px; }
.admin-ads__card {
  background: var(--bg-surface, #fff);
  border: 1px solid var(--border, #d9d9e0);
  border-radius: var(--radius-lg, 16px);
  padding: 16px;
}
.admin-ads__counter {
  display: flex; align-items: center; gap: 10px;
  background: #fff5f0;
  border: 1px solid #ffd9c7;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 14px; color: var(--flame-dark, #d84315);
}
.admin-ads__counter i { font-size: 18px; }
.admin-ads__counter strong { font-size: 16px; font-weight: 800; }
.admin-ads__hint {
  font-size: 12px; line-height: 1.5;
  color: var(--text-tertiary, #8888a0);
  margin: 10px 0 0;
}

/* v0.21 : pub video (format iPhone .mov/.mp4) dans l'overlay */
.ad-overlay__video {
  display: block;
  width: 100%;
  max-height: 60vh;
  object-fit: contain;
  background: #111;
}

/* =====================================================================
   v0.21 : Barre de fréquence, gestion des pubs, journal
   ===================================================================== */
.ads-freq {
  background: var(--bg-surface, #fff);
  border: 1px solid var(--border, #eee);
  border-radius: 14px;
  padding: 14px 16px;
  margin: 10px 0;
}
.ads-freq__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  color: var(--text-primary, #222);
  margin-bottom: 8px;
}
.ads-freq__head strong { color: #ff5722; font-size: 15px; }
.ads-freq__slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff5722, #ffb800);
  outline: none;
}
.ads-freq__slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #ff5722;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.ads-freq__slider::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #ff5722;
  cursor: pointer;
}

/* Gestion des pubs (banque) */
.ads-manage { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.ads-manage__item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface-2, #f7f7fb);
  border: 1px solid var(--border, #eee);
  border-radius: 12px;
  padding: 8px 10px;
}
.ads-manage__thumb {
  width: 46px; height: 46px;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  background-color: #ddd;
  flex-shrink: 0;
}
.ads-manage__thumb--video {
  display: grid; place-items: center;
  background: #222; color: #fff; font-size: 18px;
}
.ads-manage__info { flex: 1; min-width: 0; }
.ads-manage__name {
  font-weight: 600; font-size: 13px; color: var(--text-primary, #222);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ads-manage__type { font-size: 11.5px; color: var(--text-tertiary, #999); margin-top: 2px; }
.ads-manage__toggle {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; color: var(--text-secondary, #555);
  cursor: pointer; flex-shrink: 0;
}
.ads-manage__toggle input { width: 16px; height: 16px; accent-color: #ff5722; }
.ads-manage__del {
  border: none; background: transparent; color: #e63946;
  cursor: pointer; font-size: 15px; padding: 6px; flex-shrink: 0;
}
.ads-manage__del:hover { color: #b02633; }

/* Journal des pubs */
.ads-log { display: flex; flex-direction: column; gap: 10px; }
.ads-log__item {
  background: var(--bg-surface-2, #f7f7fb);
  border: 1px solid var(--border, #eee);
  border-radius: 12px;
  padding: 10px 12px;
}
.ads-log__line {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; color: var(--text-primary, #222); margin-bottom: 6px;
}
.ads-log__line i { color: #ff5722; font-size: 12px; }
.ads-log__meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ads-log__badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 700;
  padding: 3px 8px; border-radius: 999px;
}
.ads-log__badge.is-seen { background: rgba(46,204,113,.15); color: #1e8e4f; }
.ads-log__badge.is-pending { background: rgba(255,180,0,.18); color: #b87800; }
.ads-log__date { font-size: 11.5px; color: var(--text-tertiary, #999); }

/* v0.24 : modale journal scrollable + tri/filtres + retrait */
#adsLogModal .modal__content {
  padding: 0;
  text-align: left;
  max-width: 460px;
  width: calc(100% - 32px);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.ads-log-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-surface, #fff);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border-light, #f0f0f0);
}
.ads-log-bar__row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.ads-log-bar__sort {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: #666;
}
.ads-log-bar__sort select {
  font-family: inherit; font-size: 13px; font-weight: 600;
  color: #222; background: #fafafa;
  border: 1px solid #ddd; border-radius: 9px;
  padding: 7px 10px; cursor: pointer; text-transform: none; letter-spacing: 0;
}
.ads-log-bar__count {
  font-size: 12px; font-weight: 700; color: var(--text-tertiary, #999);
  flex-shrink: 0;
}
.ads-log-bar__chips { display: flex; gap: 8px; flex-wrap: wrap; }
.ads-log-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: inherit; font-size: 12px; font-weight: 700;
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid #ffd9c7; background: #fff5f0; color: #ff5722;
  transition: background .12s ease, opacity .12s ease;
}
.ads-log-chip:hover { background: #ffe7db; }
.ads-log-chip.is-off {
  background: #f3f3f3; color: #999; border-color: #e3e3e3;
  text-decoration: line-through;
}

.ads-log__top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
  margin-bottom: 6px;
}
.ads-log__top .ads-log__line { margin-bottom: 0; }
.ads-log__cancel {
  flex-shrink: 0; border: none; cursor: pointer;
  width: 28px; height: 28px; border-radius: 8px;
  background: rgba(230,57,70,.10); color: #e63946;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; transition: background .12s ease;
}
.ads-log__cancel:hover { background: rgba(230,57,70,.2); }
.ads-log__cancel:disabled { opacity: .5; cursor: default; }
