/* =========================================================
   Vid SexMzi — עיצוב כהה בסגנון יוטיוב, RTL
   ========================================================= */
:root {
    --bg:        #0f0f0f;
    --bg-soft:   #1c1c1e;
    --bg-hover:  #272729;
    --border:    #2f2f31;
    --text:      #f1f1f1;
    --text-dim:  #aaaaaa;
    --accent:    #e6335a;
    --accent-2:  #ff5c7f;
    --radius:    12px;
    --font: "Segoe UI", "Heebo", Arial, sans-serif;
}

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

body { background: var(--bg); color: var(--text); font-family: var(--font); min-height: 100vh; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
code { background: var(--bg-hover); padding: 1px 5px; border-radius: 4px; font-size: .85em; }
.dim { color: var(--text-dim); }

/* ---------- כותרת עליונה ---------- */
.topbar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; gap: 16px;
    height: 56px; padding: 0 16px;
    background: rgba(15,15,15,.95);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--border);
}
.logo {
    display: inline-flex; align-items: center; gap: 0;
    direction: ltr;                 /* מונע היפוך של "18+" וסימני + ב-RTL */
    font-size: 1.35rem; font-weight: 800; letter-spacing: -.5px;
    white-space: nowrap; line-height: 1;
}
.logo span { color: var(--accent); }
.logo .badge18 {
    display: inline-flex; align-items: center;
    font-size: .62rem; font-weight: 800; color: #fff;
    background: var(--accent); border-radius: 5px;
    padding: 3px 5px; letter-spacing: 0;
    align-self: flex-start; margin: -2px 0 0 6px;
    unicode-bidi: isolate; direction: ltr;
}

.search-form { flex: 1; max-width: 560px; display: flex; margin-inline: auto; }
.search-form input {
    flex: 1; height: 38px; padding: 0 14px;
    background: var(--bg-soft); color: var(--text);
    border: 1px solid var(--border);
    border-radius: 0 20px 20px 0;
    font-size: .95rem; outline: none;
}
.search-form input:focus { border-color: var(--accent); }
.search-form button {
    width: 60px; height: 38px; cursor: default;
    background: var(--bg-hover); color: var(--text-dim);
    border: 1px solid var(--border); border-inline-start: none;
    border-radius: 20px 0 0 20px; font-size: 1rem;
}

.topbar-actions { display: flex; gap: 10px; }
.btn-admin {
    height: 38px; display: inline-flex; align-items: center;
    padding: 0 16px; border-radius: 19px;
    background: var(--bg-soft); border: 1px solid var(--border);
    font-size: .9rem; color: var(--text-dim); transition: .15s;
}
.btn-admin:hover { background: var(--bg-hover); color: var(--text); }
.btn-admin.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-admin.primary:hover { background: var(--accent-2); }

/* ---------- פס קטגוריות ---------- */
.cat-bar {
    display: flex; gap: 10px; overflow-x: auto;
    padding: 12px 16px; max-width: 1400px; margin: 0 auto;
    scrollbar-width: none;
}
.cat-bar::-webkit-scrollbar { display: none; }
.cat-chip {
    flex-shrink: 0; padding: 7px 16px; border-radius: 18px;
    background: var(--bg-soft); border: 1px solid var(--border);
    font-size: .88rem; color: var(--text-dim); transition: .15s;
}
.cat-chip:hover { background: var(--bg-hover); color: var(--text); }
.cat-chip.active { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 600; }

/* ---------- רשת סרטונים ---------- */
.container { max-width: 1400px; margin: 0 auto; padding: 12px 16px 60px; }
.section-title { font-size: 1.1rem; font-weight: 700; margin: 12px 0 18px; color: var(--text-dim); }

