:root {
  --bg: #080a0f;
  --surface: rgba(18, 21, 31, 0.84);
  --surface2: rgba(30, 34, 48, 0.8);
  --text: #f7f8fc;
  --muted: #a9afc0;
  --line: rgba(255, 255, 255, 0.09);
  --accent: #8b6dff;
  --accent2: #ff4f78;
  --yellow: #ffd56a;
  --green: #6bffc7;
  --danger: #ff6a8f;
  --shadow-card: 0 18px 55px rgba(0, 0, 0, 0.24);
  --shadow-large: 0 34px 100px rgba(0, 0, 0, 0.42);
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 4%, rgba(139, 109, 255, 0.16), transparent 30rem),
    radial-gradient(circle at 95% 15%, rgba(255, 79, 120, 0.13), transparent 28rem),
    radial-gradient(circle at 50% 100%, rgba(75, 190, 255, 0.08), transparent 36rem),
    linear-gradient(180deg, #090b11, #07080d 55%, #05060a);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.24;
  background-image:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

::selection {
  color: white;
  background: rgba(139, 109, 255, 0.65);
}

/* Barre latérale */
.sidebar {
  background:
    linear-gradient(180deg, rgba(13, 15, 23, 0.96), rgba(8, 10, 16, 0.96));
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 18px 0 70px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(28px);
}

.sidebar nav a,
.sidebar nav button {
  position: relative;
  overflow: hidden;
  color: var(--muted);
  border: 1px solid transparent;
  background: transparent;
  transition:
    color 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.sidebar nav a:hover,
.sidebar nav button:hover {
  color: white;
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.055);
  transform: translateX(3px);
}

.sidebar nav a.active,
.sidebar nav button.active {
  color: white;
  border-color: rgba(139, 109, 255, 0.34);
  background:
    linear-gradient(135deg, rgba(139, 109, 255, 0.2), rgba(255, 79, 120, 0.1));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
}

/* Logo */
.brand {
  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
}

.brand:hover {
  transform: translateY(-2px);
}

.brand span {
  color: white;
  background:
    linear-gradient(135deg, #9b83ff, #ff4f78);
  box-shadow:
    0 12px 30px rgba(139, 109, 255, 0.28),
    inset 0 1px rgba(255, 255, 255, 0.26);
}

/* Barre supérieure */
.topbar {
  background: rgba(8, 10, 16, 0.78);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(26px);
  box-shadow: 0 14px 45px rgba(0, 0, 0, 0.14);
}

/* Recherche */
.search {
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.035);
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.search:focus-within {
  border-color: rgba(139, 109, 255, 0.58);
  background: rgba(255, 255, 255, 0.07);
  box-shadow:
    0 0 0 4px rgba(139, 109, 255, 0.1),
    0 14px 40px rgba(0, 0, 0, 0.17);
}

/* Titres */
.pageTitle h1,
.hero h1 {
  color: white;
  text-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.eyebrow {
  color: #b6a8ff;
  font-weight: 900;
  letter-spacing: 0.16em;
}

/* Hero */
.hero {
  isolation: isolate;
  border: 1px solid rgba(255, 255, 255, 0.11);
  box-shadow: var(--shadow-large);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 1px rgba(255,255,255,.12);
}

.heroContent,
.heroShade {
  z-index: 2;
}

/* Cartes */
.movieCard,
.reviewCard,
.settingsCard,
.personCard,
.customListCard,
.statBox,
.notification,
.adminPanel,
.dashboardPanel {
  transition:
    transform 0.24s ease,
    border-color 0.24s ease,
    box-shadow 0.24s ease,
    background 0.24s ease;
}

.reviewCard,
.settingsCard,
.personCard,
.customListCard,
.statBox,
.notification,
.adminPanel,
.dashboardPanel {
  border: 1px solid rgba(255, 255, 255, 0.09);
  background:
    linear-gradient(145deg, rgba(27, 30, 42, 0.88), rgba(14, 16, 24, 0.9));
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.2),
    inset 0 1px rgba(255, 255, 255, 0.035);
}

.reviewCard:hover,
.personCard:hover,
.customListCard:hover,
.statBox:hover {
  transform: translateY(-4px);
  border-color: rgba(139, 109, 255, 0.27);
  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(139, 109, 255, 0.05);
}

/* Affiches */
.poster {
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.25);
}

.movieCard:hover {
  transform: translateY(-5px);
}

.movieCard:hover .poster {
  box-shadow:
    0 28px 65px rgba(0, 0, 0, 0.36),
    0 0 0 1px rgba(139, 109, 255, 0.15);
}

.poster img {
  transition:
    transform 0.42s ease,
    filter 0.42s ease;
}

.movieCard:hover .poster img {
  transform: scale(1.055);
  filter: brightness(0.88) saturate(1.08);
}

/* Boutons */
.primary,
.secondary,
.loadMore,
.loginBtn,
.cookie-btn {
  min-height: 44px;
  border-radius: 14px;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    filter 0.18s ease;
}

.primary {
  color: white;
  border: 0;
  background:
    linear-gradient(135deg, #8b6dff, #ff4f78);
  box-shadow:
    0 13px 35px rgba(139, 109, 255, 0.25),
    inset 0 1px rgba(255,255,255,.24);
}

.primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.07);
  box-shadow:
    0 19px 45px rgba(139, 109, 255, 0.33),
    inset 0 1px rgba(255,255,255,.28);
}

