/* =====================================================
   StreamTube — hlavní stylesheet
   Tmavý, moderní design inspirovaný YouTube
   ===================================================== */

:root {
    --bg:        #0f0f0f;
    --bg2:       #1a1a1a;
    --bg3:       #252525;
    --border:    #2e2e2e;
    --text:      #e8e8e8;
    --muted:     #888;
    --accent:    #ff4444;
    --accent2:   #ff6b35;
    --radius:    10px;
    --font:      'DM Sans', sans-serif;
    --display:   'Bebas Neue', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ── HEADER ─────────────────────────────────────── */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15,15,15,.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    height: 60px;
}
.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.logo {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-family: var(--display);
    font-size: 1.6rem;
    letter-spacing: 1px;
    color: var(--text);
    white-space: nowrap;
    flex-shrink: 0;
}
.logo-icon {
    background: var(--accent);
    color: #fff;
    width: 32px; height: 32px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-size: .9rem;
}
.logo.center { justify-content: center; }

.search-form {
    display: flex;
    flex: 1;
    max-width: 500px;
    margin-left: auto;
}
.search-form input {
    flex: 1;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: var(--radius) 0 0 var(--radius);
    padding: .55rem 1rem;
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    outline: none;
    transition: border-color .2s;
}
.search-form input:focus { border-color: var(--accent); }
.search-form button {
    background: var(--accent);
    border: none;
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: .55rem 1.2rem;
    color: #fff;
    cursor: pointer;
    font-family: var(--font);
    font-size: 14px;
    transition: background .2s;
}
.search-form button:hover { background: #e03030; }

.admin-btn {
    white-space: nowrap;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .4rem .9rem;
    font-size: 13px;
    color: var(--muted);
    transition: all .2s;
}
.admin-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── LAYOUT ─────────────────────────────────────── */
.layout {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    gap: 0;
    padding: 1rem 1.5rem;
}

/* ── SIDEBAR ─────────────────────────────────────── */
.sidebar {
    width: 210px;
    flex-shrink: 0;
    padding-right: 1.5rem;
    padding-top: .5rem;
}
.nav { display: flex; flex-direction: column; gap: .2rem; }
.nav-item {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .55rem .8rem;
    border-radius: 8px;
    color: var(--muted);
    font-size: 14px;
    transition: all .2s;
}
.nav-item:hover, .nav-item.active {
    background: var(--bg3);
    color: var(--text);
}
.nav-item.active { color: var(--accent); }

/* ── MAIN ─────────────────────────────────────── */
.main { flex: 1; min-width: 0; }
.section-title {
    font-size: 1.1rem;
    margin-bottom: 1.2rem;
    color: var(--muted);
}
.section-title em { color: var(--text); font-style: normal; }

/* ── VIDEO GRID ─────────────────────────────────── */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.2rem;
}

.video-card {
    background: var(--bg2);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: transform .2s, border-color .2s, box-shadow .2s;
    display: block;
}
.video-card:hover {
    transform: translateY(-4px);
    border-color: #444;
    box-shadow: 0 10px 30px rgba(0,0,0,.5);
}

.thumbnail {
    aspect-ratio: 16/9;
    position: relative;
    overflow: hidden;
    background: var(--bg3);
}
.thumbnail img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform .3s;
}
.video-card:hover .thumbnail img { transform: scale(1.04); }

.thumb-placeholder {
    width: 100%; height: 100%;
    display: grid;
    place-items: center;
    font-size: 2.5rem;
    color: #333;
    background: linear-gradient(135deg, #1a1a1a, #252525);
}
.thumb-placeholder.small { font-size: 1.5rem; }

.play-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(0,0,0,0);
    color: transparent;
    font-size: 2rem;
    transition: all .2s;
}
.video-card:hover .play-overlay {
    background: rgba(0,0,0,.4);
    color: rgba(255,255,255,.9);
}

.duration {
    position: absolute;
    bottom: .4rem;
    right: .4rem;
    background: rgba(0,0,0,.85);
    color: #fff;
    font-size: 11px;
    padding: .15rem .4rem;
    border-radius: 4px;
}

