/* TestYT - YouTube benzeri koyu tema */

:root {
    --bg:        #0f0f0f;
    --bg-2:      #181818;
    --bg-3:      #272727;
    --bg-hover:  #3f3f3f;
    --text:      #f1f1f1;
    --text-dim:  #aaaaaa;
    --accent:    #3ea6ff;
    --red:       #ff0033;
    --border:    #303030;
    --topbar-h:  56px;
}

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

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: "Roboto", "Segoe UI", Arial, sans-serif;
    font-size: 14px;
}

a { color: inherit; text-decoration: none; }
img { display: block; }
button { font-family: inherit; cursor: pointer; }

/* ----------------------------- ÜST ÇUBUK ----------------------------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.logo {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.logo-mark { color: var(--red); }

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 18px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.icon-btn:hover { background: var(--bg-3); }

.search-box {
    flex: 1;
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    height: 40px;
}
.search-box input {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: 20px 0 0 20px;
    padding: 0 16px;
    color: var(--text);
    font-size: 15px;
    outline: none;
}
.search-box input:focus { border-color: var(--accent); }
.search-btn {
    width: 64px;
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: 0 20px 20px 0;
    color: var(--text);
    font-size: 16px;
}
.search-btn:hover { background: var(--bg-hover); }

.topbar-right { display: flex; align-items: center; gap: 8px; }

/* ----------------------------- DÜZEN --------------------------------- */
.layout { display: flex; }

.sidebar {
    width: 220px;
    flex-shrink: 0;
    padding: 12px 8px;
    height: calc(100vh - var(--topbar-h));
    position: sticky;
    top: var(--topbar-h);
    overflow-y: auto;
}
.side-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 14px;
}
.side-item:hover { background: var(--bg-3); }
.side-item.active { background: var(--bg-3); font-weight: 600; }
.side-ico { font-size: 18px; width: 22px; text-align: center; }
.side-sep { height: 1px; background: var(--border); margin: 12px 8px; }
.side-title {
    color: var(--text-dim);
    font-size: 12px;
    text-transform: uppercase;
    padding: 4px 12px 8px;
    letter-spacing: 0.5px;
}

.content {
    flex: 1;
    padding: 24px;
    min-height: calc(100vh - var(--topbar-h));
}

.page-h { font-size: 18px; margin-bottom: 18px; font-weight: 600; }

/* ----------------------------- AVATAR -------------------------------- */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff;
    font-weight: 700;
    flex-shrink: 0;
}

/* --------------------------- VİDEO IZGARASI -------------------------- */
.vgrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 16px 16px;
}
.vcard { cursor: pointer; }
.vthumb {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-3);
}
.vthumb img { width: 100%; height: 100%; object-fit: cover; }
.vcard:hover .vthumb img { transform: scale(1.03); transition: .2s; }
.vdur {
    position: absolute;
    right: 6px;
    bottom: 6px;
    background: rgba(0,0,0,.8);
    color: #fff;
    font-size: 12px;
    padding: 1px 5px;
    border-radius: 4px;
}
.vmeta { display: flex; gap: 12px; margin-top: 10px; }
.vinfo { min-width: 0; }
.vtitle {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.vchannel { color: var(--text-dim); font-size: 13px; }
.vchannel:hover { color: var(--text); }
.vsub { color: var(--text-dim); font-size: 13px; }

/* ----------------------------- İZLEME -------------------------------- */
.watch {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 24px;
    max-width: 1280px;
    margin: 0 auto;
}
.player {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    user-select: none;
}
.player video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    cursor: pointer;
}
.player.hide-controls video { cursor: none; }

/* Ortadaki büyük oynat düğmesi (yalnızca duraklatılınca görünür) */
.big-toggle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    padding-left: 4px;
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s;
}
.player.paused .big-toggle { opacity: 1; }

/* Video yüklenemediğinde gösterilen hata katmanı */
.p-error {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    background: rgba(0, 0, 0, .85);
    color: #fff;
    font-size: 14px;
    line-height: 1.5;
    z-index: 5;
}
.p-error[hidden] { display: none; }

