/* ==========================================================================
   2026 DESIGN SYSTEM & VARIABLES (Clean, Dark, Premium, Fluid)
   ========================================================================== */
:root {
  --bg-main: #0b0d12;
  --bg-surface: #141822;
  --bg-surface-hover: #1c2331;
  --text-primary: #f3f4f6;
  --text-muted: #9ca3af;
  --accent: #6366f1; /* Indigo vibrant modern */
  --accent-hover: #4f46e5;
  --border: rgba(255, 255, 255, 0.06);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  --font-sans:
    "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-sans);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: 70px; /* Space for the floating bottom ad */
}

/* ==========================================================================
   SIDEBAR (Desktop Layout)
   ========================================================================== */
.sidebar {
  width: 260px;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 32px 24px;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 40px;
}
.logo .accent {
  color: var(--accent);
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.nav-item:hover,
.nav-item.active {
  color: var(--text-primary);
  background-color: var(--bg-surface-hover);
}

.nav-item.active {
  background-color: rgba(99, 102, 241, 0.1);
  color: var(--accent);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.avatar {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent), #ec4899);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.username {
  font-size: 14px;
  font-weight: 600;
}

.user-badge {
  font-size: 11px;
  color: var(--text-muted);
}

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */
.main-content {
  margin-left: 260px;
  flex-grow: 1;
  padding: 40px;
  max-width: 1400px;
}

/* TOP HEADER */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 40px;
}

.search-bar-container {
  position: relative;
  flex-grow: 1;
  max-width: 500px;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 14px 16px 14px 48px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  transition: all 0.2s ease;
  z-index: 2;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: none;
  font-family: var(--font-sans);
  transition: all 0.2s ease;
}

.btn-primary {
  background-color: var(--accent);
  color: white;
}

.btn-primary:hover {
  background-color: var(--accent-hover);
}

.btn-secondary {
  background-color: var(--bg-surface-hover);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

/* STATS OVERVIEW CARDS */
.stats-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 48px;
}

.stat-card {
  background: linear-gradient(145deg, var(--bg-surface), rgba(20, 24, 34, 0.6));
  border: 1px solid var(--border);
  padding: 24px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 20px;
  backdrop-filter: blur(10px);
}

.stat-icon {
  font-size: 32px;
  background: rgba(255, 255, 255, 0.03);
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

.stat-data {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
}

/* GRID & FILTER HEADERS */
.section-title-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.section-title {
  font-size: 22px;
  font-weight: 700;
}

.filters {
  display: flex;
  gap: 8px;
}

.filter-chip {
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-chip:hover,
.filter-chip.active {
  background-color: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* MEDIA GRID & CARDS */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 28px;
}

.media-card {
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  transition:
    transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    box-shadow 0.3s ease;
  cursor: pointer;
}

.media-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow);
  border-color: rgba(99, 102, 241, 0.3);
}

.poster-wrapper {
  position: relative;
  aspect-ratio: 2/3;
  background-color: #1a1f2c;
}

.poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-type-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(11, 13, 18, 0.75);
  backdrop-filter: blur(4px);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.media-details {
  padding: 16px;
}

.media-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* ==========================================================================
   NON-INTRUSIVE PUBLICITY STYLING (2026 UX Best Practice)
   ========================================================================== */

/* 1. Integrated Native Ad Card (Blends directly into the core content feed) */
.native-ad-card {
  background: linear-gradient(
    135deg,
    rgba(20, 24, 34, 0.8),
    rgba(99, 102, 241, 0.05)
  );
  border: 1px dashed rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  aspect-ratio: 2/3;
}

