/* =====================================================
   NewTube — Style principal
   Clone YouTube en dark mode avec accent KCRP (orange Criker)
   ===================================================== */

:root {
    --bg:           #0f0f0f;
    --bg-elevated:  #212121;
    --bg-hover:     #272727;
    --bg-active:    #3f3f3f;
    --bg-input:     #121212;
    --bg-card:      #181818;

    --text:         #f1f1f1;
    --text-2:       #aaaaaa;
    --text-3:       #717171;

    --border:       #303030;
    --border-soft:  #272727;

    --accent:       #E8724A;          /* orange Criker */
    --accent-2:     #ff8a5b;
    --accent-d:     #c25a37;
    --accent-soft:  rgba(232,114,74,.15);

    --red:          #ff4d4d;
    --green:        #2ecc71;
    --blue:         #3ea6ff;

    --header-h:     56px;
    --sidebar-w:    240px;
    --sidebar-mini: 72px;

    --radius:       12px;
    --radius-sm:    8px;
    --radius-pill:  999px;

    --font: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; }
body { min-height: 100vh; -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; background: none; border: none; color: inherit; }
input, textarea, select { font-family: inherit; }
ul { list-style: none; padding: 0; margin: 0; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #444; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #666; }

/* ===================================================
   TOPBAR
   =================================================== */
.topbar {
    position: fixed; top: 0; left: 0; right: 0; height: var(--header-h);
    background: var(--bg);
    display: flex; align-items: center; gap: 16px;
    padding: 0 16px;
    z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 200px; }
.topbar-burger {
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.topbar-burger:hover { background: var(--bg-hover); }
.topbar-burger svg { width: 24px; height: 24px; }
.topbar-logo {
    display: flex; align-items: center; gap: 4px;
    font-size: 20px; font-weight: 700; letter-spacing: -0.5px;
}
.topbar-logo-text { font-weight: 700; font-size: 20px; }
.topbar-logo-text .accent { color: var(--accent); }

.topbar-center {
    flex: 1; display: flex; justify-content: center; align-items: center; gap: 8px;
    max-width: 720px; margin: 0 auto;
}
.search-form {
    flex: 1; display: flex; max-width: 600px; height: 40px;
}
.search-input {
    flex: 1; height: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0 16px;
    font-size: 16px;
    border-radius: 999px 0 0 999px;
    outline: none;
    transition: border-color .15s;
}
.search-input:focus { border-color: var(--accent); }
.search-btn {
    width: 64px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-left: none;
    border-radius: 0 999px 999px 0;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.search-btn:hover { background: var(--bg-hover); }
.search-btn svg { width: 24px; height: 24px; }

.topbar-right { display: flex; align-items: center; gap: 8px; min-width: 200px; justify-content: flex-end; }
.icon-btn {
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
    position: relative;
    flex-shrink: 0;
    padding: 0;
}
.icon-btn:hover { background: var(--bg-hover); }
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn.has-badge::after {
    content: attr(data-badge); position: absolute; top: 2px; right: 2px;
    background: var(--red); color: #fff; font-size: 10px; font-weight: 700;
    min-width: 16px; height: 16px; border-radius: 99px; padding: 0 4px;
    display: flex; align-items: center; justify-content: center;
}

.btn-upload-top {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 14px 8px 12px;
    border-radius: 999px;
    background: var(--bg-elevated);
    font-size: 14px; font-weight: 500;
    transition: background .15s;
}
.btn-upload-top:hover { background: var(--bg-hover); }
.btn-upload-top svg { width: 20px; height: 20px; }

.btn-signin {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--accent); font-weight: 600;
    transition: all .15s;
}
.btn-signin:hover { background: var(--accent-soft); }
.btn-signin svg { width: 22px; height: 22px; }

.avatar-btn { width: 32px; height: 32px; border-radius: 50%; overflow: hidden; flex-shrink: 0; display: block; aspect-ratio: 1 / 1; }
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ===================================================
   SIDEBAR
   =================================================== */
.sidebar {
    position: fixed; top: var(--header-h); left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--bg);
    overflow-y: auto; overflow-x: hidden;
    padding: 12px 0;
    z-index: 50;
    transition: width .2s;
}
.sidebar-section {
    padding: 12px 12px 8px;
    border-top: 1px solid var(--border);
}
.sidebar-section:first-of-type { border-top: none; }
.sidebar-section-title {
    font-size: 16px; font-weight: 500;
    color: var(--text); padding: 8px 12px;
}
.sidebar-link {
    display: flex; align-items: center; gap: 24px;
    padding: 8px 12px; border-radius: var(--radius-sm);
    font-size: 14px;
    transition: background .15s;
    white-space: nowrap;
}
.sidebar-link:hover { background: var(--bg-hover); }
.sidebar-link.active { background: var(--bg-active); font-weight: 500; }
.sidebar-link.active svg { fill: var(--accent); }
.sidebar-link svg { width: 24px; height: 24px; flex-shrink: 0; }
.sidebar-link .avatar-mini { width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; object-fit: cover; }
.sidebar-link .channel-name { overflow: hidden; text-overflow: ellipsis; }

.sidebar-empty {
    padding: 16px 12px; color: var(--text-2); font-size: 13px; line-height: 1.5;
}

/* Mini sidebar (collapsed) */
.sidebar.mini { width: var(--sidebar-mini); padding-top: 0; }
.sidebar.mini .sidebar-section { border-top: none; padding: 0; }
.sidebar.mini .sidebar-section-title,
.sidebar.mini .sidebar-link span:not(.icon),
.sidebar.mini .channel-name { display: none; }
.sidebar.mini .sidebar-link {
    flex-direction: column; gap: 6px;
    padding: 16px 0; margin: 0;
    border-radius: 0; font-size: 10px;
    text-align: center; align-items: center;
}
.sidebar.mini .sidebar-link.label-keep span:not(.icon) {
    display: block; font-size: 10px;
}
.sidebar.mini .sidebar-link:hover { background: var(--bg-hover); }

/* ===================================================
   LAYOUT
   =================================================== */
.layout { padding-top: var(--header-h); }
.main {
    margin-left: var(--sidebar-w);
    padding: 24px 40px;
    padding-top: calc(var(--header-h) + 24px);
    min-height: 100vh;
}
.main.sidebar-mini { margin-left: var(--sidebar-mini); }
.main.no-sidebar { margin-left: 0; }

@media (max-width: 1312px) {
    .main { padding: 24px 24px; padding-top: calc(var(--header-h) + 24px); }
}
@media (max-width: 1010px) {
    .sidebar { width: var(--sidebar-mini); padding-top: 0; }
    .sidebar .sidebar-section { border-top: none; padding: 0; }
    .sidebar .sidebar-section-title,
    .sidebar .sidebar-link span:not(.icon),
    .sidebar .channel-name { display: none; }
    .sidebar .sidebar-link {
        flex-direction: column; gap: 6px;
        padding: 16px 0; font-size: 10px; align-items: center;
    }
    .main { margin-left: var(--sidebar-mini); }
}
@media (max-width: 768px) {
    /* Sidebar: slide-in overlay instead of hidden */
    .sidebar {
        display: block;
        width: var(--sidebar-w);
        transform: translateX(-100%);
        transition: transform .25s ease;
        z-index: 51;
        padding: 12px 0;
    }
    .sidebar.mobile-open { transform: translateX(0); }
    /* Reset mini-sidebar styles */
    .sidebar .sidebar-section { border-top: 1px solid var(--border); padding: 12px 12px 8px; }
    .sidebar .sidebar-section:first-of-type { border-top: none; }
    .sidebar .sidebar-section-title { display: block; }
    .sidebar .sidebar-link { flex-direction: row; gap: 24px; padding: 8px 12px; font-size: 14px; align-items: center; }
    .sidebar .sidebar-link span:not(.icon), .sidebar .channel-name { display: block; }

    .main { margin-left: 0; padding: 16px; padding-top: calc(var(--header-h) + 16px); }
    .topbar-left { min-width: auto; }
    .topbar-right { min-width: auto; }
    .btn-upload-top span, .btn-signin span { display: none; }
    .btn-upload-top { padding: 8px; border-radius: 50%; width: 40px; height: 40px; justify-content: center; }
    .btn-signin { padding: 7px; border-radius: 50%; width: 40px; height: 40px; justify-content: center; }
}

/* Sidebar overlay */
#sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 49;
}
#sidebar-overlay.is-open { display: block; }