/* Alttaki karartma degrade + kontrol katmanı */
.p-gradient {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 130px;
    background: linear-gradient(to top, rgba(0, 0, 0, .8), transparent);
    pointer-events: none;
    transition: opacity .2s;
}
.p-controls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0 12px 6px;
    transition: opacity .2s;
}
.player.hide-controls .p-controls,
.player.hide-controls .p-gradient { opacity: 0; }

/* İlerleme / sarma çubuğu */
.p-progress {
    padding: 8px 0;
    cursor: pointer;
}
.p-progress-track {
    position: relative;
    height: 4px;
    background: rgba(255, 255, 255, .3);
    border-radius: 2px;
    transition: height .1s;
}
.p-progress:hover .p-progress-track { height: 6px; }
.p-buffered,
.p-filled {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    border-radius: 2px;
    width: 0;
}
.p-buffered { background: rgba(255, 255, 255, .45); }
.p-filled { background: var(--red); }
.p-thumb {
    position: absolute;
    top: 50%;
    left: 0;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--red);
    transform: translate(-50%, -50%) scale(0);
    transition: transform .1s;
}
.p-progress:hover .p-thumb { transform: translate(-50%, -50%) scale(1); }

/* Düğme satırı */
.p-row {
    display: flex;
    align-items: center;
    gap: 2px;
}
.p-btn {
    background: transparent;
    border: none;
    color: #fff;
    width: 38px;
    height: 38px;
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}
.p-btn:hover { background: rgba(255, 255, 255, .15); }
.p-time {
    color: #fff;
    font-size: 13px;
    margin-left: 8px;
    white-space: nowrap;
}
.p-spacer { flex: 1; }

/* Ses kaydırıcısı (üzerine gelince açılır) */
.p-volume { display: flex; align-items: center; }
.p-vol-slider {
    width: 0;
    opacity: 0;
    height: 4px;
    accent-color: #fff;
    cursor: pointer;
    transition: width .2s, opacity .2s, margin .2s;
}
.p-volume:hover .p-vol-slider {
    width: 72px;
    opacity: 1;
    margin: 0 6px;
}

/* Ayarlar menüsü */
.p-settings { position: relative; }
.p-menu {
    position: absolute;
    right: 0;
    bottom: 46px;
    background: rgba(28, 28, 28, .96);
    border-radius: 10px;
    padding: 6px;
    min-width: 210px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, .5);
}
.p-menu[hidden] { display: none; }
.p-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    background: transparent;
    border: none;
    color: #fff;
    padding: 9px 10px;
    border-radius: 6px;
    font-size: 13px;
    text-align: left;
}
.p-menu-item:hover { background: rgba(255, 255, 255, .12); }
.p-menu-val { color: var(--text-dim); }
.p-menu-back {
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    border-radius: 0;
    margin-bottom: 4px;
}
.p-check {
    width: 16px;
    flex-shrink: 0;
    display: inline-block;
}

/* Tam ekran */
.player.fullscreen {
    aspect-ratio: auto;
    border-radius: 0;
}

/* Tiyatro modu */
.watch.theater {
    grid-template-columns: 1fr;
    max-width: 100%;
}
.watch.theater .player {
    aspect-ratio: auto;
    height: min(78vh, 56.25vw);
    border-radius: 0;
}

.watch-title { font-size: 20px; margin: 14px 0 10px; }

