/* FomPorn - Feed vidéos TikTok-style */

/* Le feed prend tout l'écran */
.fomporn {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  height: var(--fomporn-viewport-height, 100dvh);
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  background: #000;
  z-index: 100;
}

/* Masquer header/footer quand FomPorn est actif */
body.fomporn-active .header,
body.fomporn-active .footer {
  display: none;
}

/* Le feed FomPorn est rendu dans .page-wrapper : elle doit rester visible. */
body.fomporn-active .page-wrapper {
  display: block;
  margin: 0;
  padding: 0;
}

body.fomporn-active {
  overflow: hidden;
}

/* Navigation propre au flux : verre sombre au-dessus de la vidéo. */
.fomporn-topbar {
  position: fixed;
  inset: 0 0 auto;
  box-sizing: border-box;
  z-index: 110;
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  min-height: 72px;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  background: linear-gradient(180deg, rgba(7, 7, 9, 0.76) 0%, rgba(7, 7, 9, 0.36) 68%, transparent 100%);
  backdrop-filter: blur(14px) saturate(125%);
  -webkit-backdrop-filter: blur(14px) saturate(125%);
  pointer-events: none;
}

.fomporn-brand {
  grid-column: 2;
  justify-self: center;
  color: #fff;
  font-size: 22px;
  font-weight: 750;
  line-height: 1;
  letter-spacing: -0.7px;
  text-decoration: none;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
  pointer-events: auto;
}

.fomporn-brand strong {
  color: var(--color-primary, #e8175d);
  font-weight: inherit;
}

/* Chaque slide = plein écran */
.fomporn-slide {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  height: var(--fomporn-viewport-height, 100dvh);
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
}

.fomporn-slide::after {
  content: '';
  position: absolute;
  inset: 35% 0 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.14) 32%, rgba(0, 0, 0, 0.78) 100%);
}

/* Vidéo */
.fomporn-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fomporn-video {
  cursor: pointer;
}

/* Icône Play */
.fomporn-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  z-index: 3;
  width: clamp(64px, 18vw, 76px);
  height: clamp(64px, 18vw, 76px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, rgba(244, 25, 99, 0.96), rgba(177, 10, 68, 0.94));
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  box-shadow: 0 12px 34px rgba(232, 23, 93, 0.34), 0 4px 14px rgba(0, 0, 0, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s ease, opacity 0.18s ease;
}

.fomporn-play-icon::before {
  content: "";
  position: absolute;
  inset: -7px;
  border: 1px solid rgba(232, 23, 93, 0.42);
  border-radius: inherit;
}

.fomporn-play-icon svg {
  width: 34px;
  height: 34px;
  margin-left: 3px;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
}