/* Mobile search icon (shown only < 600px) */
#topbar-search-mobile { display: none; }

@media (max-width: 600px) {
    .topbar-center { display: none; }
    #topbar-search-mobile { display: flex; }
    /* Dropdowns: full-width on phone */
    #account-dropdown { right: 8px !important; left: 8px; min-width: 0 !important; }
    #notif-dropdown { right: 8px !important; left: 8px; min-width: 0 !important; max-width: none !important; width: calc(100vw - 16px); }
}

/* ===================================================
   CHIPS (filtres horizontaux)
   =================================================== */
.chips-bar {
    display: flex; gap: 12px;
    overflow-x: auto;
    padding: 12px 0 24px;
    margin-bottom: 4px;
    position: sticky; top: var(--header-h); z-index: 30;
    background: var(--bg);
    scrollbar-width: none;
}
.chips-bar::-webkit-scrollbar { display: none; }
.chip {
    background: var(--bg-elevated);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px; font-weight: 500;
    white-space: nowrap;
    transition: background .15s;
    border: 1px solid transparent;
}
.chip:hover { background: var(--bg-hover); }
.chip.active { background: var(--text); color: var(--bg); }

/* ===================================================
   GRILLE DE VIDÉOS
   =================================================== */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 16px 16px;
    row-gap: 40px;
}
@media (max-width: 480px) {
    .video-grid { grid-template-columns: 1fr; row-gap: 24px; }
}

.video-card { display: flex; flex-direction: column; gap: 12px; cursor: pointer; }
.video-card-thumb {
    position: relative; aspect-ratio: 16/9;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
}
.video-card-thumb img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform .3s, border-radius .15s;
}
.video-card:hover .video-card-thumb img { border-radius: 0; }
.video-card-duration {
    position: absolute; bottom: 8px; right: 8px;
    background: rgba(0,0,0,0.85);
    color: #fff; font-size: 12px; font-weight: 500;
    padding: 2px 4px; border-radius: 4px;
}
.video-card-info { display: flex; gap: 12px; padding: 0 4px; }
.video-card-avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; overflow: hidden; }
.video-card-avatar img { width: 100%; height: 100%; object-fit: cover; }
.video-card-meta { flex: 1; min-width: 0; }
.video-card-title {
    font-size: 14px; font-weight: 500; color: var(--text);
    line-height: 1.4; margin: 0 0 4px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.video-card-channel,
.video-card-stats {
    font-size: 12px; color: var(--text-2); line-height: 1.4;
}
.video-card-channel:hover { color: var(--text); }

.video-card-menu {
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity .15s;
    border-radius: 50%;
}
.video-card:hover .video-card-menu { opacity: 1; }
.video-card-menu:hover { background: var(--bg-hover); }

/* Card horizontale (search/history/related) */
.video-card-h {
    display: grid; grid-template-columns: 360px 1fr;
    gap: 16px; cursor: pointer;
}
.video-card-h .video-card-thumb { aspect-ratio: 16/9; }
.video-card-h .video-card-title {
    font-size: 18px; font-weight: 400; -webkit-line-clamp: 2;
}
.video-card-h .video-card-info { padding: 0; flex-direction: column; gap: 8px; }
.video-card-h .video-card-meta { display: flex; flex-direction: column; gap: 6px; }
.video-card-h .video-card-desc {
    font-size: 12px; color: var(--text-2); line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.video-card-h .channel-row {
    display: flex; align-items: center; gap: 8px;
    margin: 8px 0;
}
.video-card-h .channel-row img { width: 24px; height: 24px; border-radius: 50%; }
@media (max-width: 768px) {
    .video-card-h { grid-template-columns: 1fr; }
    .video-card-h .video-card-title { font-size: 16px; }
}

/* ===================================================
   WATCH PAGE
   =================================================== */
.watch-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 402px;
    gap: 24px;
    max-width: 1736px;
    margin: 0 auto;
}
.watch-main {}
.watch-aside {}

@media (max-width: 1095px) {
    .watch-layout { grid-template-columns: 1fr; }
}

.video-player {
    aspect-ratio: 16/9;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    margin-bottom: 12px;
}
.video-player iframe { width: 100%; height: 100%; border: 0; }

/* ── Overlay pub ── */
#ad-overlay {
    position: absolute; inset: 0;
    background: #000; z-index: 10;
}
#ad-video-wrap { width: 100%; height: 100%; }
#ad-video-wrap video { width: 100%; height: 100%; object-fit: contain; display: block; }
#ad-click-area { position: absolute; inset: 0 0 48px 0; cursor: pointer; z-index: 11; }
#ad-controls {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 48px;
    display: flex; align-items: center; gap: 4px;
    padding: 0 8px;
    background: linear-gradient(transparent, rgba(0,0,0,.8));
    z-index: 12;
}
#ad-controls button {
    background: none; border: none; color: #fff;
    width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; cursor: pointer; flex-shrink: 0;
    opacity: .9; transition: opacity .15s;
}
#ad-controls button:hover { opacity: 1; background: rgba(255,255,255,.1); }
#ad-controls button svg { width: 20px; height: 20px; }
#ad-volume {
    width: 80px; height: 4px; cursor: pointer;
    accent-color: #fff; flex-shrink: 0;
}
.ad-label-pill {
    margin-left: auto;
    background: rgba(255,255,255,.15); color: #fff;
    font-size: 11px; font-weight: 600; letter-spacing: .5px;
    padding: 3px 8px; border-radius: 4px;
}
#ad-ui {
    position: absolute; top: 12px; right: 12px;
    z-index: 13;
}
#ad-skip {
    background: rgba(0,0,0,.7); color: rgba(255,255,255,.7);
    font-size: 13px; font-weight: 500; padding: 6px 14px;
    border-radius: 4px; border: 1px solid rgba(255,255,255,.2);
    cursor: default; white-space: nowrap;
    transition: background .2s, color .2s, border-color .2s;
}
#ad-skip:not([disabled]) {
    background: rgba(255,255,255,.92); color: #000;
    border-color: transparent; cursor: pointer; font-weight: 600;
}
#ad-skip:not([disabled]):hover { background: #fff; }