.card-info {
    padding: .8rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .3rem;
}
.card-info h3 {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.tag {
    display: inline-block;
    font-size: 11px;
    background: rgba(255,68,68,.15);
    color: var(--accent);
    padding: .1rem .5rem;
    border-radius: 4px;
    width: fit-content;
}
.tag.small { font-size: 10px; }
.date { font-size: 12px; color: var(--muted); }

/* ── PAGINATION ─────────────────────────────────── */
.pagination {
    display: flex;
    gap: .5rem;
    justify-content: center;
    margin-top: 2rem;
}
.pagination a {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: .4rem .8rem;
    font-size: 14px;
    color: var(--muted);
    transition: all .2s;
}
.pagination a.active, .pagination a:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ── EMPTY STATE ─────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 5rem 2rem;
    color: var(--muted);
}
.empty-icon { font-size: 4rem; margin-bottom: 1rem; }
.btn-primary {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    padding: .6rem 1.4rem;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    font-family: var(--font);
    font-size: 14px;
    transition: background .2s;
    margin-top: .5rem;
}
.btn-primary:hover { background: #e03030; }
.btn-primary.full { width: 100%; text-align: center; }
.btn-secondary {
    display: inline-block;
    background: var(--bg3);
    color: var(--text);
    padding: .6rem 1.4rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    cursor: pointer;
    font-family: var(--font);
    font-size: 14px;
    transition: all .2s;
}
.btn-secondary:hover { border-color: var(--accent); }

/* ── WATCH PAGE ─────────────────────────────────── */
.watch-page .header { position: sticky; }
.watch-layout {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}
.watch-main { flex: 1; min-width: 0; }
.player-wrap {
    position: relative;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
}
.player-wrap iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}
.video-meta {
    margin-top: 1.2rem;
}
.video-meta h1 {
    font-size: 1.35rem;
    font-weight: 600;
    margin: .4rem 0 .8rem;
    line-height: 1.3;
}
.meta-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--muted);
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.edit-link {
    color: var(--accent);
    font-size: 13px;
}
.description {
    margin-top: 1rem;
    font-size: 14px;
    color: #aaa;
    background: var(--bg2);
    padding: 1rem;
    border-radius: var(--radius);
    line-height: 1.7;
}

/* Sidebar ve watch */
.watch-sidebar {
    width: 340px;
    flex-shrink: 0;
}
.sidebar-title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    margin-bottom: 1rem;
}
.related-card {
    display: flex;
    gap: .8rem;
    padding: .6rem;
    border-radius: 8px;
    transition: background .2s;
    margin-bottom: .3rem;
}
.related-card:hover { background: var(--bg3); }
.related-thumb {
    width: 120px;
    aspect-ratio: 16/9;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg3);
}
.related-thumb img { width: 100%; height: 100%; object-fit: cover; }
.related-info { flex: 1; min-width: 0; }
.related-info h4 {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: .3rem;
}

/* ── LOGIN ─────────────────────────────────────── */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(ellipse at center, #1a0808 0%, #0f0f0f 70%);
}
.login-box {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
}
.login-box h2 {
    font-size: 1.3rem;
    margin: 1rem 0 1.5rem;
    text-align: center;
    color: var(--muted);
}

/* ── ADMIN ─────────────────────────────────────── */
.admin-body { background: #0a0a0a; }
.admin-layout {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}
.admin-cols {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
.admin-section {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}
.admin-section.full { grid-column: 1 / -1; }
.admin-section h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1.2rem;
    color: var(--text);
}
label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin: .9rem 0 .3rem;
}
label:first-of-type { margin-top: 0; }
.checkbox-label {
    display: flex;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
    color: var(--text);
}
input[type="text"], input[type="password"], textarea, select {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .55rem .9rem;
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    outline: none;
    transition: border-color .2s;
    resize: vertical;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
select option { background: var(--bg2); }
small { font-size: 12px; color: var(--muted); display: block; margin-top: .3rem; }

.form-btns { display: flex; gap: .7rem; margin-top: 1.2rem; }

.cat-form {
    display: flex;
    gap: .5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.cat-form input { width: auto; flex: 1; }
.cat-list { list-style: none; display: flex; flex-direction: column; gap: .4rem; }
.cat-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg3);
    border-radius: 6px;
    padding: .4rem .8rem;
    font-size: 14px;
}
.del-btn { color: var(--muted); font-size: 13px; transition: color .2s; }
.del-btn:hover { color: var(--accent); }

