/* =====================================================================
   Tube site styles. Dark by default; [data-theme="light"] overrides.
   Design language borrows the dense, utilitarian grid of xnxx/eporner:
   red accent, tight thumbnails, duration badges, zero fluff.
   ===================================================================== */

:root {
    --accent:      #ff3b3b;
    --accent-2:    #ff6b00;
    --bg:          #0f0f10;
    --bg-2:        #17181a;
    --bg-3:        #1e2023;
    --line:        #2a2d31;
    --text:        #e7e7e9;
    --muted:       #9a9ca1;
    --thumb-bg:    #000;
    --radius:      6px;
    --header-h:    56px;
    --sidebar-w:   248px;
    --font:        system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

[data-theme="light"] {
    --bg:      #f4f4f6;
    --bg-2:    #ffffff;
    --bg-3:    #eceef1;
    --line:    #d9dce1;
    --text:    #16181d;
    --muted:   #666a70;
    --thumb-bg:#ddd;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.4;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }

/* ── Header ─────────────────────────────────────────────────────── */
.hdr {
    position: sticky; top: 0; z-index: 40;
    min-height: var(--header-h);
    display: flex; align-items: center; gap: 14px;
    padding: 0 14px;
    background: var(--bg-2);
    border-bottom: 1px solid var(--line);
}
.logo {
    font-weight: 800; font-size: 20px; letter-spacing: -.5px;
    white-space: nowrap;
}
.logo b { color: var(--accent); }
.logo span { color: var(--text); }

.hdr form.search {
    flex: 1; display: flex; max-width: 620px;
}
.hdr .search input {
    flex: 1; height: 36px; padding: 0 12px;
    background: var(--bg-3); border: 1px solid var(--line);
    color: var(--text); border-radius: var(--radius) 0 0 var(--radius);
    outline: none; font-size: 14px;
}
.hdr .search button {
    height: 36px; padding: 0 16px; cursor: pointer;
    background: var(--accent); color: #fff; border: 0;
    border-radius: 0 var(--radius) var(--radius) 0; font-weight: 700;
}

.hdr-cats {
    display: flex; gap: 4px; overflow: hidden; flex: 0 1 auto;
}
.hdr-cats a {
    padding: 6px 10px; border-radius: var(--radius);
    color: var(--muted); font-size: 13px; white-space: nowrap;
}
.hdr-cats a:hover { background: var(--bg-3); color: var(--text); }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: var(--radius);
    background: var(--bg-3); border: 1px solid var(--line);
    color: var(--text); cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; }

/* Filter button only shows on mobile */
.filter-btn { display: none; }

/* ── Layout: sidebar + main ─────────────────────────────────────── */
.shell { display: flex; align-items: flex-start; }

.sidebar {
    width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
    position: sticky; top: var(--header-h);
    height: calc(100vh - var(--header-h));
    overflow-y: auto;
    background: var(--bg-2);
    border-right: 1px solid var(--line);
    padding: 12px 10px 40px;
}
.sidebar h4 {
    margin: 16px 8px 6px; font-size: 11px; letter-spacing: .12em;
    text-transform: uppercase; color: var(--muted);
}
.nav-link {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 8px; border-radius: var(--radius);
    color: var(--text); font-size: 13.5px;
}
.nav-link:hover, .nav-link.active { background: var(--bg-3); }
.nav-link.active { color: var(--accent); font-weight: 600; }
.nav-link .cnt { margin-left: auto; color: var(--muted); font-size: 11px; }

.chip-row { display: flex; gap: 6px; flex-wrap: wrap; padding: 4px 8px; }
.chip {
    padding: 5px 10px; border-radius: 20px; cursor: pointer;
    background: var(--bg-3); border: 1px solid var(--line);
    color: var(--muted); font-size: 12px;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.range-row { padding: 6px 8px; }
.range-row label { display:block; font-size:12px; color:var(--muted); margin-bottom:4px; }
.range-row input[type=range] { width: 100%; accent-color: var(--accent); }

.cat-list { max-height: 320px; overflow-y: auto; margin-top: 4px; }
.cat-list.collapsed { max-height: 210px; }
.see-more {
    display: block; width: calc(100% - 16px); margin: 8px 8px 0;
    padding: 7px; text-align: center; cursor: pointer;
    background: var(--bg-3); border: 1px solid var(--line);
    color: var(--text); border-radius: var(--radius); font-size: 12.5px;
}
.see-more:hover { border-color: var(--accent); }

.main { flex: 1; min-width: 0; padding: 16px; }

/* ── Section headings ───────────────────────────────────────────── */
.sec-head {
    display: flex; align-items: baseline; gap: 10px;
    margin: 4px 2px 14px;
}
.sec-head h2 { margin: 0; font-size: 18px; }
.sec-head .accent-bar {
    width: 4px; height: 18px; background: var(--accent); border-radius: 2px;
    align-self: center;
}
.sec-head .more { margin-left: auto; font-size: 13px; color: var(--muted); }

/* ── Video grid ─────────────────────────────────────────────────── */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 14px 12px;
}
.card {
    display: block;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}
.card .thumb {
    position: relative; aspect-ratio: 16/9; overflow: hidden;
    border-radius: var(--radius); background: var(--thumb-bg);
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}
.card .thumb img {
    width: 100%; height: 100%; object-fit: cover; display: block;
    transition: transform .25s ease;
    -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
    pointer-events: none;
}
.card:hover .thumb img { transform: scale(1.05); }
.card .dur {
    position: absolute; right: 6px; bottom: 6px;
    background: rgba(0,0,0,.82); color: #fff;
    font-size: 11px; font-weight: 600; padding: 1px 5px; border-radius: 3px;
}
.card .hd {
    position: absolute; left: 6px; top: 6px;
    background: var(--accent); color: #fff;
    font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 3px;
}
.card .title {
    margin: 7px 2px 2px; font-size: 13px; line-height: 1.35;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.card:hover .title { color: var(--accent); }
.card .meta {
    margin: 2px; font-size: 11.5px; color: var(--muted);
    display: flex; gap: 8px;
}
.card .meta .origin { margin-left: auto; text-transform: capitalize; }

/* Recommended row scrolls horizontally on wide, wraps on grid */
.rec-wrap { margin-bottom: 26px; }

/* ── Pagination ─────────────────────────────────────────────────── */
.pager { display: flex; gap: 6px; justify-content: center; margin: 24px 0 10px; }
.pager a, .pager span {
    padding: 7px 12px; border-radius: var(--radius);
    background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
}
.pager a:hover { border-color: var(--accent); }
.pager .cur { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Watch page ─────────────────────────────────────────────────── */
.player {
    max-width: 960px; margin: 0 auto 16px;
    aspect-ratio: 16/9; background: #000; border-radius: var(--radius);
    overflow: hidden;
}
.player iframe { width: 100%; height: 100%; border: 0; }
.watch-title { max-width: 960px; margin: 0 auto 6px; font-size: 20px; }
.watch-meta { max-width: 960px; margin: 0 auto 14px; color: var(--muted); display:flex; gap:14px; flex-wrap:wrap; }
.tag-row { max-width: 960px; margin: 0 auto 20px; display:flex; gap:6px; flex-wrap:wrap; }
.tag-row a { background: var(--bg-3); padding: 4px 10px; border-radius: 20px; font-size:12px; color: var(--muted); }
.tag-row a:hover { color: var(--accent); }

/* ── Mobile drawer for the filter sidebar ───────────────────────── */
.scrim {
    display: none; position: fixed; inset: 0; z-index: 45;
    background: rgba(0,0,0,.55);
}

@media (max-width: 900px) {
    .hdr-cats { display: none; }
    .filter-btn { display: inline-flex; }

    /* Header becomes two rows: [filter, logo, spacer, theme] on top,
       and the search bar full-width beneath it, so nothing gets clipped. */
    .hdr {
        flex-wrap: wrap;
        gap: 10px;
        padding: 8px 12px;
    }
    .logo { font-size: 18px; }
    .hdr form.search {
        order: 3;                 /* push to the wrapped second row */
        flex: 1 0 100%;           /* full width */
        max-width: none;
    }
    /* Theme toggle stays on the top row, pinned right. */
    .hdr > .icon-btn:last-child { margin-left: auto; }

    .sidebar {
        position: fixed; top: 0; left: 0; z-index: 50;
        height: 100vh; width: 84vw; max-width: 340px;
        transform: translateX(-100%); transition: transform .25s ease;
        border-right: 1px solid var(--line);
    }
    .sidebar.open { transform: translateX(0); }
    .scrim.show { display: block; }
    .cat-list, .cat-list.collapsed { max-height: none; }
    .main { padding: 12px; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px 8px; }
    .drawer-head {
        display: flex; align-items: center; justify-content: space-between;
        padding: 4px 6px 10px; border-bottom: 1px solid var(--line); margin-bottom: 8px;
    }
    .drawer-head b { font-size: 15px; }
    .drawer-close { background: none; border: 0; color: var(--text); font-size: 22px; cursor: pointer; }
}
@media (min-width: 901px) {
    .drawer-head { display: none; }
}

/* ── Site footer ────────────────────────────────────────────────── */
.site-foot {
    margin-top: 40px; padding: 24px 4px 8px;
    border-top: 1px solid var(--line);
    color: var(--muted); font-size: 12.5px;
}
.foot-links {
    display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 12px;
}
.foot-links a { color: var(--text); }
.foot-links a:hover { color: var(--accent); }
.foot-legal { margin: 0 0 8px; max-width: 720px; line-height: 1.5; }
.foot-copy { margin: 0; }

/* ── Legal pages ────────────────────────────────────────────────── */
.legal {
    max-width: 780px; margin: 0 auto; padding: 4px 2px 10px;
    line-height: 1.65;
}
.legal h1 { font-size: 24px; margin: 6px 0 18px; }
.legal h2 {
    font-size: 16px; margin: 26px 0 8px;
    padding-left: 10px; border-left: 3px solid var(--accent);
}
.legal p { margin: 0 0 12px; color: var(--text); }
.legal ol { padding-left: 22px; margin: 0 0 14px; }
.legal ol li { margin-bottom: 8px; }
.legal a { color: var(--accent); }
.legal a:hover { text-decoration: underline; }
.legal-disclaimer {
    margin-top: 28px; padding: 12px 14px; font-size: 12.5px;
    color: var(--muted); background: var(--bg-2);
    border: 1px solid var(--line); border-radius: var(--radius);
}

/* Hover preview video (fills the thumbnail) */
.thumb .preview-vid {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; background: #000; z-index: 1;
}
.thumb .dur { z-index: 2; }

/* Header "More" link */
.hdr-cats .hdr-more { color: var(--accent); font-weight: 600; }

/* Categories page grid */
.cat-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}
.cat-tile {
    display: block; padding: 14px 16px; border-radius: var(--radius);
    background: var(--bg-2); border: 1px solid var(--line);
    color: var(--text); font-weight: 600; font-size: 14px;
}
.cat-tile:hover { border-color: var(--accent); color: var(--accent); }

/* Contact page email */
.contact-email { font-size: 18px; margin: 16px 0 20px; }
.contact-email a { color: var(--accent); font-weight: 700; }

/* Watch page description */
.watch-desc {
    max-width: 960px; margin: 0 auto 18px; color: var(--text);
    line-height: 1.6;
}

/* Admin */
.admin { max-width: 1100px; margin: 0 auto; }
.admin-bar { display: flex; align-items: center; margin-bottom: 16px; }
.admin-bar h1 { margin: 0; font-size: 22px; }
.admin-ok { background: #14351c; border: 1px solid #1f6b32; color: #7ee29a;
    padding: 8px 12px; border-radius: var(--radius); }
.admin-err { background: #3a1414; border: 1px solid #7a2020; color: #ff9a9a;
    padding: 8px 12px; border-radius: var(--radius); }

.admin-login {
    max-width: 340px; margin: 60px auto; background: var(--bg-2);
    border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
}
.admin-login h1 { margin: 0 0 16px; }
.admin-login label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.admin-login input {
    display: block; width: 100%; margin-top: 4px; height: 38px; padding: 0 10px;
    background: var(--bg-3); border: 1px solid var(--line); color: var(--text);
    border-radius: var(--radius);
}
.admin-login button, .admin-find button, .btn-primary, .btn-danger, .btn-ghost {
    height: 38px; padding: 0 16px; border-radius: var(--radius); cursor: pointer;
    border: 1px solid var(--line); font-weight: 700;
}
.admin-login button, .btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; width: 100%; }
.btn-danger { background: #7a2020; border-color: #7a2020; color: #fff; }
.btn-ghost { background: var(--bg-3); color: var(--text); }

.stat-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px; margin-bottom: 22px;
}
.stat { background: var(--bg-2); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 14px 16px; }
.stat-n { font-size: 24px; font-weight: 800; }
.stat-l { font-size: 12px; color: var(--muted); margin-top: 2px; }

.admin-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: start; }
.admin-panel { background: var(--bg-2); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 16px; }
.admin-panel h2 { margin: 0 0 12px; font-size: 16px; }

