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

/* ===== VARIABLES ===== */
:root {
  --red: #db3546;
  --red-dark: #b82a38;
  --black: #1a1a1a;
  --gray: #6b6b6b;
  --gray-light: #f2f2f2;
  --gray-mid: #e0e0e0;
  --border: #d0d0d0;
  --white: #ffffff;
  --bg: #ffffff;
  --bg-secondary: #f7f7f7;
}

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--black);
  min-height: 100vh;
}

/* ===== HEADER ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  height: 56px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
}

.left-section {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

#menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--black);
  font-size: 20px;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

#menu-btn:hover {
  background: var(--gray-light);
}

.logo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 18px;
  color: var(--black);
  white-space: nowrap;
}

.logo i {
  color: var(--red);
  font-size: 22px;
}

.center-section {
  flex: 1;
  max-width: 500px;
}

.search-bar {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
  height: 38px;
  background: var(--bg-secondary);
  transition: border-color 0.2s;
}

.search-bar:focus-within {
  border-color: var(--red);
  background: var(--white);
}

.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  padding: 0 14px;
  font-size: 14px;
  color: var(--black);
  min-width: 0;
}

.search-bar input::placeholder {
  color: var(--gray);
}

#search-btn {
  background: var(--red);
  border: none;
  color: #fff;
  width: 44px;
  height: 100%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background 0.15s;
  flex-shrink: 0;
}

#search-btn:hover {
  background: var(--red-dark);
}

.right-section {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 0 14px;
  height: 34px;
  font-size: 13px;
  font-weight: 500;
  color: var(--black);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.nav-link:hover {
  border-color: var(--red);
  color: var(--red);
}

.nav-link i {
  font-size: 16px;
}

.right-section button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--black);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background 0.15s;
}

.right-section button:hover {
  background: var(--gray-light);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* ===== CATEGORIES ===== */
.categories {
  width: 100%;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  overflow-x: auto;
  scrollbar-width: none;
}

.categories::-webkit-scrollbar {
  display: none;
}

.chip {
  background: var(--gray-mid);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--black);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.chip:hover {
  background: #c8c8c8;
}

.chip.active {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

/* ===== LAYOUT ===== */
.main-container {
  display: flex;
  min-height: calc(100vh - 108px);
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  padding: 12px 8px;
  border-right: 1px solid var(--border);
  background: var(--white);
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--black);
  text-decoration: none;
  margin-bottom: 2px;
  transition: background 0.15s, color 0.15s;
}

.sidebar a:hover {
  background: var(--gray-light);
}

.sidebar a.active {
  background: #fceaec;
  color: var(--red);
  font-weight: 600;
}

.sidebar a i {
  font-size: 18px;
}

.sidebar hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 10px 6px;
}

.sidebar-section {
  padding: 0 4px;
}

.sidebar-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--black);
  padding: 10px 14px 6px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-group {
  margin-bottom: 2px;
}

.filter-menu {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--black);
  cursor: pointer;
  list-style: none;
  transition: background 0.15s;
}

.filter-menu:hover {
  background: var(--gray-light);
}

.filter-menu::after {
  content: '\203A';
  font-size: 18px;
  color: #999;
  transition: transform 0.2s;
  display: inline-block;
}

details[open] > .filter-menu::after {
  transform: rotate(90deg);
}

.filter-options {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 2px 0;
}

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 14px 4px 28px;
  font-size: 13px;
  color: var(--black);
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s;
}

.filter-checkbox:hover {
  background: var(--gray-light);
}


/* ===== MAIN CONTENT ===== */
.content {
  flex: 1;
  padding: 20px 24px;
  min-width: 0;
}

/* ===== VIDEO GRID ===== */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

/* ===== VIDEO CARD ===== */
.video-card {
  cursor: pointer;
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.15s;
}

.video-card:hover {
  transform: translateY(-3px);
}

.video-card:hover .play-overlay {
  opacity: 1;
}