.ad-tag {
  position: absolute;
  top: 12px;
  right: 12px;
  background-color: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 9px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.ad-body {
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.ad-icon {
  font-size: 40px;
  margin-bottom: 8px;
}

.ad-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
}

.ad-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* 2. Slim Bottom Smart Banner Ad */
.bottom-anchor-ad {
  position: fixed;
  bottom: 16px;
  left: 280px; /* Accounts for desktop sidebar offset */
  right: 20px;
  background: rgba(20, 24, 34, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 24px;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.4);
  z-index: 999;
  animation: slideUp 0.5s ease;
}

.ad-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.ad-badge {
  background-color: rgba(99, 102, 241, 0.15);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.ad-text {
  font-size: 13px;
  color: var(--text-primary);
  flex-grow: 1;
}

.ad-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ad-link-btn {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

.ad-link-btn:hover {
  text-decoration: underline;
}

.ad-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.2s;
}

.ad-close:hover {
  color: var(--text-primary);
}

@keyframes slideUp {
  from {
    transform: translateY(100px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ==========================================================================
   RESPONSIVE LAYOUT (Mobile Experience Transformation)
   ========================================================================== */
@media (max-width: 900px) {
  body {
    padding-bottom: 150px; /* Space for both mobile bar & bottom ad */
  }
  .sidebar {
    width: 100%;
    height: 64px;
    top: auto;
    bottom: 0;
    left: 0;
    border-right: none;
    border-top: 1px solid var(--border);
    padding: 0 16px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .logo,
  .user-profile {
    display: none; /* Hide fluff on mobile bottom bar */
  }
  .nav-menu {
    flex-direction: row;
    width: 100%;
    justify-content: space-around;
    gap: 0;
  }
  .nav-item {
    flex-direction: column;
    font-size: 10px;
    gap: 4px;
    padding: 8px;
  }
  .nav-item span {
    display: block;
  }
  .main-content {
    margin-left: 0;
    padding: 20px;
  }
  .top-header {
    flex-direction: column;
    align-items: stretch;
  }
  .bottom-anchor-ad {
    left: 16px;
    right: 16px;
    bottom: 80px; /* Elevate so it doesn't overlap mobile nav bar */
  }
  .ad-wrapper {
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }
  .ad-text {
    font-size: 12px;
  }
}

/* ==========================================================================
   PAGES D'AUTHENTIFICATION (VUSTO STYLE)
   ========================================================================== */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-main);
  padding: 20px;
}

.auth-container {
  width: 100%;
  max-width: 420px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: var(--shadow);
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 32px;
}

/* Onglets */
.auth-tabs {
  display: flex;
  background-color: rgba(255, 255, 255, 0.03);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 28px;
  border: 1px solid var(--border);
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 10px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.tab-btn.active {
  background-color: var(--bg-surface-hover);
  color: var(--text-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Formulaires */
.auth-form {
  display: none; /* Caché par défaut */
  flex-direction: column;
  gap: 20px;
}

.auth-form.active {
  display: flex; /* Affiché si actif */
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.label-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
}
.form-link:hover {
  text-decoration: underline;
}

.form-group input {
  background-color: var(--bg-main);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  transition: all 0.2s ease;
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.btn-full {
  width: 100%;
  justify-content: center;
  padding: 14px;
  margin-top: 10px;
}

/* Liste déroulante des résultats de recherche */
.search-bar-container {
  position: relative; /* Indispensable pour bloquer le dropdown en dessous */
  z-index: 10;
}

.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-top: 8px;
  max-height: 380px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: var(--shadow);
  display: none; /* Caché par défaut */
  z-index: 1;
}

/* Un élément (film/série) dans la liste */
.search-result-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background-color 0.2s;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background-color: var(--bg-surface-hover);
}

.search-result-poster {
  width: 40px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background-color: #1a1f2c;
}

.search-result-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.search-result-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.search-result-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* ==========================================================================
   PAGE DÉTAILS (CINEMATIC DESIGN)
   ========================================================================== */
.details-body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  position: relative;
  padding-bottom: 60px;
}

.back-btn {
  position: absolute;
  top: 24px;
  left: 24px;
  z-index: 100;
}

.hero-banner {
  height: 45vh;
  background-size: cover;
  background-position: center top;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1;
}

.details-container {
  position: relative;
  z-index: 2;
  margin-top: 25vh;
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 40px;
}

.main-poster {
  width: 100%;
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border);
}

.movie-detail-title {
  font-size: 36px;
  font-weight: 700;
  margin-top: 12px;
  margin-bottom: 16px;
}

.year-span {
  color: var(--text-muted);
  font-weight: 400;
}

.media-badge {
  background-color: var(--accent);
  color: white;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.genres {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.genre-tag {
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-muted);
}

.synopsis-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.synopsis-text {
  color: var(--text-muted);
  line-height: 1.6;
  font-size: 15px;
  margin-bottom: 32px;
}

/* Carte formulaire */
.user-action-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}

.user-action-card h3 {
  margin-bottom: 16px;
  font-size: 16px;
}

.log-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.custom-select {
  background-color: var(--bg-main);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
}

.log-form textarea {
  background-color: var(--bg-main);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  resize: none;
}

@media (max-width: 768px) {
  .details-container {
    grid-template-columns: 1fr;
    margin-top: 15vh;
  }
  .details-poster-zone {
    max-width: 200px;
    margin: 0 auto;
  }
}
