/* ========================================
   AubeVideo — Design YouTube-like
   Palette L'Aube Étoilée : bleu nuit + or aurore
======================================== */

:root {
  --bg: #0f0f0f;
  --bg-elev: #181818;
  --bg-hover: #272727;
  --bg-card: #1a1a1a;
  --text: #f1f1f1;
  --text-dim: #aaa;
  --text-muted: #717171;
  --border: #272727;
  --accent: #6f8fb3;      /* bleu acier doux (moins voyant que l'or) */
  --accent-hover: #88a4c4;
  --accent-dark: #56708f;
  --primary: #3a5f9e;     /* bleu nuit */
  --danger: #e54444;
  --radius: 12px;
  --sidebar-w: 240px;
  --topbar-h: 56px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--text); font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif; font-size: 14px; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, textarea, select {
  font-family: inherit; font-size: 14px;
  background: var(--bg-elev); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; }

/* ========= TOPBAR ========= */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h);
  background: var(--bg); display: flex; align-items: center;
  padding: 0 16px; gap: 16px; z-index: 100; border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: var(--sidebar-w); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  color: var(--text); transition: background .15s;
}
.icon-btn:hover { background: var(--bg-hover); }
.brand { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 20px; letter-spacing: -.3px; }
.brand-logo { width: 32px; height: 32px; }
.brand-text { color: var(--text); }
.brand-accent { color: var(--accent); }

.search-bar {
  flex: 1; max-width: 640px; height: 42px; display: flex; align-items: stretch;
  border: 1px solid var(--border); border-radius: 22px; overflow: hidden;
  background: var(--bg-elev);
  transition: border-color .15s, box-shadow .18s, background .15s;
}
.search-bar:focus-within {
  border-color: var(--accent);
  background: var(--bg);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 24%, transparent);
}
.search-bar input {
  flex: 1; background: transparent; border: 0; padding: 0 18px; color: var(--text); font-size: 15px;
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-bar button {
  width: 60px; background: var(--bg-hover); display: grid; place-items: center;
  border-left: 1px solid var(--border);
  color: var(--text-dim); transition: background .15s, color .15s;
}
.search-bar:focus-within button { color: var(--text); }
.search-bar button:hover { background: var(--border); color: var(--text); }

.topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.btn-upload, .btn-login {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 20px; font-weight: 600;
  background: var(--accent); color: #1a1a1a; transition: background .15s;
}
.btn-upload:hover, .btn-login:hover { background: var(--accent-hover); }

.user-menu { position: relative; }
.avatar-btn {
  width: 36px; height: 36px; border-radius: 50%; overflow: hidden;
}
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; }
.user-dropdown {
  display: none; position: absolute; top: 50px; right: 0; width: 280px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.5); padding: 8px 0; z-index: 1000;
}
.user-dropdown.open { display: block; }
.user-dropdown a { display: block; padding: 10px 16px; font-size: 14px; transition: background .12s; }
.user-dropdown a:hover { background: var(--bg-hover); }
.user-dropdown hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.user-info { display: flex; gap: 12px; padding: 12px 16px; align-items: center; }
.user-info img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.user-info .name { font-weight: 600; font-size: 15px; }
.user-info a { padding: 0; color: var(--accent); font-size: 13px; }

/* ========= SIDEBAR ========= */
.sidebar {
  position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--bg); overflow-y: auto; padding: 12px 8px; z-index: 50;
  border-right: 1px solid var(--border);
}
.sidebar nav { display: flex; flex-direction: column; }
.nav-item {
  display: flex; align-items: center; gap: 16px; padding: 10px 12px;
  border-radius: 10px; font-size: 14px; color: var(--text); transition: background .12s;
}
.nav-item:hover { background: var(--bg-hover); }
.nav-item.active { background: var(--bg-hover); font-weight: 600; }
.nav-item .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); opacity: .6; }
.nav-heading {
  padding: 12px 12px 6px; font-size: 13px; color: var(--text-dim); font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px;
}
.sidebar hr { border: 0; border-top: 1px solid var(--border); margin: 10px 0; }
.ecosystem a {
  display: block; padding: 6px 12px; color: var(--text-dim); font-size: 13px;
}
.ecosystem a:hover { color: var(--text); }