.watch-title {
    font-size: 20px; font-weight: 600;
    margin: 12px 0 8px;
    line-height: 1.4;
}

.watch-actions {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px;
    margin-bottom: 12px;
}
.watch-channel-row { display: flex; align-items: center; gap: 12px; }
.watch-channel-row .ch-avatar {
    width: 40px; height: 40px; border-radius: 50%; overflow: hidden;
}
.watch-channel-row .ch-avatar img { width: 100%; height: 100%; object-fit: cover; }
.watch-channel-info .ch-name { font-size: 16px; font-weight: 500; color: var(--text); }
.watch-channel-info .ch-subs { font-size: 12px; color: var(--text-2); }

.watch-actions-right { display: flex; gap: 8px; flex-wrap: wrap; }

.btn-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 16px;
    background: var(--bg-elevated);
    border-radius: 999px;
    font-size: 14px; font-weight: 500;
    transition: background .15s;
    white-space: nowrap;
}
.btn-pill:hover { background: var(--bg-hover); }
.btn-pill svg { width: 20px; height: 20px; }
.btn-pill.is-active { background: var(--bg-active); }
.btn-pill.is-active svg { fill: var(--accent); }

.btn-subscribe {
    background: var(--text); color: var(--bg);
    padding: 9px 16px; border-radius: 999px;
    font-size: 14px; font-weight: 600;
    transition: background .15s;
    flex-shrink: 0; white-space: nowrap;
}
.btn-subscribe:hover { background: #d4d4d4; }
.btn-subscribe.is-subscribed { background: var(--bg-elevated); color: var(--text); }
.btn-subscribe.is-subscribed:hover { background: var(--bg-hover); }

/* Pill groupé like/dislike */
.like-group {
    display: flex; background: var(--bg-elevated);
    border-radius: 999px; overflow: hidden;
}
.like-group .btn-pill { background: transparent; border-radius: 0; }
.like-group .btn-pill:hover { background: var(--bg-hover); }
.like-group .divider { width: 1px; background: var(--border); margin: 6px 0; }

/* Description */
.watch-description {
    background: var(--bg-elevated);
    border-radius: var(--radius);
    padding: 12px;
    margin: 12px 0;
    font-size: 14px; line-height: 1.4;
}
.watch-desc-meta {
    font-weight: 600; font-size: 14px; margin-bottom: 8px;
    color: var(--text);
}
.watch-desc-body {
    white-space: pre-wrap;
    max-height: 60px; overflow: hidden;
    position: relative;
    transition: max-height .3s;
}
.watch-description.expanded .watch-desc-body { max-height: none; }
.watch-description .expand-btn {
    margin-top: 8px; font-weight: 600; color: var(--text);
}

/* ===================================================
   COMMENTAIRES
   =================================================== */
.comments-section { margin-top: 24px; }
.comments-header {
    display: flex; align-items: center; gap: 32px;
    margin-bottom: 24px;
}
.comments-count { font-size: 20px; font-weight: 600; }
.comments-sort {
    display: flex; align-items: center; gap: 8px;
    cursor: pointer;
}
.comments-sort svg { width: 24px; height: 24px; }

.comment-form { display: flex; gap: 12px; margin-bottom: 24px; }
.comment-form .avatar-mini { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.comment-form .form-body { flex: 1; }
.comment-form textarea {
    width: 100%; background: transparent; color: var(--text);
    border: none; border-bottom: 1px solid var(--border);
    padding: 8px 0; font-size: 14px; resize: none; outline: none;
    transition: border-color .15s;
}
.comment-form textarea:focus { border-bottom-color: var(--text); }
.comment-form-actions {
    display: flex; justify-content: flex-end; gap: 8px;
    margin-top: 8px;
}

.comment { display: flex; gap: 12px; margin-bottom: 16px; }
.comment .avatar-mini {
    width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
    overflow: hidden;
}
.comment .avatar-mini img { width: 100%; height: 100%; object-fit: cover; }
.comment-body { flex: 1; min-width: 0; }
.comment-meta {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; margin-bottom: 4px;
}
.comment-author { font-weight: 500; color: var(--text); }
.comment-time { color: var(--text-2); font-size: 12px; }
.comment-text {
    font-size: 14px; line-height: 1.4;
    white-space: pre-wrap; word-wrap: break-word;
}
.comment-actions {
    display: flex; align-items: center; gap: 8px;
    margin-top: 8px;
}
.comment-action {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 8px; border-radius: 999px;
    color: var(--text-2); font-size: 12px;
    transition: background .15s;
}
.comment-action:hover { background: var(--bg-hover); color: var(--text); }
.comment-action svg { width: 16px; height: 16px; }
.comment-action.is-liked { color: var(--accent); }
.comment-replies-toggle {
    color: var(--blue); font-size: 13px; font-weight: 500;
    padding: 6px 12px; border-radius: 999px;
    margin-top: 8px;
}
.comment-replies-toggle:hover { background: rgba(62,166,255,.1); }
.comment-replies { margin-top: 12px; padding-left: 0; }

/* ===================================================
   ASIDE (related videos)
   =================================================== */
.aside-video {
    display: grid; grid-template-columns: 168px 1fr;
    gap: 8px; margin-bottom: 8px; cursor: pointer;
    padding: 4px; border-radius: var(--radius-sm);
    transition: background .15s;
}
.aside-video:hover { background: var(--bg-card); }
.aside-video .video-card-thumb { aspect-ratio: 16/9; border-radius: var(--radius-sm); }
.aside-video-title {
    font-size: 14px; font-weight: 500; color: var(--text);
    line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}
.aside-video-meta { font-size: 12px; color: var(--text-2); line-height: 1.4; }

/* ===================================================
   CHANNEL PAGE
   =================================================== */
.channel-banner {
    width: 100%; aspect-ratio: 6.2/1;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--accent-d), var(--accent));
    background-size: cover; background-position: center;
    margin-bottom: 24px;
    overflow: hidden;
}
.channel-banner img { width: 100%; height: 100%; object-fit: cover; }
.channel-header { display: flex; align-items: center; gap: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.channel-avatar {
    width: 128px; height: 128px; border-radius: 50%;
    overflow: hidden; flex-shrink: 0;
}
.channel-avatar img { width: 100%; height: 100%; object-fit: cover; }
.channel-meta { flex: 1; }
.channel-name { font-size: 36px; font-weight: 700; margin: 0 0 8px; }
.channel-stats {
    display: flex; gap: 6px; flex-wrap: wrap;
    color: var(--text-2); font-size: 14px; margin-bottom: 12px;
}
.channel-stats > * { white-space: nowrap; }
.channel-handle { color: var(--text); font-weight: 500; }
.channel-bio { color: var(--text-2); font-size: 14px; line-height: 1.4; max-width: 600px; }
.channel-tabs { display: flex; gap: 32px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.channel-tab {
    padding: 16px 0;
    color: var(--text-2); font-size: 14px; font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.5px;
    border-bottom: 2px solid transparent;
    transition: color .15s, border-color .15s;
}
.channel-tab:hover { color: var(--text); }
.channel-tab.active { color: var(--text); border-bottom-color: var(--text); }

@media (max-width: 600px) {
    .channel-header { flex-direction: column; text-align: center; gap: 12px; }
    .channel-avatar { width: 80px; height: 80px; }
    .channel-name { font-size: 24px; }
    .channel-tabs { overflow-x: auto; }
}

/* ── Gestion vidéos (onglet Gérer) ── */
.manage-list { display: flex; flex-direction: column; gap: 2px; }
.manage-row {
    display: flex; align-items: center; gap: 16px;
    padding: 10px 12px; border-radius: var(--radius);
    transition: background .15s;
}
.manage-row:hover { background: var(--surface-2); }
.manage-thumb {
    position: relative; flex-shrink: 0;
    width: 140px; height: 79px; border-radius: 6px; overflow: hidden; background: var(--surface-2);
}
.manage-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.manage-badge-short {
    position: absolute; bottom: 4px; right: 4px;
    background: rgba(0,0,0,.8); color: #fff;
    font-size: 10px; font-weight: 700; padding: 2px 5px; border-radius: 3px;
}
.manage-info { flex: 1; min-width: 0; }
.manage-title {
    font-size: 14px; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-bottom: 4px;
}
.manage-meta { font-size: 12px; color: var(--text-2); }
.manage-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.manage-visibility-select {
    background: #1e1e1e; color: #e8e8e8;
    border: 1px solid var(--border); border-radius: 6px;
    padding: 6px 10px; font-size: 13px; cursor: pointer;
    color-scheme: dark;
}
.manage-delete-btn { padding: 6px 10px; color: var(--text-2); }
.manage-delete-btn:hover { color: var(--red); background: rgba(var(--red-rgb, 239,68,68),.1); }

/* ===================================================
   SHORTS
   =================================================== */
.shorts-feed {
    display: flex; flex-direction: column;
    align-items: center; gap: 24px;
    padding: 16px 0;
    scroll-snap-type: y mandatory;
    overflow-y: auto;
    height: calc(100vh - var(--header-h) - 32px);
}

/* Wrapper : card + boutons côte à côte */
.short-wrap {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    scroll-snap-align: center;
    flex-shrink: 0;
}

.short-card {
    width: min(405px, 56vw);
    aspect-ratio: 9/16;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;        /* clipping only inside the card */
    position: relative;
    flex-shrink: 0;
}
.short-card iframe { width: 100%; height: 100%; border: 0; }

/* Carte pub shorts */
.short-ad-card { display: flex; align-items: center; justify-content: center; background: #0a0a0a; }
.short-ad-loading { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.short-ad-content { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.short-ad-content video { width: 100%; height: 100%; object-fit: contain; display: block; }
.short-ad-label {
    position: absolute; top: 12px; left: 12px;
    background: rgba(0,0,0,.65); color: #fff;
    font-size: 11px; font-weight: 600; letter-spacing: .4px;
    padding: 3px 8px; border-radius: 3px;
    pointer-events: none;
}
.short-ad-skip {
    position: absolute; bottom: 16px; right: 12px;
    background: rgba(255,255,255,.9); color: #000;
    font-size: 13px; font-weight: 600;
    padding: 6px 14px; border-radius: 4px;
    display: flex; align-items: center; gap: 6px;
    cursor: pointer; transition: background .15s;
}
.short-ad-skip svg { width: 18px; height: 18px; }
.short-ad-skip:hover { background: #fff; }

/* Boutons : sibling du card, pas à l'intérieur */
.short-actions {
    display: flex; flex-direction: column; gap: 16px;
    align-items: center;
    padding-bottom: 70px;   /* aligne avec le bas du meta */
}

@media (max-width: 600px) {
    .short-wrap { flex-direction: column; align-items: center; gap: 0; }
    .short-card { width: 100%; max-width: 100%; }
    /* Sur mobile : boutons flottants par-dessus la vidéo */
    .short-actions {
        position: absolute; right: 8px; bottom: 80px;
        padding-bottom: 0;
    }
    .short-wrap { position: relative; }
}

.short-action {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    color: var(--text); font-size: 12px;
}
.short-action-btn {
    width: 48px; height: 48px; border-radius: 50%;
    background: var(--bg-elevated);
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
    border: 1px solid var(--border);
}
.short-action-btn:hover { background: var(--bg-hover); }
.short-action-btn svg { width: 24px; height: 24px; }
.short-action.is-active .short-action-btn { background: var(--accent-soft); border-color: var(--accent); }
.short-action.is-active .short-action-btn svg { fill: var(--accent); }

.short-meta {
    position: absolute; bottom: 16px; left: 16px; right: 16px;
    color: #fff;
}
.short-meta-channel {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 8px;
}
.short-meta-channel img {
    width: 32px; height: 32px; border-radius: 50%;
    border: 1px solid #fff;
}
.short-meta-channel .handle { font-weight: 600; }
.short-meta-channel .subscribe-mini {
    margin-left: 8px;
    padding: 6px 12px;
    background: #fff; color: #000;
    border-radius: 999px; font-size: 12px; font-weight: 600;
}
.short-meta-title {
    font-size: 14px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===================================================
   FORMS
   =================================================== */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block; font-size: 13px; font-weight: 500;
    margin-bottom: 6px; color: var(--text-2);
}
.form-input, .form-textarea, .form-select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 14px;
    font-size: 14px;
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color .15s;
}
.form-input:focus, .form-textarea:focus, .form-select:focus { border-color: var(--accent); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-help { font-size: 12px; color: var(--text-3); margin-top: 4px; }

.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 14px; font-weight: 600;
    transition: all .15s;
    cursor: pointer;
    border: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-2); }
.btn-secondary { background: var(--bg-elevated); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-hover); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { color: var(--text); background: var(--bg-hover); }
.btn-danger { background: rgba(255,77,77,0.15); color: var(--red); }
.btn-danger:hover:not(:disabled) { background: rgba(255,77,77,0.25); }

/* ===================================================
   MODALES
   =================================================== */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.75);
    z-index: 1000;
    display: none;
    align-items: center; justify-content: center;
    padding: 24px;
    backdrop-filter: blur(4px);
    animation: backdropIn .2s ease;
}
.modal-backdrop.is-open { display: flex; }
@keyframes backdropIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }

.modal {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%; max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 16px 48px rgba(0,0,0,0.5);
    animation: modalIn .25s cubic-bezier(.16,1,.3,1);
}
.modal.modal-lg { max-width: 720px; }
.modal.modal-sm { max-width: 380px; }
@keyframes modalIn {
    from { opacity: 0; transform: translateY(20px) scale(.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 18px; font-weight: 500; margin: 0; }
.modal-close {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.modal-close:hover { background: var(--bg-hover); }
.modal-close svg { width: 24px; height: 24px; }
.modal-body { padding: 20px; }
.modal-footer {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

/* Modale upload preview */
.upload-preview {
    aspect-ratio: 16/9;
    background: var(--bg);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}
.upload-preview img { width: 100%; height: 100%; object-fit: cover; }
.upload-preview-empty {
    width: 100%; height: 100%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 12px;
    color: var(--text-3);
}
.upload-preview-empty svg { width: 64px; height: 64px; }

/* Modale "Ajouter à playlist" */
.playlist-pick-list {
    max-height: 280px; overflow-y: auto;
    margin: 0 -20px; padding: 0 20px;
}
.playlist-pick {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 0;
    cursor: pointer;
}
.playlist-pick:hover { background: var(--bg-hover); margin: 0 -20px; padding: 10px 20px; }
.playlist-pick-icon { width: 24px; height: 24px; }
.playlist-pick-name { flex: 1; font-size: 14px; }
.playlist-pick-visibility { font-size: 12px; color: var(--text-2); }

/* Modale partage */
.share-link-row {
    display: flex; gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 4px 4px 14px;
    margin-top: 16px;
}
.share-link-row input {
    flex: 1; background: transparent; border: none;
    color: var(--text); outline: none; font-size: 14px;
}
.share-options {
    display: flex; gap: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
}
.share-option {
    display: flex; flex-direction: column;
    align-items: center; gap: 6px;
    font-size: 12px;
    color: var(--text-2);
    flex-shrink: 0;
}
.share-option-icon {
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--bg-card);
    display: flex; align-items: center; justify-content: center;
    transition: transform .15s;
}
.share-option:hover .share-option-icon { transform: scale(1.05); }
.share-option-icon svg { width: 28px; height: 28px; }

/* ===================================================
   DROPDOWN MENU (account, actions)
   =================================================== */
.dropdown {
    position: absolute; top: calc(100% + 8px); right: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    min-width: 240px;
    padding: 8px 0;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 200;
    display: none;
}
.dropdown.is-open { display: block; animation: modalIn .15s; }
.dropdown-item {
    display: flex; align-items: center; gap: 16px;
    padding: 10px 16px;
    font-size: 14px;
    transition: background .15s;
    cursor: pointer;
}
.dropdown-item:hover { background: var(--bg-hover); }
.dropdown-item svg { width: 20px; height: 20px; }
.dropdown-divider { height: 1px; background: var(--border); margin: 8px 0; }
.dropdown-header {
    padding: 12px 16px;
    display: flex; align-items: center; gap: 12px;
}
.dropdown-header .avatar-mini { width: 40px; height: 40px; border-radius: 50%; }
.dropdown-header .name { font-size: 16px; font-weight: 500; }
.dropdown-header .handle { font-size: 13px; color: var(--text-2); }
.channel-switch-item { gap: 10px; }
.channel-switch-item.is-active-channel { background: var(--bg-hover); }

/* ===================================================
   TOAST
   =================================================== */
.toast-container {
    position: fixed; bottom: 20px; left: 20px;
    z-index: 2000;
    display: flex; flex-direction: column-reverse; gap: 8px;
    pointer-events: none;
    max-width: calc(100vw - 40px);
}
.toast {
    background: #1f1f1f;
    color: #fff;
    padding: 14px 18px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: .1px;
    line-height: 1.35;
    box-shadow: 0 2px 10px rgba(0,0,0,.45);
    animation: toastIn .22s cubic-bezier(.2, 0, 0, 1);
    pointer-events: auto;
    max-width: 380px;
}
.toast.toast-error   { background: #c4302b; }
.toast.toast-success { background: #1f1f1f; }
.toast.toast-info    { background: #1f1f1f; }
@keyframes toastIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@media (max-width: 600px) {
    .toast-container { left: 12px; right: 12px; bottom: 12px; }
    .toast { max-width: none; }
}

/* ===================================================
   ÉTAT VIDE
   =================================================== */
.empty-state {
    text-align: center; padding: 80px 24px;
    color: var(--text-2);
}
.empty-state-icon {
    width: 72px; height: 72px; margin: 0 auto 16px;
    color: var(--text-3);
}
.empty-state h2 { font-size: 20px; font-weight: 500; color: var(--text); margin: 0 0 8px; }
.empty-state p { margin: 0 0 16px; font-size: 14px; }

/* ===================================================
   PAGE HEADERS
   =================================================== */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.page-title {
    font-size: 28px; font-weight: 700; margin: 0;
}
.page-actions { display: flex; gap: 8px; }

/* ===================================================
   LOGIN PAGE
   =================================================== */
.login-wrap {
    min-height: calc(100vh - var(--header-h));
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
}
.login-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    max-width: 420px; width: 100%;
    text-align: center;
}
.login-card .logo-big {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 28px; font-weight: 700;
    margin-bottom: 8px;
}
.login-card .logo-big .topbar-logo-icon { width: 40px; height: 28px; }
.login-card h1 { font-size: 24px; font-weight: 500; margin: 8px 0; }
.login-card p { color: var(--text-2); margin: 0 0 24px; }
.btn-criker {
    width: 100%; padding: 14px;
    background: var(--accent); color: #fff;
    font-weight: 600; border-radius: var(--radius-sm);
    font-size: 15px;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    transition: background .15s;
}
.btn-criker:hover { background: var(--accent-2); }
.btn-dev {
    width: 100%; margin-top: 12px;
    padding: 14px;
    background: var(--bg-card); color: var(--text);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
}
.btn-dev:hover { background: var(--bg-hover); }

/* ===================================================
   ALERTS
   =================================================== */
.alert {
    padding: 12px 16px; border-radius: var(--radius-sm);
    font-size: 14px; margin-bottom: 16px;
    display: flex; align-items: center; gap: 12px;
}
.alert-info    { background: var(--accent-soft); color: var(--accent-2); }
.alert-error   { background: rgba(255,77,77,0.15); color: var(--red); }
.alert-success { background: rgba(46,204,113,0.15); color: var(--green); }

/* ===================================================
   NOTIFICATIONS
   =================================================== */
.notif-drop-item {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 10px 16px;
    transition: background .12s;
    text-decoration: none; color: var(--text);
}
.notif-drop-item:hover { background: var(--bg-hover); }
.notif-drop-unseen { background: var(--accent-soft); }
.notif-drop-unseen:hover { background: rgba(232,114,74,.22); }
.notif-drop-avatar { position: relative; flex-shrink: 0; }
.notif-drop-avatar img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; display: block; }

.notifications-page { max-width: 900px; margin: 0 auto; padding: 0 24px 48px; }
.notifications-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.notifications-header h1 { font-size: 22px; font-weight: 600; }
.notif-section-label { font-size: 13px; font-weight: 600; color: var(--text-2); padding: 16px 0 8px; text-transform: uppercase; letter-spacing: .5px; }
.notif-item {
    display: flex; align-items: flex-start; gap: 14px;
    padding: 12px 14px; border-radius: var(--radius-sm);
    text-decoration: none; color: var(--text);
    transition: background .12s; margin-bottom: 2px;
}
.notif-item:hover { background: var(--bg-elevated); }
.notif-unseen { background: var(--accent-soft); }
.notif-unseen:hover { background: rgba(232,114,74,.18); }
.notif-avatar { position: relative; flex-shrink: 0; }
.notif-avatar img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; display: block; }
.notif-type-icon {
    position: absolute; bottom: -4px; right: -4px;
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--accent); display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--bg);
}
.notif-type-icon svg { width: 11px; height: 11px; fill: #fff; }
.notif-body { flex: 1; min-width: 0; }
.notif-text { font-size: 14px; line-height: 1.4; margin-bottom: 3px; }
.notif-time { font-size: 12px; color: var(--text-3); }
.notif-thumb img { width: 80px; height: 45px; object-fit: cover; border-radius: 4px; flex-shrink: 0; display: block; }
.notif-prefs-card {
    width: 260px; flex-shrink: 0;
    background: var(--bg-elevated); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 20px;
    position: sticky; top: 72px;
}
.notif-pref-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 0; border-bottom: 1px solid var(--border); cursor: pointer;
}
.notif-pref-row:last-child { border-bottom: none; padding-bottom: 0; }
.notif-pref-toggle { width: 36px; height: 20px; flex-shrink: 0; accent-color: var(--accent); cursor: pointer; }

/* ===================================================
   RECHERCHE
   =================================================== */
.search-page { max-width: 900px; }

.search-filters {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.search-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.search-tab {
    padding: 7px 16px; border-radius: 99px;
    font-size: 14px; font-weight: 500;
    color: var(--text-2);
    border: 1px solid var(--border);
    transition: background .12s, color .12s, border-color .12s;
}
.search-tab:hover { background: var(--bg-hover); color: var(--text); }
.search-tab.active { background: var(--text); color: var(--bg); border-color: var(--text); }

.search-options { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.search-select-wrap { display: flex; align-items: center; gap: 8px; }
.search-select {
    background: var(--bg-elevated); color: var(--text);
    border: 1px solid var(--border); border-radius: 4px;
    padding: 5px 10px; font-size: 13px; cursor: pointer;
}
.search-select:focus { outline: none; border-color: var(--accent); }

.search-section { margin-bottom: 36px; }
.search-section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.search-section-head h2 { font-size: 18px; font-weight: 600; }
.search-see-all { font-size: 13px; color: var(--accent); }
.search-see-all:hover { text-decoration: underline; }

/* Chaîne card */
.search-channels { display: flex; flex-direction: column; gap: 4px; }
.search-channel-card {
    display: flex; align-items: center; gap: 20px;
    padding: 12px 14px; border-radius: var(--radius);
    transition: background .12s;
}
.search-channel-card:hover { background: var(--bg-elevated); }
.search-channel-link {
    display: flex; align-items: center; gap: 20px;
    flex: 1; min-width: 0; color: var(--text); text-decoration: none;
}
.search-channel-link:hover .search-channel-name { text-decoration: underline; }
.search-channel-avatar { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; flex-shrink: 0; display: block; }
.search-channel-info { flex: 1; min-width: 0; }
.search-channel-name { font-size: 18px; font-weight: 500; margin-bottom: 4px; }
.search-channel-meta { font-size: 13px; color: var(--text-2); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.search-channel-bio { font-size: 13px; color: var(--text-2); line-height: 1.4; }

/* Playlist card */
.search-playlist-card {
    display: flex; align-items: center; gap: 14px;
    border-radius: var(--radius); overflow: hidden;
    color: var(--text); transition: background .12s;
    padding: 6px 6px 6px 0;
}
.search-playlist-card:hover { background: var(--bg-elevated); }
.search-playlist-thumb {
    width: 160px; height: 90px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--accent-d), var(--accent));
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 6px; color: #fff; border-radius: var(--radius-sm);
}
.search-playlist-thumb svg { width: 36px; height: 36px; }
.search-playlist-count { font-size: 12px; font-weight: 500; }
.search-playlist-info { flex: 1; min-width: 0; }
.search-playlist-name { font-size: 15px; font-weight: 500; margin-bottom: 4px; }
.search-playlist-meta { font-size: 13px; color: var(--text-2); }

@media (max-width: 600px) {
    .search-channel-avatar { width: 60px; height: 60px; }
    .search-channel-name { font-size: 15px; }
    .search-playlist-thumb { width: 120px; height: 68px; }
}


/* ===================================================
   PUBLISH PAGE (v2 — pro layout)
   =================================================== */
.pub-page {
    max-width: 1180px; margin: 0 auto;
    padding: 32px 24px 80px;
}
.pub-header {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 24px; flex-wrap: wrap;
    margin-bottom: 28px; padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}
.pub-h1 { font-size: 26px; font-weight: 700; margin: 0 0 4px; letter-spacing: -.3px; }
.pub-sub { color: var(--text-2); font-size: 14px; margin: 0; }
.pub-header-channel {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 14px 8px 8px;
    border: 1px solid var(--border); border-radius: 999px;
    background: var(--bg-card);
}
.pub-header-channel img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.pub-header-channel-name { font-size: 14px; font-weight: 600; line-height: 1.2; }
.pub-header-channel-handle { font-size: 12px; color: var(--text-2); }

/* Grid */
.pub-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 28px; align-items: start;
}
.pub-col-main { display: flex; flex-direction: column; gap: 20px; }

/* Cards */
.pub-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
}
.pub-card + .pub-card { margin-top: 0; }
#pub-step-source { margin-bottom: 28px; }
.pub-card-head { display: flex; gap: 16px; margin-bottom: 20px; }
.pub-step-num {
    flex-shrink: 0;
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--accent-soft); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
}
.pub-card-title { font-size: 16px; font-weight: 600; margin: 4px 0 2px; }
.pub-card-sub { font-size: 13px; color: var(--text-2); margin: 0; }