.video-table-wrap { overflow-x: auto; }
.video-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.video-table th {
    text-align: left;
    padding: .6rem .8rem;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-weight: 500;
}
.video-table td {
    padding: .55rem .8rem;
    border-bottom: 1px solid #1e1e1e;
}
.video-table tr:hover td { background: var(--bg3); }
.video-table a { color: var(--accent); }
.inactive-row td { opacity: .5; }
.tbl-btn {
    padding: .2rem .5rem;
    border-radius: 4px;
    background: var(--bg3);
    font-size: 13px;
    margin-right: .3rem;
    transition: background .2s;
}
.tbl-btn:hover { background: #333; }
.tbl-btn.del:hover { background: rgba(255,68,68,.2); }

/* ── ALERT ─────────────────────────────────────── */
.alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .8rem 1.2rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 14px;
}
.alert.ok { background: rgba(68,200,68,.15); color: #7de87d; border: 1px solid rgba(68,200,68,.2); }
.alert.error { background: rgba(255,68,68,.15); color: var(--accent); border: 1px solid rgba(255,68,68,.2); }
.alert button { background: none; border: none; color: inherit; cursor: pointer; font-size: 16px; }

/* ── FOOTER ─────────────────────────────────────── */
.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--muted);
    font-size: 13px;
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

/* ── RESPONSIVE ─────────────────────────────────── */

/* Tablet (900px) */
@media (max-width: 900px) {
    .sidebar { display: none; }
    .layout { padding: 1rem; }

    /* Watch — video na plnou šířku, sidebar pod ním */
    .watch-layout {
        flex-direction: column;
        padding: 0;
        gap: 0;
    }
    .watch-main { width: 100%; }
    .player-wrap {
        border-radius: 0;          /* video edge-to-edge */
        aspect-ratio: 16/9;
    }
    .video-meta { padding: 1rem; }
    .watch-sidebar {
        width: 100%;
        padding: 0 1rem 1rem;
    }

    .admin-cols { grid-template-columns: 1fr; }
}

/* Mobil (600px) */
@media (max-width: 600px) {
    /* Header */
    .header { height: auto; padding: .6rem 1rem; }
    .header-inner {
        flex-wrap: wrap;
        gap: .5rem;
    }
    .logo span:last-child { display: none; }
    .search-form {
        order: 3;
        flex: 0 0 100%;       /* celá šířka, druhý řádek */
        max-width: none;
    }
    .admin-btn { margin-left: auto; }

    /* Layout */
    .layout { padding: .6rem; }

    /* Video grid — 1 sloupec na velmi malém, 2 na normálním mobilu */
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: .6rem;
    }
    .card-info { padding: .55rem .7rem; }
    .card-info h3 { font-size: 12px; }

    /* Watch page */
    .watch-layout { padding: 0; }
    .player-wrap {
        border-radius: 0;
        /* Pevná výška pro malé mobily — aspect-ratio samo nestačí */
        min-height: 200px;
        max-height: 56vw;
    }
    .video-meta { padding: .8rem; }
    .video-meta h1 { font-size: 1.05rem; }
    .meta-row { gap: .6rem; font-size: 12px; }
    .description { font-size: 13px; padding: .8rem; }

    /* Related sidebar */
    .watch-sidebar { padding: 0 .8rem .8rem; }
    .sidebar-title { font-size: 12px; margin-bottom: .6rem; }
    .related-card { gap: .6rem; padding: .5rem; }
    .related-thumb { width: 100px; }
    .related-info h4 { font-size: 12px; }

    /* Login */
    .login-box { padding: 1.5rem; margin: 1rem; }

    /* Admin */
    .admin-layout { padding: .8rem; }
    .admin-section { padding: 1rem; }
    .video-table { font-size: 12px; }
    .video-table th, .video-table td { padding: .4rem .5rem; }
}

/* Velmi malé mobily (380px) */
@media (max-width: 380px) {
    .video-grid { grid-template-columns: 1fr; }
    .player-wrap { min-height: 180px; max-height: 60vw; }
}