.secondary,
.loadMore {
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.055);
}

.secondary:hover,
.loadMore:hover {
  transform: translateY(-2px);
  border-color: rgba(139, 109, 255, 0.38);
  background: rgba(139, 109, 255, 0.1);
}

/* Champs */
input,
textarea,
select {
  color: var(--text);
}

.authCard input,
.authCard textarea,
.commentsCard input,
.settingsCard input,
.settingsCard textarea,
.bigInput,
.chatForm input {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.045);
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.authCard input:focus,
.authCard textarea:focus,
.commentsCard input:focus,
.settingsCard input:focus,
.settingsCard textarea:focus,
.bigInput:focus,
.chatForm input:focus {
  outline: none;
  border-color: rgba(139, 109, 255, 0.62);
  background: rgba(255, 255, 255, 0.065);
  box-shadow: 0 0 0 4px rgba(139, 109, 255, 0.1);
}

/* Modales */
.modal {
  background: rgba(3, 4, 8, 0.82);
  backdrop-filter: blur(22px);
}

.modalCard {
  border: 1px solid rgba(255, 255, 255, 0.11);
  background:
    radial-gradient(circle at 0 0, rgba(139, 109, 255, 0.09), transparent 35%),
    linear-gradient(145deg, #191c28, #0d0f16);
  box-shadow: var(--shadow-large);
}

/* Avatars */
.avatar,
.profileAvatar,
.profileAvatarBig,
.publicProfileAvatar,
.adminMiniAvatar {
  color: white;
  background:
    linear-gradient(135deg, #8b6dff, #ff4f78);
  box-shadow:
    0 10px 25px rgba(139, 109, 255, 0.2),
    inset 0 1px rgba(255,255,255,.24);
}

/* Messages */
.messaging {
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(16, 18, 27, 0.72);
  box-shadow: var(--shadow-card);
}

.conversations,
.chat {
  background: rgba(12, 14, 21, 0.72);
}

.conversation {
  transition: background 0.18s ease;
}

.conversation:hover {
  background: rgba(255, 255, 255, 0.05);
}

.bubble {
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.065);
}

.bubble.me {
  border-color: transparent;
  background:
    linear-gradient(135deg, #8b6dff, #ff4f78);
  box-shadow: 0 9px 25px rgba(139, 109, 255, 0.18);
}

/* Scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 109, 255, 0.75) rgba(255, 255, 255, 0.04);
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.035);
}

*::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background:
    linear-gradient(180deg, #8b6dff, #ff4f78);
  background-clip: padding-box;
}

/* Chargement */
.skeleton {
  background:
    linear-gradient(
      100deg,
      rgba(255,255,255,.035) 20%,
      rgba(255,255,255,.09) 40%,
      rgba(255,255,255,.035) 60%
    );
  background-size: 220% 100%;
  animation: cineSkeleton 1.5s linear infinite;
}

@keyframes cineSkeleton {
  to {
    background-position-x: -220%;
  }
}

/* Animations discrètes */
.page.active {
  animation: cinePageEnter 0.28s ease both;
}

@keyframes cinePageEnter {
  from {
    opacity: 0;
    transform: translateY(7px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* Accessibilité */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(139, 109, 255, 0.85);
  outline-offset: 3px;
}

/* Responsive */
@media (max-width: 900px) {
  .topbar {
    padding-inline: 16px;
  }

  .heroContent {
    left: 7%;
    right: 7%;
  }

  .reviewCard,
  .settingsCard,
  .personCard,
  .customListCard {
    border-radius: 17px;
  }
}

@media (max-width: 600px) {
  body {
    background:
      radial-gradient(circle at 10% 0, rgba(139, 109, 255, 0.14), transparent 22rem),
      linear-gradient(180deg, #090b11, #06070b);
  }

  .hero {
    border-radius: 20px;
  }

  .primary,
  .secondary,
  .loadMore {
    min-height: 48px;
  }

  .movieCard h3 {
    font-size: 0.9rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Bouton de déconnexion du profil */
.profileLogoutSection {
  margin-top: 28px;
  padding: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid rgba(255, 92, 120, 0.28);
  border-radius: 20px;
  background:
    linear-gradient(
      135deg,
      rgba(255, 55, 90, 0.09),
      rgba(255, 80, 110, 0.035)
    );
}

.profileLogoutSection strong {
  display: block;
  color: #fff;
  font-size: 1rem;
}

.profileLogoutSection p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.profileLogoutBtn {
  min-height: 46px;
  padding: 0 20px;
  flex: none;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, #ff315f, #d91645);
  box-shadow:
    0 14px 34px rgba(255, 40, 83, 0.24),
    inset 0 1px rgba(255, 255, 255, 0.2);
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    filter 0.18s ease,
    box-shadow 0.18s ease;
}

.profileLogoutBtn:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow:
    0 19px 42px rgba(255, 40, 83, 0.32),
    inset 0 1px rgba(255, 255, 255, 0.24);
}

.profileLogoutBtn:active {
  transform: translateY(0);
}

@media (max-width: 650px) {
  .profileLogoutSection {
    align-items: stretch;
    flex-direction: column;
  }

  .profileLogoutBtn {
    width: 100%;
  }
}

/* Bandes-annonces des prochains films */
.upcomingTrailersSection {
  margin-top: 52px;
}

.trailerGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.trailerCard {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 20px;
  background: linear-gradient(
    145deg,
    rgba(27, 30, 42, 0.92),
    rgba(14, 16, 24, 0.94)
  );
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
  transition:
    transform 0.22s ease,
    border-color 0.22s ease,
    box-shadow 0.22s ease;
}

.trailerCard:hover {
  transform: translateY(-5px);
  border-color: rgba(139, 109, 255, 0.35);
  box-shadow: 0 28px 65px rgba(0, 0, 0, 0.34);
}

.trailerPoster {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  display: block;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: #11131a;
  cursor: pointer;
}

.trailerPoster img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 0.35s ease, filter 0.35s ease;
}

.trailerCard:hover .trailerPoster img {
  transform: scale(1.05);
  filter: brightness(0.72);
}

.trailerPlay {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  color: white;
  background: linear-gradient(135deg, #8b6dff, #ff4f78);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.42);
  font-size: 1.25rem;
}

.trailerInfo {
  padding: 18px;
}

.trailerInfo h3 {
  margin: 0;
  color: white;
  font-size: 1.05rem;
}

.trailerInfo p {
  margin: 8px 0 15px;
  color: var(--muted);
  font-size: 0.88rem;
}

.trailerOpenButton {
  width: 100%;
}

.trailerLoading,
.trailerEmpty {
  grid-column: 1 / -1;
  padding: 30px;
  text-align: center;
  color: var(--muted);
}

.trailerModal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(2, 3, 7, 0.88);
  backdrop-filter: blur(18px);
}

.trailerModalCard {
  position: relative;
  width: min(1000px, 96vw);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 22px;
  background: #000;
  box-shadow: 0 35px 110px rgba(0, 0, 0, 0.65);
}

.trailerModalCard iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  border: 0;
}

.trailerModalClose {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  color: white;
  background: rgba(0, 0, 0, 0.75);
  font-size: 1.65rem;
  cursor: pointer;
}

@media (max-width: 1050px) {
  .trailerGrid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .trailerGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .trailerGrid {
    grid-template-columns: 1fr;
  }
}

#profileLogoutBtn.profileLogoutBtn {
  min-height: 52px;
  padding: 0 22px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 15px;
  color: #fff;
  background: linear-gradient(135deg, #ff315f, #c9143d);
  box-shadow: 0 14px 34px rgba(255, 49, 95, 0.28);
  font-weight: 850;
  cursor: pointer;
}

#profileLogoutBtn.profileLogoutBtn:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

#profileLogoutBtn.profileLogoutBtn:disabled {
  cursor: wait;
  opacity: 0.7;
}

/* Colonne latérale : connexion et inscription */
.authUiHidden {
  display: none !important;
}

.sidebarGuestAuth {
  display: grid;
  gap: 11px;
  margin-top: 4px;
  padding: 8px 0;
}

.sidebarGuestAuth[hidden] {
  display: none !important;
}

.sidebarAuthButton {
  position: relative;
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 0 16px;
  overflow: hidden;
  border-radius: 16px;
  color: #fff;
  font: inherit;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    filter 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.sidebarAuthButton span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.13);
  font-size: 1rem;
}

.sidebarAuthButton strong {
  font-size: 0.96rem;
  font-weight: 850;
}

.sidebarLoginButton {
  border: 1px solid rgba(139, 109, 255, 0.38);
  background:
    linear-gradient(
      135deg,
      rgba(139, 109, 255, 0.24),
      rgba(139, 109, 255, 0.08)
    );
  box-shadow:
    0 12px 32px rgba(70, 48, 170, 0.16);
}

.sidebarRegisterButton {
  border: 1px solid rgba(255, 79, 120, 0.34);
  background:
    linear-gradient(
      135deg,
      #946cff,
      #ff4f78
    );
  box-shadow:
    0 15px 38px rgba(255, 79, 120, 0.22),
    inset 0 1px rgba(255, 255, 255, 0.22);
}

.sidebarAuthButton:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.sidebarLoginButton:hover {
  border-color: rgba(139, 109, 255, 0.66);
}

.sidebarRegisterButton:hover {
  box-shadow:
    0 20px 46px rgba(255, 79, 120, 0.3),
    inset 0 1px rgba(255, 255, 255, 0.25);
}

.sidebarAuthButton:active {
  transform: translateY(0);
}

.cinetrakGuest .sidebar::after {
  content: "Rejoins la communauté CineTrak";
  display: block;
  margin: auto 12px 16px;
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 17px;
  color: var(--muted);
  background:
    radial-gradient(
      circle at top right,
      rgba(139, 109, 255, 0.13),
      transparent 60%
    ),
    rgba(255, 255, 255, 0.025);
  font-size: 0.78rem;
  line-height: 1.5;
  text-align: center;
}

@media (max-width: 700px) {
  .sidebarAuthButton {
    min-height: 48px;
    padding-inline: 13px;
  }

  .sidebarAuthButton strong {
    font-size: 0.9rem;
  }
}
