/* YouTube-style dark theme layered on Bootstrap (data-bs-theme="dark") */

:root {
    --yt-bg: #0f0f0f;
    --yt-surface: #212121;
    --yt-surface-hover: #3d3d3d;
    --yt-border: #272727;
    --yt-text: #f1f1f1;
    --yt-text-secondary: #aaa;
    --yt-red: #ff0033;
}

body {
    background: var(--yt-bg);
    color: var(--yt-text);
    font-family: Roboto, "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* ---------- Navbar ---------- */
.yt-navbar {
    background: var(--yt-bg);
    border-bottom: none;
    height: 56px;
    padding-top: 0;
    padding-bottom: 0;
}
.yt-brand {
    display: flex;
    align-items: center;
    gap: .4rem;
    color: var(--yt-text);
    letter-spacing: -.5px;
    font-size: 1.15rem;
}
.yt-brand:hover { color: var(--yt-text); }
.yt-logo { display: inline-flex; align-items: center; }

.yt-search {
    width: 100%;
    max-width: 640px;
    flex: 0 1 640px;
}
.yt-search-input {
    flex: 1;
    background: #121212;
    border: 1px solid var(--yt-surface-hover);
    border-right: none;
    border-radius: 40px 0 0 40px;
    color: var(--yt-text);
    padding: .45rem 1rem;
    font-size: .95rem;
}
.yt-search-input:focus {
    outline: none;
    border-color: #1c62b9;
    box-shadow: none;
    background: #121212;
    color: var(--yt-text);
}
.yt-search-input::placeholder { color: var(--yt-text-secondary); }
.yt-search-btn {
    background: var(--yt-surface);
    border: 1px solid var(--yt-surface-hover);
    border-radius: 0 40px 40px 0;
    color: var(--yt-text-secondary);
    padding: .45rem 1.25rem;
}
.yt-search-btn:hover { color: var(--yt-text); background: var(--yt-surface-hover); }

.yt-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #7a3ff2;
    color: #fff;
    font-size: .9rem;
    font-weight: 600;
    vertical-align: middle;
}
.yt-pill-btn {
    background: var(--yt-surface);
    border-radius: 40px;
    padding: .4rem 1rem !important;
    color: var(--yt-text) !important;
    font-size: .9rem;
    font-weight: 500;
}
.yt-pill-btn:hover { background: var(--yt-surface-hover); }