.video-grid {
    display: grid; gap: 24px 16px;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.video-card { cursor: pointer; }
.thumb-wrap {
    position: relative; overflow: hidden;
    border-radius: var(--radius);
    aspect-ratio: 16 / 9; background: var(--bg-soft);
}
.thumb-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.video-card:hover .thumb-wrap img { transform: scale(1.05); }
.duration {
    position: absolute; bottom: 8px; inset-inline-start: 8px;
    background: rgba(0,0,0,.85); color: #fff;
    font-size: .75rem; font-weight: 600;
    padding: 2px 6px; border-radius: 4px;
}
.card-info { padding-top: 10px; }
.card-title {
    font-size: .98rem; font-weight: 600; line-height: 1.35;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta { margin-top: 4px; font-size: .82rem; color: var(--text-dim); }
.like-inline { color: var(--accent-2); }
.card-cat { margin-top: 4px; font-size: .75rem; color: var(--accent-2); }

.empty-state { text-align: center; padding: 80px 20px; color: var(--text-dim); }
.empty-state h2 { color: var(--text); margin-bottom: 8px; }

/* ---------- פרסומות ---------- */
.ad-banner { position: relative; margin: 14px auto 20px; text-align: center; }
.ad-banner img { margin: 0 auto; border-radius: 10px; max-height: 160px; object-fit: contain; }
.ad-label {
    position: absolute; top: 6px; inset-inline-start: 6px;
    background: rgba(0,0,0,.7); color: #bbb;
    font-size: .65rem; padding: 2px 6px; border-radius: 4px; z-index: 2;
}
.ad-home_grid img { max-height: 250px; }
.ad-thumb { width: 110px; max-height: 50px; object-fit: cover; border-radius: 6px; }

/* ---------- עמוד צפייה ---------- */
.watch-layout { max-width: 1400px; margin: 0 auto; padding: 24px 16px 60px; }
.watch-cols {
    display: grid; gap: 24px;
    grid-template-columns: minmax(0, 1fr) 380px;  /* ב-RTL: ראשי בימין, קשורים בשמאל */
    align-items: start;
}
.watch-primary { min-width: 0; }

/* עמודת סרטונים קשורים */
.related-col { position: sticky; top: 76px; }
.related-title { font-size: 1.02rem; font-weight: 700; margin-bottom: 14px; }
.related-card {
    display: grid; grid-template-columns: 168px 1fr; gap: 10px;
    margin-bottom: 12px; border-radius: 10px; padding: 4px;
    transition: background .15s;
}
.related-card:hover { background: var(--bg-soft); }
.related-thumb {
    position: relative; aspect-ratio: 16/9;
    border-radius: 8px; overflow: hidden; background: var(--bg-soft);
}
.related-thumb img { width: 100%; height: 100%; object-fit: cover; }
.related-info { min-width: 0; padding-top: 2px; }
.related-name {
    font-size: .88rem; font-weight: 600; line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}
.related-meta { margin-top: 3px; font-size: .76rem; color: var(--text-dim); }

@media (max-width: 1000px) {
    .watch-cols { grid-template-columns: 1fr; }
    .related-col { position: static; }
}
.player-wrap { border-radius: var(--radius); overflow: hidden; background: #000; aspect-ratio: 16/9; }
.player-wrap video { width: 100%; height: 100%; }
.watch-title { font-size: 1.35rem; font-weight: 700; margin: 16px 0 10px; }
.watch-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding-bottom: 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.watch-meta { color: var(--text-dim); font-size: .9rem; }
.cat-link { color: var(--accent-2); }
.cat-link:hover { text-decoration: underline; }

.like-btn {
    display: inline-flex; align-items: center; gap: 8px;
    height: 40px; padding: 0 20px; border-radius: 20px;
    background: var(--bg-soft); border: 1px solid var(--border);
    color: var(--text); font-size: .95rem; font-weight: 600;
    cursor: pointer; font-family: inherit; transition: .15s;
}
.like-btn:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--accent); }
.like-btn.liked { background: var(--accent); border-color: var(--accent); color: #fff; }
.like-btn:disabled { cursor: default; }

.tags-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tag-chip {
    background: var(--bg-soft); border: 1px solid var(--border);
    color: var(--accent-2); font-size: .8rem;
    padding: 4px 12px; border-radius: 14px;
}
.watch-desc {
    margin-top: 14px; background: var(--bg-soft);
    border-radius: var(--radius); padding: 14px;
    font-size: .93rem; line-height: 1.6; white-space: pre-line;
}

/* ---------- שער גיל 18+ והתחברות ---------- */
.gate-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
    background: radial-gradient(ellipse at top, rgba(230,51,90,.18), transparent 55%), var(--bg);
}
.gate-overlay { width: 100%; display: flex; justify-content: center; padding: 20px; }
.gate-box {
    max-width: 460px; width: 100%; text-align: center;
    background: var(--bg-soft); border: 1px solid var(--border);
    border-radius: 18px; padding: 40px 32px;
    box-shadow: 0 24px 60px rgba(0,0,0,.6);
}
.gate-logo { font-size: 1.8rem; font-weight: 800; margin-bottom: 20px; }
.gate-logo span { color: var(--accent); }
.gate-box h1 { font-size: 1.25rem; margin-bottom: 14px; }
.gate-box p { color: var(--text-dim); font-size: .93rem; line-height: 1.7; margin-bottom: 26px; }
.gate-actions { display: flex; flex-direction: column; gap: 12px; }
.btn-enter, .btn-exit {
    height: 46px; border-radius: 23px; border: none;
    font-size: 1rem; font-weight: 700; cursor: pointer;
    font-family: inherit; transition: .15s;
}
.btn-enter { background: var(--accent); color: #fff; }
.btn-enter:hover { background: var(--accent-2); }
.btn-exit { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }
.btn-exit:hover { color: var(--text); background: var(--bg-hover); }
.gate-note { display: block; margin-top: 18px; color: #6b6b6d; font-size: .75rem; }
.login-input {
    height: 46px; border-radius: 23px; border: 1px solid var(--border);
    background: var(--bg); color: var(--text);
    padding: 0 20px; font-size: 1rem; font-family: inherit;
    outline: none; text-align: center;
}
.login-input:focus { border-color: var(--accent); }

/* =========================================================
   ממשק ניהול — סרגל צד
   ========================================================= */
.admin-body { background: #101012; }
.admin-shell { display: flex; min-height: 100vh; }

.admin-sidebar {
    width: 230px; flex-shrink: 0;
    background: var(--bg-soft); border-inline-end: 1px solid var(--border);
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
    padding: 20px 12px;
}
.side-logo { font-size: 1.25rem; padding: 0 10px 20px; display: block; }
.side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.side-link {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-radius: 10px;
    color: var(--text-dim); font-size: .93rem; transition: .15s;
}
.side-link:hover { background: var(--bg-hover); color: var(--text); }
.side-link.active { background: var(--accent); color: #fff; font-weight: 600; }
.side-icon { width: 20px; text-align: center; }
.side-bottom { border-top: 1px solid var(--border); padding-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.side-link.logout { color: #ff8aa3; }

.admin-main { flex: 1; padding: 28px 28px 80px; max-width: 1200px; }
.admin-h1 { font-size: 1.5rem; margin-bottom: 22px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 12px; }
.admin-head .admin-h1 { margin-bottom: 0; }

/* חיפוש חי בניהול */
.admin-search {
    width: 100%; height: 44px; margin-bottom: 18px;
    background: var(--bg-soft); color: var(--text);
    border: 1px solid var(--border); border-radius: 22px;
    padding: 0 20px; font-size: .95rem; font-family: inherit; outline: none;
}
.admin-search:focus { border-color: var(--accent); }

/* כרטיסי סטטיסטיקה */
.stat-grid {
    display: grid; gap: 14px; margin-bottom: 24px;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.stat-card {
    background: var(--bg-soft); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px; text-align: center;
}
.stat-card.accent { border-color: var(--accent); background: linear-gradient(160deg, rgba(230,51,90,.15), var(--bg-soft)); }
.stat-num { font-size: 1.7rem; font-weight: 800; }
.stat-label { margin-top: 4px; font-size: .82rem; color: var(--text-dim); }

.dash-cols, .edit-cols {
    display: grid; gap: 20px; margin-bottom: 20px;
    grid-template-columns: 1fr 1fr;
}
.edit-cols { grid-template-columns: minmax(0,1fr) 340px; align-items: start; }
@media (max-width: 950px) { .dash-cols, .edit-cols { grid-template-columns: 1fr; } }

/* פאנלים */
.panel {
    background: var(--bg-soft); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 22px; margin-bottom: 20px;
}
.panel h2 { font-size: 1.05rem; margin-bottom: 16px; }

/* טפסים */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group label { display: block; font-size: .85rem; color: var(--text-dim); margin-bottom: 6px; font-weight: 600; }
.form-group.check label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-group input, .form-group textarea, .form-group select {
    width: 100%; background: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px;
    padding: 10px 12px; font-size: .93rem; font-family: inherit; outline: none;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--accent); }
.form-group textarea { min-height: 90px; resize: vertical; }
.form-group input[type=checkbox] { width: auto; }
.form-hint { font-size: .75rem; color: #8a8a8d; margin-top: 5px; line-height: 1.5; }

.thumb-row { display: flex; gap: 8px; }
.thumb-row input { flex: 1; }
.thumb-alt { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.btn-extract {
    flex-shrink: 0; padding: 0 14px; border-radius: 8px;
    background: var(--bg-hover); color: var(--text);
    border: 1px solid var(--accent); cursor: pointer;
    font-family: inherit; font-size: .82rem; font-weight: 600; transition: .15s;
    white-space: nowrap; height: 38px;
}
.btn-extract.alt { border-color: var(--border); color: var(--text-dim); flex: 1; }
.btn-extract:hover:not(:disabled) { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-extract:disabled { opacity: .5; cursor: wait; }

.btn-save {
    width: 100%; height: 44px; border: none; border-radius: 22px;
    background: var(--accent); color: #fff;
    font-size: .98rem; font-weight: 700; cursor: pointer; transition: .15s;
    font-family: inherit;
}
.btn-save:hover { background: var(--accent-2); }
.btn-save.inline { width: auto; display: inline-flex; align-items: center; padding: 0 22px; }
a.btn-save.inline { text-decoration: none; }

/* תצוגה מקדימה */
.preview-card { position: sticky; top: 20px; }
.preview-thumb {
    position: relative; aspect-ratio: 16/9;
    border-radius: var(--radius); overflow: hidden;
    background: var(--bg); border: 1px dashed var(--border);
    display: flex; align-items: center; justify-content: center;
    color: #555; font-size: .85rem;
}
.preview-thumb img { width: 100%; height: 100%; object-fit: cover; display: none; }
.preview-thumb.has-img { border-style: solid; }
.preview-thumb.has-img img { display: block; }
.preview-thumb.has-img .ph-text { display: none; }
.preview-duration {
    position: absolute; bottom: 8px; inset-inline-start: 8px;
    background: rgba(0,0,0,.85); color: #fff;
    font-size: .75rem; font-weight: 600;
    padding: 2px 6px; border-radius: 4px; display: none;
}
.preview-title { padding-top: 10px; font-size: .95rem; font-weight: 600; min-height: 1.4em; }
.preview-meta { font-size: .8rem; color: var(--text-dim); margin-top: 4px; }

/* הודעות */
.msg { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-size: .9rem; }
.msg.ok  { background: rgba(46,160,67,.15); color: #57d873; border: 1px solid rgba(46,160,67,.4); }
.msg.err { background: rgba(230,51,90,.12); color: #ff8aa3; border: 1px solid rgba(230,51,90,.4); }

/* טבלאות */
.admin-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.admin-table th, .admin-table td { padding: 10px 10px; text-align: right; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table th { color: var(--text-dim); font-weight: 600; font-size: .78rem; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table img { width: 84px; aspect-ratio: 16/9; object-fit: cover; border-radius: 6px; }
.admin-table.slim td { padding: 8px 8px; }
.admin-table.slim img { width: 64px; }
.admin-table a:hover { color: var(--accent-2); }

.actions-cell { white-space: nowrap; }
.inline-form { display: inline; }
.btn-mini {
    display: inline-block; padding: 6px 12px; border-radius: 6px;
    background: transparent; border: 1px solid var(--border); color: var(--text-dim);
    cursor: pointer; font-family: inherit; font-size: .8rem; transition: .15s;
    margin-inline-start: 4px;
}
.btn-mini:hover { background: var(--bg-hover); color: var(--text); }
.btn-mini.danger { color: #ff8aa3; }
.btn-mini.danger:hover { background: rgba(230,51,90,.12); border-color: var(--accent); }

.pill { padding: 3px 10px; border-radius: 10px; font-size: .75rem; font-weight: 600; }
.pill.on  { background: rgba(46,160,67,.15); color: #57d873; }
.pill.off { background: var(--bg-hover); color: var(--text-dim); }

/* רספונסיביות */
@media (max-width: 760px) {
    .admin-shell { flex-direction: column; }
    .admin-sidebar {
        width: 100%; height: auto; position: static;
        flex-direction: row; align-items: center; overflow-x: auto;
        padding: 10px 12px; gap: 8px;
    }
    .side-logo { padding: 0 8px; font-size: 1rem; }
    .side-nav { flex-direction: row; }
    .side-link { padding: 8px 12px; white-space: nowrap; }
    .side-bottom { border: none; padding: 0; flex-direction: row; }
    .admin-main { padding: 18px 14px 60px; }
    .search-form { display: none; }
    .video-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .thumb-row { flex-direction: column; }
}