.watch-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.watch-stats { color: var(--text-dim); }
.reactions { display: flex; gap: 8px; }
.react-btn {
    background: var(--bg-3);
    border: none;
    color: var(--text);
    padding: 8px 16px;
    border-radius: 18px;
    font-size: 14px;
}
.react-btn:hover { background: var(--bg-hover); }
.react-btn.active { background: var(--accent); color: #000; }

.channel-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.channel-id { display: flex; align-items: center; gap: 12px; flex: 1; }
.ch-name { font-weight: 600; font-size: 15px; }
.ch-subs { color: var(--text-dim); font-size: 13px; }

.sub-btn {
    background: var(--text);
    color: #000;
    border: none;
    padding: 9px 18px;
    border-radius: 18px;
    font-weight: 600;
    font-size: 14px;
}
.sub-btn:hover { opacity: .9; }
.sub-btn.subscribed { background: var(--bg-3); color: var(--text); }

.description {
    background: var(--bg-2);
    border-radius: 12px;
    padding: 14px;
    margin: 14px 0;
    line-height: 1.5;
    white-space: pre-wrap;
}

/* ----------------------------- YORUMLAR ------------------------------ */
.comments { margin-top: 8px; }
.comments h2 { font-size: 16px; margin-bottom: 16px; }

.comment-form {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 24px;
}
.comment-form input {
    flex: 1;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    padding: 8px 0;
    font-size: 14px;
    outline: none;
}
.comment-form input:focus { border-color: var(--text); }

.comment { display: flex; gap: 12px; margin-bottom: 18px; }
.comment-head { display: flex; gap: 8px; align-items: baseline; }
.comment-user { font-weight: 600; font-size: 13px; }
.comment-time { color: var(--text-dim); font-size: 12px; }
.comment-text { margin-top: 3px; line-height: 1.45; }

/* ------------------------- SONRAKİ VİDEOLAR -------------------------- */
.watch-side .side-h { font-size: 15px; margin-bottom: 12px; }
.rcard {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    padding: 4px;
    border-radius: 10px;
}
.rcard:hover { background: var(--bg-2); }
.rthumb {
    position: relative;
    width: 168px;
    flex-shrink: 0;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-3);
}
.rthumb img { width: 100%; height: 100%; object-fit: cover; }
.rinfo h4 {
    font-size: 14px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.rsub { color: var(--text-dim); font-size: 12px; margin-top: 3px; }

/* ----------------------------- KANAL --------------------------------- */
.channel-hero {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 16px 0 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}
.channel-hero-info { flex: 1; }
.channel-hero-info h1 { font-size: 24px; }

.channel-list { display: flex; flex-direction: column; gap: 4px; }
.channel-row-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px;
    border-radius: 10px;
}
.channel-row-item:hover { background: var(--bg-2); }

/* ----------------------------- FORMLAR ------------------------------- */
.form-page { max-width: 720px; margin: 0 auto; }
.form-page.narrow { max-width: 420px; }
.card-form {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.card-form label {
    font-size: 13px;
    color: var(--text-dim);
    margin-top: 12px;
}
.card-form input,
.card-form textarea {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text);
    font-size: 14px;
    outline: none;
}
.card-form input:focus,
.card-form textarea:focus { border-color: var(--accent); }
.card-form textarea { resize: vertical; }

.form-msg { margin-top: 12px; font-size: 13px; color: var(--text-dim); }
.form-msg.error { color: #ff6b6b; }

/* ----------------------------- BUTONLAR ------------------------------ */
.btn {
    background: var(--bg-3);
    color: var(--text);
    border: none;
    padding: 9px 16px;
    border-radius: 18px;
    font-size: 14px;
    font-weight: 500;
    display: inline-block;
}
.btn:hover { background: var(--bg-hover); }
.btn-primary { background: var(--accent); color: #000; font-weight: 600; }
.btn-primary:hover { opacity: .9; background: var(--accent); }
.btn-ghost { background: transparent; border: 1px solid var(--border); }
.card-form .btn { margin-top: 18px; align-self: flex-start; }

/* ----------------------------- DURUMLAR ------------------------------ */
.loader, .state-box {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-dim);
}
.state-box h2 { color: var(--text); margin-bottom: 10px; }
.state-box .btn { margin-top: 16px; }
.muted { color: var(--text-dim); }
.muted a { color: var(--accent); }

/* ----------------------------- DUYARLI ------------------------------- */
@media (max-width: 1000px) {
    .watch { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: var(--topbar-h);
        background: var(--bg);
        border-right: 1px solid var(--border);
        transform: translateX(-100%);
        transition: transform .2s;
        z-index: 40;
    }
    .sidebar.open { transform: translateX(0); }
    .content { padding: 16px; }
}
@media (max-width: 520px) {
    .logo span:last-child, .btn-ghost { display: none; }
    .vgrid { grid-template-columns: 1fr; }
}