/* Source input */
.pub-source-input {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: border-color .15s, background .15s;
}
.pub-source-input:focus-within { border-color: var(--accent); }
.pub-source-icon { width: 22px; height: 22px; flex-shrink: 0; color: #ff0000; }
.pub-source-input input {
    flex: 1; background: none; border: 0; outline: none;
    color: var(--text); font-size: 15px;
    padding: 6px 0;
}
.pub-source-input input::placeholder { color: var(--text-3); }
.pub-paste-btn {
    padding: 6px 14px; border-radius: 999px;
    background: var(--bg-elevated); color: var(--text);
    font-size: 13px; font-weight: 500;
    transition: background .15s;
}
.pub-paste-btn:hover { background: var(--bg-hover); }

.pub-source-status {
    margin-top: 14px;
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; min-height: 22px;
}
.pub-source-status svg { width: 18px; height: 18px; flex-shrink: 0; }
.pub-source-status code { font-family: ui-monospace, monospace; font-size: 12px; padding: 1px 6px; border-radius: 4px; background: var(--bg-input); }
.pub-source-status-empty { color: var(--text-3); }
.pub-source-status.is-ok { color: var(--green); }
.pub-source-status.is-error { color: var(--red); }

/* Fields */
.pub-field { margin-bottom: 18px; }
.pub-field:last-child { margin-bottom: 0; }
.pub-field label {
    display: block; font-size: 13px; font-weight: 500;
    color: var(--text-2); margin-bottom: 8px;
}
.pub-req { color: var(--red); }
.pub-field input[type="text"],
.pub-field input[type="url"],
.pub-field textarea {
    width: 100%; padding: 12px 14px;
    background: var(--bg-input); color: var(--text);
    border: 1px solid var(--border); border-radius: 10px;
    font-family: inherit; font-size: 14px; line-height: 1.5;
    outline: none; resize: vertical;
    transition: border-color .15s;
}
.pub-field textarea { min-height: 110px; }
.pub-field input:focus, .pub-field textarea:focus { border-color: var(--accent); }
.pub-field-foot {
    font-size: 11px; color: var(--text-3);
    margin-top: 6px; text-align: right;
}

/* Visibility */
.pub-vis { display: flex; flex-direction: column; gap: 10px; }
.pub-vis-item { display: block; cursor: pointer; }
.pub-vis-item input { display: none; }
.pub-vis-box {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 16px; border-radius: 12px;
    border: 1.5px solid var(--border);
    background: var(--bg-input);
    transition: border-color .15s, background .15s;
}
.pub-vis-box:hover { background: var(--bg-hover); }
.pub-vis-item input:checked + .pub-vis-box {
    border-color: var(--accent);
    background: var(--accent-soft);
}
.pub-vis-icon {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--bg-elevated);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-2); flex-shrink: 0;
    transition: background .15s, color .15s;
}
.pub-vis-icon svg { width: 22px; height: 22px; }
.pub-vis-item input:checked + .pub-vis-box .pub-vis-icon { background: var(--accent); color: #fff; }
.pub-vis-meta { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pub-vis-name { font-size: 14px; font-weight: 600; color: var(--text); }
.pub-vis-desc { font-size: 12.5px; color: var(--text-2); line-height: 1.4; }
.pub-vis-check {
    width: 24px; height: 24px; border-radius: 50%;
    border: 1.5px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; color: transparent;
    transition: all .15s;
}
.pub-vis-item input:checked + .pub-vis-box .pub-vis-check {
    background: var(--accent); border-color: var(--accent); color: #fff;
}
.pub-vis-check svg { width: 14px; height: 14px; }

/* Format */
.pub-format { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pub-format-item { display: block; cursor: pointer; }
.pub-format-item input { display: none; }
.pub-format-box {
    padding: 16px; border-radius: 12px;
    border: 1.5px solid var(--border);
    background: var(--bg-input);
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    text-align: center;
    transition: border-color .15s, background .15s;
}
.pub-format-box:hover { background: var(--bg-hover); }
.pub-format-item input:checked + .pub-format-box {
    border-color: var(--accent);
    background: var(--accent-soft);
}
.pub-format-visual {
    background: var(--bg-elevated);
    border-radius: 6px;
    margin-bottom: 4px;
}
.pub-format-visual--video { width: 80px; height: 45px; }
.pub-format-visual--short { width: 32px; height: 56px; }
.pub-format-item input:checked + .pub-format-box .pub-format-visual {
    background: var(--accent);
}
.pub-format-name { font-size: 14px; font-weight: 600; }
.pub-format-desc { font-size: 12px; color: var(--text-2); line-height: 1.4; }

/* Aside preview */
.pub-col-aside { position: sticky; top: calc(var(--header-h) + 24px); }
.pub-preview {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
}
.pub-preview-label {
    font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .5px;
    color: var(--text-3); margin-bottom: 12px; padding: 0 4px;
}
.pub-preview-card {
    background: var(--bg);
    border-radius: 12px; overflow: hidden;
    margin-bottom: 16px;
}
.pub-preview-thumb {
    aspect-ratio: 16/9;
    background: #000;
    display: flex; align-items: center; justify-content: center;
    transition: aspect-ratio .2s;
}
.pub-preview-card.is-short .pub-preview-thumb {
    aspect-ratio: 9/16;
    max-height: 280px;
    margin: 0 auto;
}
.pub-preview-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pub-preview-thumb-empty {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-3);
}
.pub-preview-thumb-empty svg { width: 44px; height: 44px; opacity: .35; display: block; }
.pub-preview-body {
    display: flex; gap: 10px; padding: 12px;
}
.pub-preview-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    object-fit: cover; flex-shrink: 0;
}
.pub-preview-text { flex: 1; min-width: 0; }
.pub-preview-title {
    font-size: 14px; font-weight: 600; line-height: 1.35;
    color: var(--text);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; word-break: break-word;
    margin-bottom: 4px;
}
.pub-preview-title.is-placeholder { color: var(--text-3); font-weight: 500; }
.pub-preview-channel { font-size: 12.5px; color: var(--text-2); }
.pub-preview-stats { font-size: 12px; color: var(--text-3); }

.pub-preview-meta {
    margin: 0 0 16px;
    background: var(--bg-input);
    border-radius: 10px;
    padding: 4px 14px;
}
.pub-preview-meta > div {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-soft);
    font-size: 13px;
}
.pub-preview-meta > div:last-child { border-bottom: 0; }
.pub-preview-meta dt { color: var(--text-2); margin: 0; font-weight: 500; }
.pub-preview-meta dd {
    margin: 0; color: var(--text);
    font-family: ui-monospace, monospace; font-size: 12px;
    text-align: right;
    max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.pub-submit-bar {
    display: flex; gap: 8px; align-items: center;
}
.pub-cancel {
    padding: 10px 16px; border-radius: 10px;
    color: var(--text-2); font-size: 14px; font-weight: 500;
    transition: background .15s, color .15s;
}
.pub-cancel:hover { background: var(--bg-hover); color: var(--text); }
.pub-publish {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 18px; border-radius: 10px;
    background: var(--accent); color: #fff;
    font-size: 14px; font-weight: 600;
    transition: background .15s, opacity .15s;
}
.pub-publish:hover:not(:disabled) { background: var(--accent-2); }
.pub-publish:disabled { opacity: .4; cursor: not-allowed; }
.pub-publish svg { width: 18px; height: 18px; }

@media (max-width: 920px) {
    .pub-grid { grid-template-columns: 1fr; }
    .pub-col-aside { position: static; }
}
@media (max-width: 600px) {
    .pub-page { padding: 20px 16px 60px; }
    .pub-card { padding: 18px; }
    .pub-h1 { font-size: 22px; }
    .pub-format { grid-template-columns: 1fr; }
}

/* ===================================================
   LEGAL PAGES
   =================================================== */
.legal-page { padding: 40px 24px 80px; }
.legal-wrap { max-width: 720px; margin: 0 auto; }
.legal-h1 { font-size: 28px; font-weight: 700; margin-bottom: 6px; letter-spacing: -.3px; }
.legal-updated { font-size: 13px; color: var(--text-3); margin-bottom: 32px; }
.legal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px 28px;
    margin-bottom: 16px;
}
.legal-card h2 {
    font-size: 15px; font-weight: 700;
    color: var(--accent); margin: 0 0 12px;
    letter-spacing: -.1px;
}
.legal-card p { font-size: 14px; color: var(--text-2); line-height: 1.7; margin-bottom: 10px; }
.legal-card p:last-child { margin-bottom: 0; }
.legal-card ul { margin: 8px 0 12px 20px; }
.legal-card li { font-size: 14px; color: var(--text-2); line-height: 1.6; margin-bottom: 5px; }
.legal-card a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.legal-card code { font-family: ui-monospace, monospace; font-size: 12.5px; padding: 1px 6px; border-radius: 4px; background: var(--bg-input); }
.legal-block {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    font-size: 14px; line-height: 1.8;
    color: var(--text-2);
    margin: 10px 0;
}
.legal-block strong { color: var(--text); }
.legal-footer-links {
    display: flex; gap: 24px; flex-wrap: wrap;
    margin-top: 32px; padding-top: 24px;
    border-top: 1px solid var(--border);
    font-size: 13px;
}
.legal-footer-links a { color: var(--text-2); }
.legal-footer-links a:hover { color: var(--accent); }