/* ---------- Bootstrap surface overrides ---------- */
.card {
    background: var(--yt-surface);
    border-color: var(--yt-surface-hover);
    border-radius: 12px;
}
.form-control, .form-select {
    background-color: #121212;
    border-color: var(--yt-surface-hover);
    border-radius: 8px;
    color: var(--yt-text);
}
.form-control:focus, .form-select:focus {
    background-color: #121212;
    border-color: #1c62b9;
    color: var(--yt-text);
    box-shadow: none;
}
.form-control::placeholder { color: var(--yt-text-secondary); }
.dropdown-menu {
    background: #282828;
    border: 1px solid var(--yt-surface-hover);
    border-radius: 12px;
}
.dropdown-item { color: var(--yt-text); }
.dropdown-item:hover, .dropdown-item:focus { background: var(--yt-surface-hover); color: var(--yt-text); }
.dropdown-header { color: var(--yt-text-secondary); }
.dropdown-divider { border-color: var(--yt-surface-hover); }
.list-group-item {
    background: transparent;
    border-color: var(--yt-surface-hover);
    color: var(--yt-text);
}
.list-group-item.active {
    background: var(--yt-surface);
    border-color: var(--yt-surface-hover);
    color: var(--yt-text);
}
.table { color: var(--yt-text); }
.text-secondary { color: var(--yt-text-secondary) !important; }
a { color: #3ea6ff; }
a:hover { color: #6fc0ff; }

.btn-primary {
    --bs-btn-bg: var(--yt-red);
    --bs-btn-border-color: var(--yt-red);
    --bs-btn-hover-bg: #d9002b;
    --bs-btn-hover-border-color: #d9002b;
    --bs-btn-active-bg: #d9002b;
    --bs-btn-active-border-color: #d9002b;
    border-radius: 40px;
}
.btn-outline-secondary {
    --bs-btn-color: var(--yt-text);
    --bs-btn-border-color: var(--yt-surface-hover);
    --bs-btn-hover-bg: var(--yt-surface);
    --bs-btn-hover-border-color: var(--yt-surface-hover);
    --bs-btn-hover-color: var(--yt-text);
    border-radius: 40px;
}
.btn-outline-primary {
    --bs-btn-color: #3ea6ff;
    --bs-btn-border-color: var(--yt-surface-hover);
    --bs-btn-hover-bg: #263850;
    --bs-btn-hover-border-color: var(--yt-surface-hover);
    border-radius: 40px;
}
.btn-danger { border-radius: 40px; }

/* ---------- Video feed (YouTube home grid) ---------- */
.video-card {
    display: block;
    color: inherit;
    height: 100%;
    text-decoration: none;
    border-radius: 12px;
    margin: -8px;
    padding: 8px;
    transition: background .15s;
}
.video-card:hover {
    text-decoration: none;
    color: inherit;
    background: var(--yt-surface);
}
.video-card:focus-visible {
    outline: 2px solid #3ea6ff;
    outline-offset: 0;
    background: var(--yt-surface);
}
.video-card:focus-visible .video-thumb .play-icon { opacity: 1; }
.video-thumb {
    aspect-ratio: 16/9;
    background: #1a1a1a center/cover no-repeat;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.video-thumb .play-icon {
    font-size: 2rem;
    color: rgba(255,255,255,.85);
    text-shadow: 0 1px 4px rgba(0,0,0,.7);
    opacity: 0;
    transition: opacity .15s;
}
.video-card:hover .video-thumb .play-icon { opacity: 1; }
.video-thumb .duration {
    position: absolute;
    right: .4rem;
    bottom: .4rem;
    background: rgba(0,0,0,.8);
    color: #fff;
    font-size: .75rem;
    font-weight: 500;
    padding: .1rem .35rem;
    border-radius: 4px;
}

.video-meta {
    display: flex;
    gap: .75rem;
    padding-top: .75rem;
}
.video-meta .meta-avatar {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: .95rem;
    margin-top: .15rem;
}
.video-meta .meta-title {
    font-weight: 500;
    font-size: .95rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.video-meta .meta-sub {
    color: var(--yt-text-secondary);
    font-size: .83rem;
    margin-top: .2rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Shelf headings (categories) */
.shelf-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 1.75rem 0 1rem;
}

/* Tag/topic chips */
.tag-chip {
    text-decoration: none;
    background: var(--yt-surface);
    color: var(--yt-text);
    border-radius: 8px;
    font-size: .8rem;
    font-weight: 500;
    padding: .35rem .75rem;
}
.tag-chip:hover { background: var(--yt-surface-hover); color: var(--yt-text); text-decoration: none; }
.tag-chip:focus-visible { outline: 2px solid #3ea6ff; outline-offset: 2px; }
.tag-chip.active { background: var(--yt-text); color: #0f0f0f; }
.badge.text-bg-secondary { background: var(--yt-surface) !important; color: var(--yt-text) !important; font-weight: 500; }
.badge.text-bg-primary { background: var(--yt-red) !important; font-weight: 500; }

/* ---------- Watch page ---------- */
.watch video {
    width: 100%;
    max-height: 72vh;
    background: #000;
    border-radius: 12px;
}
.watch-title { font-size: 1.15rem; font-weight: 700; }
.desc-box {
    background: var(--yt-surface);
    border-radius: 12px;
    padding: .8rem 1rem;
    font-size: .9rem;
}
.desc-box:hover { background: #2a2a2a; }

/* Up-next sidebar cards */
.upnext-card {
    display: flex;
    gap: .6rem;
    color: inherit;
    text-decoration: none;
    border-radius: 8px;
    margin: -6px;
    padding: 6px;
    transition: background .15s;
}
.upnext-card:hover {
    text-decoration: none;
    color: inherit;
    background: var(--yt-surface);
}
.upnext-card:focus-visible {
    outline: 2px solid #3ea6ff;
    outline-offset: 0;
    background: var(--yt-surface);
}
.upnext-thumb {
    flex: 0 0 168px;
    aspect-ratio: 16/9;
    border-radius: 8px;
    background: #1a1a1a center/cover no-repeat;
    position: relative;
}
.upnext-thumb .duration {
    position: absolute;
    right: .3rem;
    bottom: .3rem;
    background: rgba(0,0,0,.8);
    color: #fff;
    font-size: .7rem;
    font-weight: 500;
    padding: .05rem .3rem;
    border-radius: 4px;
}
.upnext-title {
    font-size: .85rem;
    font-weight: 500;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.upnext-sub { color: var(--yt-text-secondary); font-size: .75rem; }

/* ---------- Playlist panel ---------- */
.playlist-panel {
    background: var(--yt-surface);
    border-radius: 12px;
    padding: .75rem;
}
.playlist-panel .list-group-item {
    border: none;
    border-radius: 8px;
    padding: .5rem .75rem;
}
.playlist-panel .list-group-item.active {
    background: var(--yt-surface-hover);
}
.playlist-panel .list-group-item a { color: inherit; text-decoration: none; }

/* Playlist grid cards */
.playlist-card .video-thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(15,15,15,0) 55%, rgba(15,15,15,.85));
}
.playlist-card .playlist-badge {
    position: absolute;
    right: .4rem;
    bottom: .4rem;
    z-index: 1;
    background: rgba(0,0,0,.8);
    color: #fff;
    font-size: .75rem;
    padding: .15rem .45rem;
    border-radius: 4px;
}

/* ---------- Playlist sorting (admin) ---------- */
.sortable-list { list-style: none; padding: 0; max-width: 760px; }
.sortable-list li {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .9rem;
    background: var(--yt-surface);
    border: 1px solid var(--yt-surface-hover);
    border-radius: 8px;
    margin-bottom: .4rem;
    cursor: grab;
}
.sortable-list li.dragging { opacity: .4; }
.sortable-list .grip { color: #717171; cursor: grab; user-select: none; }
.sortable-list li a { flex: 1; }

/* ---------- Manage / edit pages ---------- */
.manage-table .mini-thumb {
    width: 88px;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}
.bulk-bar { position: sticky; top: 70px; z-index: 20; }

.edit-thumb { width: 100%; border-radius: 12px; border: 1px solid var(--yt-surface-hover); }
.edit-thumb.placeholder {
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a1a;
    color: #717171;
}

.panel { max-width: 860px; }

/* ---------- Responsive ---------- */
@media (max-width: 575.98px) {
    .watch video { max-height: 50vh; }
    .manage-table .mini-thumb { width: 64px; }
    h1 { font-size: 1.5rem; }
    .upnext-thumb { flex: 0 0 120px; }
}