.admin-find { display: flex; gap: 8px; margin-bottom: 12px; }
.admin-find input { flex: 1; height: 38px; padding: 0 10px; background: var(--bg-3);
    border: 1px solid var(--line); color: var(--text); border-radius: var(--radius); }
.admin-find button { background: var(--accent); border-color: var(--accent); color: #fff; }

.admin-edit label { display: block; margin: 10px 0; font-size: 13px; color: var(--muted); }
.admin-edit input[type=text], .admin-edit input:not([type]), .admin-edit textarea {
    display: block; width: 100%; margin-top: 4px; padding: 8px 10px;
    background: var(--bg-3); border: 1px solid var(--line); color: var(--text);
    border-radius: var(--radius); font-family: inherit; font-size: 14px;
}
.edit-head { display: flex; gap: 14px; margin-bottom: 10px; }
.edit-thumb { width: 160px; aspect-ratio: 16/9; object-fit: cover; border-radius: var(--radius); background:#000; }
.edit-facts { font-size: 12.5px; color: var(--muted); line-height: 1.7; }
.edit-facts b { color: var(--text); font-weight: 600; }
.edit-cats-head { font-size: 13px; color: var(--muted); margin: 8px 0 6px; }
.cat-check {
    display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
    padding: 5px 10px; border-radius: 20px; font-size: 12px;
    background: var(--bg-3); border: 1px solid var(--line); color: var(--muted);
}
.cat-check.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.cat-check input { accent-color: #fff; }
.edit-actions { margin-top: 14px; }

.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th { text-align: left; color: var(--muted); font-weight: 600;
    border-bottom: 1px solid var(--line); padding: 6px 4px; }
.admin-table td { padding: 6px 4px; border-bottom: 1px solid var(--line); }
.admin-table .td-title { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 800px) {
    .admin-cols { grid-template-columns: 1fr; }
    .edit-head { flex-direction: column; }
    .edit-thumb { width: 100%; }
}

/* Admin manual fetch */
.admin-fetch textarea {
    display: block; width: 100%; margin-top: 4px; padding: 8px 10px;
    background: var(--bg-3); border: 1px solid var(--line); color: var(--text);
    border-radius: var(--radius); font-family: inherit; font-size: 14px; resize: vertical;
}
.admin-fetch label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.fetch-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.fetch-row label { margin-bottom: 0; }
.admin-fetch input[type=number], .admin-fetch select {
    display: block; margin-top: 4px; height: 38px; padding: 0 10px;
    background: var(--bg-3); border: 1px solid var(--line); color: var(--text);
    border-radius: var(--radius); font-size: 14px;
}
.admin-fetch input[type=number] { width: 120px; }
.fetch-note { font-size: 12px; color: var(--muted); margin: 8px 0 0; }

/* 404 / not found */
.notfound { text-align: center; padding: 30px 10px 10px; }
.nf-code { font-size: 72px; font-weight: 900; color: var(--accent); line-height: 1; }
.notfound h1 { margin: 10px 0 8px; font-size: 24px; }
.notfound p { color: var(--muted); max-width: 460px; margin: 0 auto 10px; }
.nf-home {
    display: inline-block; margin-top: 6px; padding: 9px 18px;
    background: var(--accent); color: #fff; border-radius: var(--radius); font-weight: 700;
}
.nf-home:hover { color: #fff; opacity: .92; }