/* =====================================================
   MOBILE — Ajustements page par page (≤ 600px)
   ===================================================== */
@media (max-width: 600px) {
    /* Topbar logo smaller */
    .topbar-logo-text { font-size: 17px; }

    /* Watch page */
    .watch-title { font-size: 17px; }
    .watch-actions { gap: 8px; }
    .watch-actions-right { gap: 4px; flex-wrap: wrap; }
    .btn-pill { padding: 7px 10px; font-size: 13px; }
    .btn-pill svg { width: 18px; height: 18px; }
    .watch-channel-row .ch-avatar { width: 32px; height: 32px; }
    .watch-channel-info .ch-name { font-size: 14px; }

    /* Video card horizontal (trending / history) */
    .video-card-h { grid-template-columns: 140px 1fr; gap: 10px; }
    .video-card-h .video-card-title { font-size: 14px; }
    .video-card-h .video-card-info { gap: 4px; }

    /* Manage tab */
    .manage-row { flex-wrap: wrap; gap: 10px; padding: 10px 8px; }
    .manage-thumb { width: 120px; height: 68px; }
    .manage-actions { width: 100%; justify-content: flex-end; }

    /* Channel header */
    .channel-tabs { gap: 16px; }
    .channel-tab { font-size: 13px; padding: 12px 0; }

    /* Page header */
    .page-title { font-size: 22px; }

    /* Notifications page */
    .notifications-page { padding: 0 12px 48px; }
    .notifications-header h1 { font-size: 18px; }
    .notif-item { padding: 10px 8px; }
    .notif-avatar img { width: 40px; height: 40px; }
    .notif-prefs-card { display: none; }

    /* Ad overlay: smaller skip btn */
    #ad-skip { font-size: 12px; padding: 5px 10px; }

    /* Login card */
    .login-card { padding: 28px 20px; }

    /* Chips bar */
    .chips-bar { padding: 8px 0 16px; gap: 8px; }
    .chip { padding: 6px 10px; font-size: 13px; }

    /* Comments */
    .comments-count { font-size: 17px; }
    .comment-form .avatar-mini { width: 32px; height: 32px; }

    /* Aside videos (related) */
    .aside-video { grid-template-columns: 120px 1fr; }

    /* Search channel card */
    .search-channel-card { gap: 12px; padding: 8px 6px; }
}