.thumbnail-wrapper {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--gray-light);
  border-radius: 8px;
  overflow: hidden;
}

.thumbnail-wrapper video,
.thumbnail-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.play-overlay {
  position: absolute;
  inset: 0;
  background: rgba(219, 53, 70, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}

.play-overlay i {
  font-size: 44px;
  color: #fff;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
}

.video-duration {
  position: absolute;
  bottom: 6px;
  right: 8px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.video-info {
  padding: 10px 4px;
}

.video-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--black);
  line-height: 1.4;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-meta {
  font-size: 12px;
  color: var(--gray);
}

.video-meta .channel-name {
  color: var(--red);
  font-weight: 600;
}

/* ===== PAGE DE VISIONNAGE (watch.html) ===== */
.watch-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.watch-left {
  flex: 1;
  min-width: 0;
}

.watch-right {
  width: 320px;
  flex-shrink: 0;
}

.video-player-wrapper {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  margin-bottom: 14px;
}

.video-player-wrapper video,
.video-player-wrapper iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
}

/* ===== Contrôles personnalisés du lecteur ===== */

.player-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  padding: 8px 12px 10px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.video-player-wrapper.controls-visible .player-controls {
  opacity: 1;
  transform: translateY(0);
}

.video-player-wrapper:not(.controls-visible) {
  cursor: none;
}

.progress-bar {
  position: relative;
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 3px;
  cursor: pointer;
  margin-bottom: 8px;
}

.progress-buffered {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 3px;
}

.progress-filled {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--red);
  border-radius: 3px;
}

.controls-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.control-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.control-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 4px;
}

.volume-slider {
  width: 80px;
  accent-color: var(--red);
}

.time-display {
  color: #fff;
  font-size: 13px;
  white-space: nowrap;
}

.controls-spacer {
  flex: 1;
}

.quality-menu {
  position: relative;
}

.quality-toggle {
  /* hérite de .control-btn */
}

.quality-dropdown {
  position: absolute;
  bottom: 46px;
  right: 0;
  background: rgba(28, 28, 28, 0.95);
  border-radius: 8px;
  overflow: hidden;
  min-width: 140px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.quality-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}

.quality-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.quality-option.active {
  color: var(--red);
  font-weight: 600;
}

.quality-fps {
  font-size: 12px;
  color: #aaa;
}

.video-title-large {
  font-size: 19px;
  font-weight: 700;
  color: var(--black);
  line-height: 1.4;
  margin-bottom: 6px;
}

.video-meta-large {
  font-size: 13px;
  color: var(--gray);
  margin-bottom: 14px;
}

/* ===== CHANNEL ROW ===== */
.channel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.channel-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.channel-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  overflow: hidden;
}

.channel-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.channel-name-large {
  font-size: 14px;
  font-weight: 700;
  color: var(--black);
}

.channel-subs {
  font-size: 12px;
  color: var(--gray);
}

.like-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--black);
  background: none;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.like-btn:hover {
  border-color: var(--red);
  color: var(--red);
}

.like-btn.liked {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

/* ===== DESCRIPTION ===== */
.description-box {
  font-size: 13px;
  color: var(--gray);
  line-height: 1.6;
  background: var(--gray-light);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 24px;
  white-space: pre-wrap;
}

/* ===== COMMENTAIRES ===== */
.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 14px;
}

.comment-form {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.comment-input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 9px 16px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
  background: var(--bg-secondary);
  color: var(--black);
}

.comment-input:focus {
  border-color: var(--red);
  background: var(--white);
}

.comment-submit {
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.comment-submit:hover {
  background: var(--red-dark);
}

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

.c-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gray-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  overflow: hidden;
}

.c-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.c-author {
  font-size: 13px;
  font-weight: 700;
  color: var(--black);
}

.c-date {
  font-size: 11px;
  font-weight: 400;
  color: #999;
  margin-left: 6px;
}

