/* =====================================================
   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;
}
.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; }
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; }

/* ===================================================
   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 { display: none; }
    .main { margin-left: 0; padding: 16px; padding-top: calc(var(--header-h) + 16px); }
    .topbar-left { min-width: auto; }
    .topbar-logo-text { display: none; }
    .topbar-right { min-width: auto; }
    .btn-upload-top span, .btn-signin span { display: none; }
}

/* ===================================================
   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; }

.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;
}
.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; }
}

/* ===================================================
   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; }

/* 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; } }

.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;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}
.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: 24px; left: 50%; transform: translateX(-50%);
    z-index: 2000;
    display: flex; flex-direction: column; gap: 8px;
}
.toast {
    background: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    animation: toastIn .25s ease;
    display: flex; align-items: center; gap: 12px;
    max-width: 400px;
}
.toast.toast-success { border-left: 3px solid var(--green); }
.toast.toast-error   { border-left: 3px solid var(--red); }
.toast.toast-info    { border-left: 3px solid var(--accent); }
@keyframes toastIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===================================================
   É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); }