.fomporn-slide.is-paused .fomporn-play-icon {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

/* Infos auteur en bas */
.fomporn-info {
  position: absolute;
  bottom: calc(34px + env(safe-area-inset-bottom, 0px));
  left: 20px;
  right: 88px;
  z-index: 4;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

.fomporn-info__author {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}

.fomporn-info__author svg {
  width: 20px;
  height: 20px;
  stroke: #fff;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fomporn-tier-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 3px 7px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background: linear-gradient(135deg, #e8175d, #ff5c93);
  box-shadow: 0 4px 14px rgba(232, 23, 93, 0.3);
}

.fomporn-tier-badge--pro {
  color: #1a0d00;
  background: linear-gradient(135deg, #ffd76a, #ff9f1c);
  box-shadow: 0 4px 14px rgba(255, 181, 48, 0.3);
}

.fomporn-info__title {
  font-size: 13px;
  font-weight: 400;
  opacity: 0.9;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fomporn-profile-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 36px;
  margin-top: 12px;
  padding: 8px 12px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  background: var(--color-primary, #e8175d);
  border-radius: 999px;
}

.fomporn-profile-link svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Actions latérales (like, comment, share) */
.fomporn-actions {
  position: absolute;
  right: 12px;
  bottom: calc(35px + env(safe-area-inset-bottom, 0px));
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  pointer-events: auto;
}

.fomporn-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  color: #fff;
  padding: 0;
  min-width: 48px;
  min-height: 48px;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto;
  touch-action: manipulation;
}

.fomporn-action-btn:focus-visible,
.fomporn-back:focus-visible,
.fomporn-mute:focus-visible,
.fomporn-profile-link:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.9);
  outline-offset: 3px;
}

.fomporn-views {
  cursor: default;
}

.fomporn-action-btn svg {
  width: 32px;
  height: 32px;
  stroke: #fff;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
  transition: transform 0.2s ease;
}

.fomporn-action-btn:active svg {
  transform: scale(1.3);
}

.fomporn-action-count {
  font-size: 12px;
  font-weight: 800;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Like actif */
.fomporn-like-btn.is-liked svg {
  fill: #ff2d55;
  stroke: #ff2d55;
}

.fomporn-like-btn.is-liked .fomporn-action-count {
  color: #ff2d55;
}

/* Barre de progression */
.fomporn-progress {
  position: absolute;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  left: 12px;
  right: 12px;
  height: 24px;
  background: transparent;
  z-index: 6;
  overflow: visible;
  border-radius: 999px;
  cursor: pointer;
  touch-action: none;
}

.fomporn-progress::before {
  content: '';
  position: absolute;
  inset: 50% 0 auto;
  height: 7px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  transform: translateY(-50%);
}

.fomporn-video-error {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 7;
  width: min(82%, 320px);
  padding: 12px 16px;
  color: #fff;
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
  background: rgba(20, 20, 20, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  transform: translate(-50%, -50%);
}

.fomporn-video-error[hidden] { display: none; }

.fomporn-progress__bar {
  position: absolute;
  top: 50%;
  left: 0;
  z-index: 1;
  height: 7px;
  background: var(--color-primary, #ff2d55);
  width: 0%;
  border-radius: 999px;
  transform: translateY(-50%);
  transition: width 0.12s linear;
  pointer-events: none;
}

.fomporn-progress.is-seeking .fomporn-progress__bar {
  height: 9px;
  box-shadow: 0 0 12px rgba(232, 23, 93, 0.55);
}

.fomporn-progress:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 2px;
}

/* Bouton retour */
.fomporn-back {
  position: relative;
  top: auto;
  left: auto;
  z-index: 1;
  grid-column: 1;
  justify-self: start;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, rgba(29, 29, 32, 0.92), rgba(8, 8, 10, 0.86));
  border: 1px solid rgba(232, 23, 93, 0.48);
  border-radius: 50%;
  cursor: pointer;
  color: #ff4f85;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
  pointer-events: auto;
}

.fomporn-back:hover {
  color: #fff;
  background: var(--color-primary, #e8175d);
  border-color: rgba(255, 255, 255, 0.32);
}

.fomporn-back:active {
  transform: scale(0.93);
}

.fomporn-back:focus-visible {
  outline: 3px solid rgba(232, 23, 93, 0.34);
  outline-offset: 3px;
}

.fomporn-back svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (prefers-reduced-motion: reduce) {
  .fomporn-play-icon,
  .fomporn-back {
    transition: none;
  }
}

/* Page vide */
.fomporn-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  height: 100dvh;
  height: var(--fomporn-viewport-height, 100dvh);
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  padding: 20px;
}

.fomporn-empty svg {
  margin-bottom: 16px;
  opacity: 0.4;
}

.fomporn-empty h2 {
  font-size: 20px;
  margin: 0 0 8px;
  color: #fff;
}

.fomporn-empty p {
  font-size: 14px;
  margin: 0;
}

/* Modal Commentaires */

.fomporn-comments-modal {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.fomporn-comments-modal.is-open {
  transform: translateY(0);
}

.fomporn-comments-modal__inner {
  background: #1a1a1a;
  border-radius: 16px 16px 0 0;
  max-height: 60vh;
  display: flex;
  flex-direction: column;
}

.fomporn-comments-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.fomporn-comments-modal__header h3 {
  color: #fff;
  font-size: 16px;
  margin: 0;
}

.fomporn-comments-modal__close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.fomporn-comments-modal__close svg {
  width: 24px;
  height: 24px;
  stroke: #fff;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fomporn-comments-modal__list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px;
  min-height: 100px;
}

.fomporn-comment {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.fomporn-comment__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.fomporn-comment__content {
  flex: 1;
}

.fomporn-comment__author {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 2px;
}

.fomporn-comment__body {
  font-size: 14px;
  color: #fff;
  line-height: 1.4;
  margin: 0;
  word-break: break-word;
}

.fomporn-comment__date {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 4px;
}

.fomporn-comments-empty {
  text-align: center;
  color: rgba(255, 255, 255, 0.4);
  font-size: 14px;
  padding: 24px 0;
}

/* Formulaire commentaire */
.fomporn-comments-modal__form {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: #1a1a1a;
}

.fomporn-comments-modal__form input[type="text"] {
  flex: 1;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 20px;
  padding: 10px 16px;
  color: #fff;
  font-size: 14px;
  outline: none;
}

.fomporn-comments-modal__form input[type="text"]::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.fomporn-comments-modal__form button {
  background: var(--color-primary, #ff2d55);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.fomporn-comments-modal__form button svg {
  width: 20px;
  height: 20px;
  stroke: #fff;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Login prompt */
.fomporn-comments-modal__login {
  padding: 16px 20px;
  text-align: center;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.fomporn-comments-modal__login a {
  color: var(--color-primary, #ff2d55);
  font-weight: 600;
  text-decoration: none;
}

/* Overlay derrière la modal commentaires */
.fomporn-comments-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 199;
  display: none;
}

.fomporn-comments-overlay.is-visible {
  display: block;
}

/* Desktop : centrer la vidéo dans un cadre mobile-style */
@media (min-width: 768px) {
  .fomporn {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .fomporn-slide {
    max-width: 420px;
    border-radius: 0;
  }

  .fomporn-comments-modal__inner {
    max-width: 420px;
    margin: 0 auto;
  }
}

/* Mute indicator */
.fomporn-mute {
  position: relative;
  top: auto;
  right: auto;
  z-index: 1;
  grid-column: 3;
  justify-self: end;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  pointer-events: auto;
}

@media (min-width: 768px) {
  .fomporn-topbar {
    left: 50%;
    right: auto;
    width: min(100%, 420px);
    transform: translateX(-50%);
    border-radius: 0 0 22px 22px;
  }
}

.fomporn-toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  z-index: 260;
  max-width: min(88vw, 360px);
  padding: 11px 16px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  background: rgba(24, 24, 24, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.fomporn-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 480px) {
  .fomporn-info {
    left: 16px;
    right: 76px;
  }
}

.fomporn-mute svg {
  width: 22px;
  height: 22px;
  stroke: #fff;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