/* ========= MAIN ========= */
.main {
  margin-top: var(--topbar-h); margin-left: var(--sidebar-w);
  padding: 24px 24px 80px; min-height: calc(100vh - var(--topbar-h));
}

/* ========= CHIPS ========= */
.chips {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 16px;
  position: sticky; top: var(--topbar-h); background: var(--bg); z-index: 10;
  margin-bottom: 4px;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; padding: 7px 14px; border-radius: 8px;
  background: var(--bg-elev); color: var(--text); white-space: nowrap;
  font-size: 13px; font-weight: 500; transition: background .12s;
}
.chip:hover { background: var(--bg-hover); }
.chip.active { background: var(--text); color: var(--bg); }

/* ========= VIDEO GRID ========= */
.video-grid {
  display: grid; gap: 24px 16px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.video-card { display: flex; flex-direction: column; gap: 12px; }
.thumb-wrap {
  position: relative; aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden;
  background: var(--bg-elev);
}
.thumb { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.video-card:hover .thumb { transform: scale(1.03); }
.duration {
  position: absolute; bottom: 8px; right: 8px; background: rgba(0,0,0,.85);
  color: #fff; padding: 2px 6px; border-radius: 4px; font-size: 12px; font-weight: 500;
}
.card-body { display: flex; gap: 12px; }
.channel-pic img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.meta { flex: 1; min-width: 0; }
.card-title {
  display: block; font-size: 15px; font-weight: 600; color: var(--text);
  line-height: 1.3; max-height: 2.6em; overflow: hidden; margin-bottom: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.card-channel { color: var(--text-dim); font-size: 13px; display: block; }
.card-channel:hover { color: var(--text); }
.card-stats { color: var(--text-dim); font-size: 13px; display: flex; gap: 4px; flex-wrap: wrap; }

/* ========= WATCH PAGE ========= */
.watch-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 24px; max-width: 1800px;
}
@media (max-width: 1100px) { .watch-layout { grid-template-columns: 1fr; } }

.player-wrap {
  background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/9;
  margin-bottom: 16px;
}
#player { width: 100%; height: 100%; display: block; }
.video-title { font-size: 20px; font-weight: 700; margin-bottom: 12px; }

.video-actions-bar {
  display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between;
  align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border);
}
.channel-block { display: flex; align-items: center; gap: 12px; }
.avatar-md { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.channel-name { font-weight: 600; font-size: 15px; display: block; }
.subs-count { color: var(--text-dim); font-size: 13px; }

.btn-subscribe {
  background: var(--text); color: var(--bg); padding: 8px 16px; border-radius: 20px;
  font-weight: 600; font-size: 14px; transition: background .12s; margin-left: 12px;
}
.btn-subscribe:hover { background: var(--text-dim); }
.btn-subscribe.subscribed { background: var(--bg-hover); color: var(--text); }

.reactions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.like-group { display: flex; background: var(--bg-elev); border-radius: 20px; overflow: hidden; }
.like-group button {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
  color: var(--text); transition: background .12s;
}
.like-group button + button { border-left: 1px solid var(--border); }
.like-group button:hover { background: var(--bg-hover); }
.like-group button.active { color: var(--accent); }
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
  background: var(--bg-elev); border-radius: 20px; color: var(--text);
  font-size: 14px; font-weight: 500; transition: background .12s;
}
.chip-btn:hover { background: var(--bg-hover); }

.description-card {
  background: var(--bg-elev); border-radius: var(--radius); padding: 14px; margin: 16px 0;
}
.desc-meta {
  display: flex; gap: 12px; margin-bottom: 10px; font-size: 14px; flex-wrap: wrap;
  color: var(--text);
}
.cat-pill {
  background: var(--bg-hover); padding: 2px 10px; border-radius: 10px;
  font-size: 12px; color: var(--accent);
}
.desc-body { white-space: pre-wrap; word-break: break-word; font-size: 14px; }
.tags { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag { color: var(--primary); font-size: 13px; }

/* ========= COMMENTS ========= */
.comments-section { margin-top: 24px; }
.comments-section h3 { margin-bottom: 18px; font-size: 18px; }
.comment-form { display: flex; gap: 12px; margin-bottom: 24px; }
.avatar-sm { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.comment-input { flex: 1; }
.comment-input textarea {
  width: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--border);
  border-radius: 0; padding: 8px 0; color: var(--text); resize: none;
}
.comment-input textarea:focus { border-bottom-color: var(--text); }
.comment-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

.comments-list { display: flex; flex-direction: column; gap: 20px; }
.comment { display: flex; gap: 12px; }
.c-body { flex: 1; min-width: 0; }
.c-head { display: flex; gap: 8px; align-items: baseline; margin-bottom: 2px; }
.c-name { font-weight: 600; font-size: 13px; }
.c-time { color: var(--text-dim); font-size: 12px; }
.c-content { font-size: 14px; word-break: break-word; white-space: pre-wrap; }
.c-delete {
  margin-top: 6px; font-size: 12px; color: var(--text-dim);
}
.c-delete:hover { color: var(--danger); }
.login-prompt {
  display: block; padding: 12px; background: var(--bg-elev); border-radius: var(--radius);
  text-align: center; color: var(--text-dim); margin-bottom: 20px;
}

/* ========= SUGGESTIONS ========= */
.suggestions h3 { margin-bottom: 12px; font-size: 16px; }
.sug-card { display: flex; gap: 10px; margin-bottom: 10px; transition: background .12s; padding: 4px; border-radius: 8px; }
.sug-card:hover { background: var(--bg-elev); }
.sug-thumb {
  position: relative; flex: 0 0 168px; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden;
  background: var(--bg-elev);
}
.sug-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sug-info { flex: 1; min-width: 0; }
.sug-title {
  font-size: 14px; font-weight: 600; line-height: 1.3; margin-bottom: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sug-channel, .sug-stats { color: var(--text-dim); font-size: 12px; }

/* ========= BUTTONS ========= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 20px; font-weight: 600; font-size: 14px;
  transition: background .12s; cursor: pointer;
}
.btn-primary { background: var(--accent); color: #1a1a1a; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-ghost {
  padding: 8px 16px; background: transparent; color: var(--text);
  border-radius: 20px; font-weight: 500;
}
.btn-ghost:hover { background: var(--bg-hover); }
.btn-danger {
  padding: 6px 12px; background: transparent; color: var(--danger); border-radius: 6px;
}
.btn-danger:hover { background: rgba(229,68,68,.1); }
.btn-danger.small, .btn-ghost.small { padding: 4px 10px; font-size: 12px; }

/* ========= FORMS / UPLOAD ========= */
.container-narrow { max-width: 760px; margin: 0 auto; }
.container-narrow h1 { margin-bottom: 6px; }
.subtitle { color: var(--text-dim); margin-bottom: 24px; }

.upload-form { display: flex; flex-direction: column; gap: 20px; }
.dropzone {
  position: relative; border: 2px dashed var(--border); border-radius: 16px;
  padding: 60px 20px; text-align: center; transition: border-color .15s, background .15s;
  cursor: pointer; background: var(--bg-elev);
}
.dropzone:hover, .dropzone.hover { border-color: var(--accent); background: var(--bg-hover); }
.dropzone.has-file { border-style: solid; border-color: var(--accent); }
.dropzone input[type=file] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}
.dz-placeholder { color: var(--text-dim); pointer-events: none; }
.dz-placeholder svg { margin-bottom: 12px; color: var(--accent); }
.dz-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.dz-hint { font-size: 13px; }
.dz-selected { margin-top: 12px; color: var(--accent); font-weight: 500; }

.form-grid { display: flex; flex-direction: column; gap: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text-dim); }
.field small { color: var(--text-muted); font-size: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 12px; }

/* ========= AUTH ========= */
.auth-card {
  max-width: 420px; margin: 40px auto; padding: 36px 28px;
  background: var(--bg-elev); border-radius: 16px; border: 1px solid var(--border);
  text-align: center;
}
.auth-logo { width: 64px; height: 64px; margin: 0 auto 16px; }
.auth-card h1 { font-size: 22px; margin-bottom: 6px; }
.auth-sub { color: var(--text-dim); margin-bottom: 24px; font-size: 14px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; text-align: left; }
.auth-foot { margin-top: 20px; font-size: 13px; }
.auth-foot a { color: var(--accent); }

/* ========= FLASH ========= */
.flash-stack { position: fixed; top: 70px; right: 24px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.flash {
  padding: 10px 16px; border-radius: 8px; color: #fff; font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,.3); animation: slideIn .25s;
}
.flash-success { background: #2f7d3a; }
.flash-error { background: var(--danger); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ========= CHANNEL PROFILE ========= */
.channel-header { margin-bottom: 24px; }
.banner {
  height: 180px; background: linear-gradient(120deg, #1a2a4a, #3a5f9e 50%, #e8b84a);
  background-size: cover; background-position: center; border-radius: var(--radius);
}
.channel-info {
  display: flex; gap: 24px; padding: 20px 0; align-items: center; flex-wrap: wrap;
}
.channel-avatar {
  width: 120px; height: 120px; border-radius: 50%; object-fit: cover;
  border: 4px solid var(--bg);
}
.channel-meta h1 { font-size: 26px; margin-bottom: 4px; }
.channel-sub { color: var(--text-dim); font-size: 14px; display: flex; gap: 6px; flex-wrap: wrap; }
.channel-bio { margin-top: 8px; color: var(--text-dim); font-size: 14px; }
.channel-actions { margin-top: 12px; display: flex; gap: 8px; }

.section-h { font-size: 20px; margin: 24px 0 16px; }

/* ========= SEARCH ========= */
.search-head { margin-bottom: 16px; }
.channel-results { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.channel-result {
  display: flex; gap: 16px; padding: 12px; background: var(--bg-elev); border-radius: var(--radius);
  transition: background .12s;
}
.channel-result:hover { background: var(--bg-hover); }
.channel-result img { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; }
.cr-name { font-size: 18px; font-weight: 600; }
.cr-sub { color: var(--text-dim); font-size: 13px; margin: 2px 0 6px; }
.cr-bio { color: var(--text-dim); font-size: 13px; }

.search-list { display: flex; flex-direction: column; gap: 16px; }
.search-item { display: grid; grid-template-columns: 360px 1fr; gap: 16px; padding: 8px; border-radius: 8px; transition: background .12s; }
.search-item:hover { background: var(--bg-elev); }
@media (max-width: 800px) { .search-item { grid-template-columns: 1fr; } }
.si-thumb { position: relative; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; background: var(--bg-elev); }
.si-thumb img { width: 100%; height: 100%; object-fit: cover; }
.si-title { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.si-stats, .si-channel, .si-desc { color: var(--text-dim); font-size: 13px; margin-bottom: 6px; }
.si-channel { display: flex; align-items: center; gap: 8px; }
.si-channel img { width: 24px; height: 24px; border-radius: 50%; }
.empty { color: var(--text-dim); padding: 40px; text-align: center; }

/* ========= STUDIO ========= */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px; margin: 24px 0;
}
.stat-card { background: var(--bg-elev); padding: 20px; border-radius: var(--radius); }
.stat-label { color: var(--text-dim); font-size: 13px; margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--accent); }

.studio-actions { margin: 20px 0; }
.studio-table {
  width: 100%; border-collapse: collapse; background: var(--bg-elev);
  border-radius: var(--radius); overflow: hidden;
}
.studio-table th, .studio-table td {
  padding: 12px 14px; text-align: left; font-size: 13px;
}
.studio-table thead { background: var(--bg-hover); }
.studio-table th { font-weight: 600; color: var(--text-dim); }
.studio-table tbody tr { border-top: 1px solid var(--border); }
.studio-row { display: flex; gap: 12px; align-items: center; }
.studio-thumb { width: 120px; aspect-ratio: 16/9; object-fit: cover; border-radius: 6px; }
.studio-title { font-weight: 600; display: block; margin-bottom: 2px; }
.studio-desc { color: var(--text-dim); font-size: 12px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visibility-pill {
  font-size: 12px; padding: 3px 8px; border-radius: 10px; background: var(--bg-hover);
}
.vis-public { color: #64c864; }
.vis-private { color: var(--danger); }
.vis-unlisted { color: var(--accent); }

.avatar-editor { display: flex; gap: 20px; align-items: center; margin-bottom: 16px; }
.avatar-lg { width: 100px; height: 100px; border-radius: 50%; object-fit: cover; }

/* ========= EMPTY STATE ========= */
.empty-state {
  text-align: center; padding: 80px 20px; color: var(--text-dim);
}
.empty-state h2, .empty-state h3 { color: var(--text); margin-bottom: 8px; }
.empty-state p { margin-bottom: 20px; }

/* ========= MISC PROD ========= */
.logout-btn {
  display: block; width: 100%; text-align: left; padding: 10px 16px;
  background: none; color: var(--text); font: inherit; cursor: pointer;
  transition: background .12s;
}
.logout-btn:hover { background: var(--bg-hover); }

.load-more { display: grid; place-items: center; padding: 32px 0; }

.sub-list { display: flex; flex-direction: column; gap: 8px; }
.sub-row { display: flex; align-items: center; justify-content: space-between;
  padding: 12px; background: var(--bg-elev); border-radius: var(--radius);
  transition: background .12s; }
.sub-row:hover { background: var(--bg-hover); }
.sub-main { display: flex; gap: 14px; align-items: center; flex: 1; }
.sub-main img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.sub-name { font-weight: 600; }
.sub-meta, .sub-last { color: var(--text-dim); font-size: 13px; margin-top: 2px; }

/* Form-action styling for user-menu submenu */
.user-dropdown form { margin: 0; }

/* ========= SEARCH AUTOCOMPLETE ========= */
.search-wrap { position: relative; flex: 1; max-width: 640px; }
.search-suggest {
  display: none; position: absolute; top: 44px; left: 0; right: 0;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.5);
  z-index: 200; overflow: hidden;
}
.search-suggest.open { display: block; }
.ss-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  transition: background .12s; font-size: 14px;
}
.ss-item:hover, .ss-item.active { background: var(--bg-hover); }
.ss-icon { color: var(--accent); width: 20px; display: grid; place-items: center; flex: none; }
.ss-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-item strong { color: var(--text); font-weight: 700; }
.ss-search { font-weight: 500; }
.ss-video { padding: 8px 16px; }
.ss-thumb {
  width: 64px; height: 36px; border-radius: 6px; object-fit: cover;
  flex: none; background: var(--bg-card);
}
.search-suggest { max-height: 70vh; overflow-y: auto; }

/* ========= CHAPTERS ========= */
.chapters-list { margin-top: 12px; }
.chapters-list h4 { font-size: 14px; margin-bottom: 8px; color: var(--text-dim); }
.chapter {
  display: flex; gap: 12px; padding: 6px 10px; border-radius: 6px;
  text-align: left; width: 100%; transition: background .12s; color: var(--text);
}
.chapter:hover { background: var(--bg-hover); }
.ch-time { color: var(--accent); font-family: monospace; font-weight: 600; }
.ts-link { color: var(--accent); text-decoration: none; }
.ts-link:hover { text-decoration: underline; }

/* ========= QUALITY SELECTOR ========= */
.quality-selector {
  position: absolute; bottom: 60px; right: 12px;
}
.quality-selector .q-btn {
  background: rgba(0,0,0,.7); color: #fff; padding: 4px 10px;
  border-radius: 4px; font-size: 12px;
}
.quality-selector .q-menu {
  display: none; position: absolute; bottom: 32px; right: 0;
  background: rgba(0,0,0,.9); border-radius: 4px; padding: 4px 0;
  min-width: 90px;
}
.quality-selector.open .q-menu { display: block; }
.quality-selector .q-menu button {
  display: block; width: 100%; padding: 6px 12px;
  color: #fff; text-align: left; font-size: 12px;
}
.quality-selector .q-menu button:hover { background: var(--bg-hover); }

/* ========= PINNED + AUTHOR + HEART ========= */
.comment.pinned { background: rgba(232,184,74,.05); border-left: 3px solid var(--accent); padding-left: 8px; }
.pin-tag { font-size: 11px; color: var(--accent); margin-bottom: 4px; font-weight: 600; }
.author-tag { font-size: 10px; background: var(--primary); color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: 600; }
.heart-tag { color: var(--danger); font-size: 14px; }
.c-pin, .c-heart { color: var(--text-dim); }
.c-pin:hover, .c-heart:hover { color: var(--accent); }

/* ========= ANALYTICS CHART ========= */
.chart-card { background: var(--bg-elev); padding: 20px; border-radius: var(--radius); margin-bottom: 24px; }
.chart { display: block; }

/* ========= SHORTS ========= */
.shorts-feed {
  position: fixed; top: var(--topbar-h); left: var(--sidebar-w); right: 0;
  bottom: 0; overflow-y: scroll; scroll-snap-type: y mandatory;
  background: #000;
}
.short-slide {
  position: relative; height: calc(100vh - var(--topbar-h));
  scroll-snap-align: start; scroll-snap-stop: always;
  display: grid; place-items: center;
}
.short-slide video {
  max-height: 100%; max-width: 100%; object-fit: contain;
  aspect-ratio: 9/16; height: 100%;
}
.short-overlay {
  position: absolute; bottom: 0; left: 0; right: 0; padding: 20px;
  pointer-events: none;
}
.short-actions {
  position: absolute; right: 20px; bottom: 80px; display: flex;
  flex-direction: column; gap: 20px; pointer-events: auto;
}
.short-btn {
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255,255,255,.15); color: #fff;
  display: grid; place-items: center; font-size: 22px;
  position: relative; backdrop-filter: blur(8px);
}
.short-btn span { position: absolute; bottom: -20px; font-size: 12px; width: 100%; text-align: center; }
.short-btn:hover { background: rgba(255,255,255,.25); }
.short-btn.active { background: var(--accent); color: #000; }
.short-info {
  color: #fff; max-width: 70%; pointer-events: auto;
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
}
.short-channel { display: inline-flex; align-items: center; gap: 8px; color: #fff; }
.short-channel img { width: 32px; height: 32px; border-radius: 50%; }
.short-title { margin-top: 8px; font-size: 14px; max-width: 80%; }

/* ========= TIP JAR ========= */
.tip-btn { background: #ffd86b !important; color: #000 !important; font-weight: 700; }
.tip-amounts { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tip-amount { cursor: pointer; }
.tip-amount input { display: none; }
.tip-amount span {
  display: inline-block; padding: 12px 24px; border-radius: 12px;
  background: var(--bg-elev); font-weight: 700; transition: all .12s;
}
.tip-amount input:checked + span { background: var(--accent); color: #000; }

/* ========= 2FA ========= */
.twofa-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 16px; }
@media (max-width: 600px) { .twofa-grid { grid-template-columns: 1fr; } }
.qr-placeholder {
  background: var(--bg-elev); padding: 24px; border-radius: var(--radius);
  text-align: center; word-break: break-all;
}
.qr-placeholder a { display: inline-block; padding: 10px 20px; background: var(--accent); color: #000; border-radius: 8px; margin-bottom: 16px; }
.secret-text code {
  display: block; background: var(--bg); padding: 8px; border-radius: 4px;
  font-family: monospace; margin-top: 8px; word-break: break-all;
}

/* ========= NOTIFICATIONS ========= */
.notif-wrap { position: relative; }
.notif-btn { position: relative; }
.notif-btn .badge {
  position: absolute; top: 2px; right: 2px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px;
  display: grid; place-items: center;
}
.notif-dropdown {
  display: none; position: absolute; top: 50px; right: 0; width: 380px;
  max-height: 480px; background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.5); z-index: 1000;
  overflow: hidden; flex-direction: column;
}
.notif-dropdown.open { display: flex; }
.notif-head { display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--border); }
.link-btn { background: none; color: var(--accent); font-size: 12px; padding: 4px 8px; }
.link-btn:hover { text-decoration: underline; }
.notif-list { flex: 1; overflow-y: auto; }
.notif-item {
  display: block; padding: 10px 16px; font-size: 13px;
  border-bottom: 1px solid var(--border); transition: background .12s;
}
.notif-item:hover { background: var(--bg-hover); }
.notif-item.unread { background: rgba(232,184,74,.08); }
.notif-sub { color: var(--text-dim); font-size: 12px; margin-top: 2px; }
.notif-time { color: var(--text-muted); font-size: 11px; margin-top: 4px; }
.notif-empty { padding: 24px; text-align: center; color: var(--text-dim); }
.notif-foot { display: block; text-align: center; padding: 10px; color: var(--accent);
  border-top: 1px solid var(--border); font-size: 13px; }

.notif-page-list { display: flex; flex-direction: column; gap: 8px; }
.notif-page-item {
  display: flex; gap: 16px; padding: 14px;
  background: var(--bg-elev); border-radius: var(--radius);
  transition: background .12s;
}
.notif-page-item:hover { background: var(--bg-hover); }
.notif-page-item.unread { border-left: 3px solid var(--accent); }
.notif-icon { font-size: 24px; }
.notif-body { flex: 1; }

/* ========= REPLIES ========= */
.c-foot { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; align-items: center; }
.c-like, .c-reply, .c-report, .c-show-replies, .c-delete {
  font-size: 12px; color: var(--text-dim); padding: 4px 8px; border-radius: 12px;
  display: inline-flex; align-items: center; gap: 4px;
}
.c-like:hover, .c-reply:hover, .c-show-replies:hover { background: var(--bg-hover); color: var(--text); }
.c-like.active { color: var(--accent); }
.c-delete:hover { color: var(--danger); }
.c-show-replies { color: var(--primary); font-weight: 600; }
.reply-form { margin-top: 8px; }
.reply-form textarea { width: 100%; background: transparent;
  border: 0; border-bottom: 1px solid var(--border); padding: 8px 0; color: var(--text); resize: none; }
.replies { margin-top: 12px; display: flex; flex-direction: column; gap: 12px; padding-left: 20px; }
.comment.reply .avatar-sm { width: 30px; height: 30px; }

/* ========= MODAL ========= */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 2000;
  display: grid; place-items: center; padding: 20px;
}
.modal {
  background: var(--bg-elev); border-radius: 16px; padding: 24px;
  max-width: 480px; width: 100%; max-height: 80vh; overflow-y: auto;
}
.modal h3 { margin-bottom: 16px; }

/* ========= DIALOGUES (alert/confirm/prompt maison) ========= */
.modal.dialog {
  max-width: 400px; border: 1px solid var(--border); border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
  animation: dlgPop .16s ease;
}
@keyframes dlgPop {
  from { opacity: 0; transform: scale(.96) translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.dialog-msg { color: var(--text-dim); margin-bottom: 18px; line-height: 1.55; }
.btn-danger-solid { background: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: #c93636; }

/* ========= TOAST ========= */
.toast {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--bg-elev); color: var(--text);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 11px 22px; font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 30px rgba(0,0,0,.45);
  z-index: 3000; opacity: 0; transition: opacity .25s, transform .25s;
  max-width: min(90vw, 480px); text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.pl-check { display: flex; gap: 10px; align-items: center; padding: 8px 0; cursor: pointer; }
.pl-check input { margin: 0; }

/* ========= PLAYER THEATER + OVERLAY ========= */
.watch-layout.theater { grid-template-columns: 1fr !important; max-width: none; }
.watch-layout.theater .player-wrap { aspect-ratio: auto; max-height: 85vh; }
.watch-layout.theater #player { max-height: 85vh; }
.watch-layout.theater .suggestions { display: none; }

.player-wrap { position: relative; }
.player-overlay {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(0,0,0,.7); color: #fff; padding: 12px 24px;
  border-radius: 50px; font-size: 24px; font-weight: 700; pointer-events: none;
  opacity: 0; transition: opacity .4s;
}
.player-overlay.show { opacity: 1; animation: overlayFade .8s forwards; }
@keyframes overlayFade {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(.9); }
  40% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.2); }
}

/* ========= PROGRESS BAR UPLOAD ========= */
.progress-bar {
  position: relative; width: 100%; height: 28px; background: var(--bg-elev);
  border-radius: 14px; overflow: hidden; border: 1px solid var(--border);
}
.progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent));
  width: 0%; transition: width .2s;
}
.progress-label {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #fff; font-weight: 600; font-size: 13px;
}

/* ========= CHIP-BTN ACTIVE ========= */
.chip-btn.active { background: var(--accent); color: #1a1a1a; }

/* ========= TABS ========= */
.tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab {
  padding: 12px 4px; color: var(--text-dim); font-weight: 600;
  border-bottom: 2px solid transparent; transition: color .12s, border-color .12s;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab:hover { color: var(--text); }

.about-card { background: var(--bg-elev); padding: 20px; border-radius: var(--radius); max-width: 720px; }
.about-dl { display: grid; grid-template-columns: 200px 1fr; gap: 8px 20px; margin-top: 16px; }
.about-dl dt { color: var(--text-dim); }

/* ========= PLAYLISTS ========= */
.playlist-card-wrap { display: flex; flex-direction: column; gap: 8px; }
.playlist-card { background: var(--bg-elev); border-radius: var(--radius); padding: 16px; transition: background .12s; }
.playlist-card:hover { background: var(--bg-hover); }
.pl-thumb { font-size: 60px; text-align: center; padding: 20px; background: linear-gradient(135deg, #1a2a4a, #3a5f9e); border-radius: 8px; margin-bottom: 10px; }
.pl-title { font-weight: 600; margin-bottom: 4px; }
.pl-count { color: var(--text-dim); font-size: 13px; }

.playlist-header { display: flex; gap: 20px; background: var(--bg-elev); padding: 20px; border-radius: var(--radius); margin-bottom: 24px; align-items: center; }
.pl-thumb-lg { font-size: 100px; padding: 20px 40px; background: linear-gradient(135deg, #1a2a4a, #3a5f9e); border-radius: var(--radius); }
.playlist-list { list-style: none; padding: 0; }
.playlist-item { display: flex; gap: 12px; padding: 10px; border-radius: 8px; align-items: center; }
.playlist-item:hover { background: var(--bg-elev); }
.pl-num { width: 32px; text-align: center; color: var(--text-dim); font-weight: 600; }
.pl-video { flex: 1; display: flex; gap: 12px; }
.pl-video-thumb { position: relative; width: 160px; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; background: var(--bg-elev); flex-shrink: 0; }
.pl-video-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pl-video-info { flex: 1; }
.pl-video-title { font-weight: 600; margin-bottom: 4px; }
.pl-video-sub { color: var(--text-dim); font-size: 13px; }

/* ========= RESPONSIVE ========= */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .topbar-left { min-width: auto; }
}
@media (max-width: 600px) {
  .brand-text { display: none; }
  .main { padding: 16px; }
  .video-grid { grid-template-columns: 1fr; }
}

/* ========= CHAT DU DIRECT ========= */
.live-layout { grid-template-columns: minmax(0, 1fr) 360px; }
@media (max-width: 1100px) { .live-layout { grid-template-columns: 1fr; } }
.live-chat {
  display: flex; flex-direction: column; min-width: 0;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); height: min(72vh, 640px); overflow: hidden;
}
@media (max-width: 1100px) { .live-chat { height: 420px; margin-top: 16px; } }
.live-chat-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 600;
}
.live-chat-msgs {
  flex: 1; overflow-y: auto; padding: 10px 14px;
  display: flex; flex-direction: column; gap: 7px;
}
.chat-msg {
  position: relative; padding-right: 22px;
  font-size: 14px; line-height: 1.45; overflow-wrap: anywhere;
}
.chat-author { font-weight: 600; color: var(--accent); margin-right: 6px; }
.chat-author-owner { color: #e8b84a; }
.chat-author-owner::after { content: " ⭐"; font-size: 11px; }
.chat-del {
  position: absolute; right: 0; top: 0; font-size: 12px;
  color: var(--text-dim); opacity: 0; transition: opacity .15s;
}
.chat-msg:hover .chat-del { opacity: .85; }
.live-chat-form {
  display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border);
}
.live-chat-form input { flex: 1; min-width: 0; }
.live-chat-login {
  padding: 14px 16px; border-top: 1px solid var(--border);
  font-size: 14px; color: var(--text-dim);
}