.c-text {
  font-size: 13px;
  color: var(--gray);
  margin-top: 2px;
  line-height: 1.5;
}

/* ===== COMMENTAIRES VERROUILLÉS (visiteurs / non-membres) ===== */
.comment-locked {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--gray-light);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--gray);
}

.comment-locked a {
  color: var(--red);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.comment-locked a:hover {
  text-decoration: underline;
}

/* ===== VIDEOS CONNEXES ===== */
.related-card {
  display: flex;
  gap: 10px;
  cursor: pointer;
  margin-bottom: 14px;
  border-radius: 8px;
  transition: background 0.15s;
  padding: 4px;
}

.related-card:hover {
  background: var(--gray-light);
}

.rel-thumb {
  width: 130px;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  background: var(--gray-mid);
}

.rel-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rel-dur {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
}

.rel-info {
  min-width: 0;
}

.rel-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--black);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}

.rel-meta {
  font-size: 11px;
  color: var(--gray);
}

/* ===== PAGES AUTH (connexion / inscription / profil) ===== */
.auth-page {
  display: flex;
  justify-content: center;
  padding: 50px 16px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.auth-title {
  font-size: 22px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.auth-title i {
  color: var(--red);
}

.auth-subtitle {
  font-size: 13px;
  color: var(--gray);
  margin-bottom: 20px;
}

.auth-card label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 14px 0 6px;
}

.auth-card input[type="text"],
.auth-card input[type="email"],
.auth-card input[type="password"] {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
  background: var(--bg-secondary);
  color: var(--black);
}

.auth-card input:focus {
  border-color: var(--red);
  background: var(--white);
}

.radio-group {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 400;
  margin: 0;
  cursor: pointer;
}

.radio-option input {
  width: auto;
  margin: 0;
}

.auth-btn {
  display: block;
  width: 100%;
  margin-top: 22px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background 0.15s;
}

.auth-btn:hover {
  background: var(--red-dark);
}

.auth-btn-secondary {
  background: var(--gray-mid);
  color: var(--black);
  margin-top: 14px;
  width: auto;
  display: inline-block;
  padding: 10px 18px;
}

.auth-btn-secondary:hover {
  background: #c8c8c8;
}

.auth-btn-danger {
  background: transparent;
  color: var(--red);
  border: 1.5px solid var(--red);
  margin-top: 24px;
}

.auth-btn-danger:hover {
  background: var(--red);
  color: #fff;
}

.auth-switch {
  text-align: center;
  font-size: 13px;
  color: var(--gray);
  margin-top: 18px;
}

.auth-switch a {
  color: var(--red);
  font-weight: 600;
  text-decoration: none;
}

.auth-switch a:hover {
  text-decoration: underline;
}

.auth-error {
  background: #fceaec;
  color: var(--red-dark);
  border: 1px solid var(--red);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

.auth-tabs {
  display: flex;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 20px;
}

.auth-tab {
  flex: 1;
  background: var(--bg-secondary);
  border: none;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--gray);
  transition: background 0.15s, color 0.15s;
}

.auth-tab.active {
  background: var(--red);
  color: #fff;
}

.auth-tab-content {
  display: none;
}

.auth-tab-content.active {
  display: block;
}

/* ===== PROFIL ===== */
.profile-avatar-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 20px;
}

.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  overflow: hidden;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.profile-info {
  background: var(--gray-light);
  border-radius: 10px;
  padding: 14px 16px;
  margin-top: 10px;
}

.profile-info p {
  font-size: 13px;
  color: var(--black);
  padding: 6px 0;
}

.profile-info p strong {
  color: var(--gray);
  font-weight: 600;
  margin-right: 6px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .center-section {
    max-width: 100%;
  }

  .nav-link span {
    display: none;
  }

  .video-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }

  .content {
    padding: 12px;
  }

  .watch-layout {
    flex-direction: column;
  }

  .watch-right {
    width: 100%;
  }

  .rel-thumb {
    width: 120px;
  }
}
