* { box-sizing: border-box; }

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    background: #f4f5f7;
    color: #222;
    line-height: 1.5;
}

/* ===== Шапка ===== */
header {
    background: #1e1f24;
    color: #fff;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
header h1 { margin: 0; font-size: 20px; }
header h1 a { color: #fff; text-decoration: none; }
header .logout {
    color: #ffb4b4;
    text-decoration: none;
    font-size: 14px;
}

.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.user-bar {
    font-size: 13px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}
.user-bar a {
    color: #cfd8ff;
    text-decoration: none;
}
.user-bar a:hover { text-decoration: underline; }
.user-info {
    display: inline-flex;
    align-items: center;
    color: #cfd8ff;
    text-decoration: none;
}
.user-info:hover { text-decoration: underline; }
.btn-upload {
    background: #4f7cff;
    color: #fff !important;
    padding: 4px 12px;
    border-radius: 6px;
    font-weight: 500;
}
.btn-upload:hover {
    background: #3b66e0;
    text-decoration: none !important;
}

/* ===== Поиск ===== */
.search { display: flex; gap: 6px; }
.search input, .search button {
    padding: 8px 12px;
    border-radius: 6px;
    border: none;
    font-size: 14px;
    font-family: inherit;
}
.search input { min-width: 240px; }
.search button {
    background: #4f7cff;
    color: #fff;
    cursor: pointer;
}
.search button:hover { background: #3b66e0; }

/* ===== Основной контент ===== */
main { max-width: 1100px; margin: 24px auto; padding: 0 16px; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.card {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    transition: transform .15s, box-shadow .15s;
    display: flex;
    flex-direction: column;
}
.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0,0,0,.15);
}
.card img {
    width: 100%;
    display: block;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}
.card .no-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #dfe3ea;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    color: #98a0ad;
}
.card-body { padding: 12px 14px; }
.card h3 {
    margin: 6px 0 0;
    font-size: 16px;
    line-height: 1.35;
}
.card-meta {
    display: flex;
    gap: 12px;
    margin-top: 6px;
    font-size: 13px;
    color: #999;
}
.card-meta span { white-space: nowrap; }

.tag {
    display: inline-block;
    background: #e6ecff;
    color: #3559c9;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
}

/* ===== Страница видео ===== */
.single h2 { margin-top: 0; }
.player {
    margin: 16px 0;
    border-radius: 10px;
    overflow: hidden;
    background: #000;
}
.player video {
    width: 100%;
    height: auto;
    display: block;
    max-height: 75vh;
}
.description {
    background: #fff;
    padding: 16px 20px;
    border-radius: 10px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.views {
    display: inline-block;
    margin-left: 10px;
    font-size: 14px;
    color: #888;
    vertical-align: middle;
}

/* ===== Лайки/дизлайки ===== */
.vote-bar {
    display: inline-flex;
    gap: 8px;
    margin: 12px 0 16px;
}

.vote-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid #dfe3ea;
    background: #fff;
    color: #444;
    border-radius: 24px;
    cursor: pointer;
    font-size: 15px;
    font-family: inherit;
    transition: background .15s, border-color .15s, color .15s;
}
.vote-btn:hover:not(:disabled) {
    background: #f4f6fa;
    border-color: #4f7cff;
}
.vote-btn:disabled {
    opacity: .6;
    cursor: wait;
}
.vote-btn.active {
    background: #e6ecff;
    border-color: #4f7cff;
    color: #3559c9;
    font-weight: 600;
}
.vote-dislike.active {
    background: #ffe6e6;
    border-color: #ff5757;
    color: #c00;
}
.vote-count {
    font-variant-numeric: tabular-nums;
    min-width: 16px;
    text-align: center;
}

/* ===== Комментарии ===== */
.comments {
    margin-top: 32px;
}
.comments h3 {
    margin: 0 0 16px;
    font-size: 20px;
}

.comment-form,
.comment-reply-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}
.comment-form textarea,
.comment-reply-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    background: #fff;
}
.comment-form button,
.comment-reply-form button {
    align-self: flex-start;
    padding: 8px 20px;
    background: #4f7cff;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
}
.comment-form button:hover,
.comment-reply-form button:hover { background: #3b66e0; }
.comment-form button:disabled,
.comment-reply-form button:disabled { opacity: .6; cursor: wait; }

.comment-login-hint {
    background: #fff;
    padding: 14px 18px;
    border-radius: 8px;
    color: #666;
    margin-bottom: 20px;
}
.comment-login-hint a { color: #4f7cff; }

.comment {
    background: #fff;
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.comment-reply {
    background: #f8f9fc;
    margin-top: 10px;
    margin-left: 40px;
    padding: 12px 16px;
    border-left: 3px solid #dfe3ea;
    box-shadow: none;
}

.comment-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background: #e6e8ec;
    flex-shrink: 0;
}
.comment-avatar-empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #98a0ad;
}
.comment-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    flex: 1;
    min-width: 0;
}
.comment-author {
    font-weight: 600;
    font-size: 14px;
    color: #222;
}
.comment-date {
    font-size: 12px;
    color: #999;
}
.comment-delete {
    background: none;
    border: none;
    color: #c00;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0 6px;
    opacity: .5;
    transition: opacity .15s;
}
.comment-delete:hover { opacity: 1; }

.comment-body {
    font-size: 15px;
    line-height: 1.5;
    color: #333;
    word-wrap: break-word;
    margin-bottom: 6px;
}

.comment-reply-toggle {
    background: none;
    border: none;
    color: #4f7cff;
    cursor: pointer;
    font-size: 13px;
    padding: 2px 0;
    font-family: inherit;
}
.comment-reply-toggle:hover { text-decoration: underline; }

.comment-replies {
    margin-top: 4px;
}

/* ===== Админка и формы ===== */
.admin h2 { margin-top: 28px; }
.admin .auth-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 320px;
}
.admin .add-form,
.profile .add-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 600px;
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.admin label,
.profile label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 14px;
    color: #555;
}
.admin input, .admin textarea,
.profile input, .profile textarea {
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 14px;
    font-family: inherit;
    width: 100%;
}
.admin input[type="file"],
.profile input[type="file"] { padding: 6px; background: #fafbfc; }
.admin button,
.profile button {
    padding: 11px;
    background: #4f7cff;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-family: inherit;
}
.admin button:hover,
.profile button:hover { background: #3b66e0; }

/* ===== Чекбокс согласия ===== */
.checkbox-label {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px !important;
    color: #555;
    line-height: 1.5;
    padding: 4px 0;
    cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
    width: 18px !important;
    height: 18px;
    margin: 2px 0 0 0;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #4f7cff;
}
.checkbox-label a {
    color: #4f7cff;
    text-decoration: none;
}
.checkbox-label a:hover { text-decoration: underline; }

.video-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.video-table th, .video-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    vertical-align: middle;
}
.video-table th { background: #f0f2f5; }
.video-table .mini {
    width: 80px;
    height: 45px;
    object-fit: cover;
    border-radius: 4px;
}
.danger { color: #c00; text-decoration: none; }
.danger:hover { text-decoration: underline; }

.approve {
    color: #1e6b1e;
    text-decoration: none;
    font-weight: 500;
    margin-right: 10px;
}
.approve:hover { text-decoration: underline; }

.btn-primary {
    display: inline-block;
    padding: 10px 18px;
    background: #4f7cff;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: background .15s;
}
.btn-primary:hover { background: #3b66e0; }

/* ===== Уведомления ===== */
.error {
    color: #c00;
    background: #fff0f0;
    padding: 10px 14px;
    border-radius: 6px;
}
.success {
    color: #1e6b1e;
    background: #e6f8e6;
    padding: 10px 14px;
    border-radius: 6px;
}
.empty {
    color: #888;
    text-align: center;
    padding: 40px;
}

/* ===== Футер ===== */
footer {
    text-align: center;
    padding: 24px;
    color: #888;
}
footer a {
    color: #888;
    text-decoration: none;
    margin: 0 4px;
}
footer a:hover { color: #555; text-decoration: underline; }

/* ===== Статистика в админке ===== */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 16px;
    margin: 16px 0 32px;
}

.stat-card {
    background: #fff;
    padding: 18px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
    text-align: center;
}
.stat-card.warn {
    background: #fff3f3;
    box-shadow: 0 2px 8px rgba(200,0,0,.15);
}
.stat-num {
    font-size: 28px;
    font-weight: 700;
    color: #1e1f24;
    line-height: 1.1;
}
.stat-card.warn .stat-num { color: #c00; }
.stat-label {
    font-size: 13px;
    color: #888;
    margin-top: 4px;
}

/* ===== Личный кабинет ===== */
.profile h2 { margin-top: 0; }

.tabs {
    display: flex;
    gap: 4px;
    margin: 16px 0 24px;
    border-bottom: 2px solid #e6e8ec;
    flex-wrap: wrap;
}
.tab {
    padding: 10px 18px;
    text-decoration: none;
    color: #666;
    border-radius: 8px 8px 0 0;
    font-size: 15px;
    transition: background .15s, color .15s;
}
.tab:hover {
    background: #eef1f6;
    color: #222;
}
.tab.active {
    background: #fff;
    color: #1e1f24;
    font-weight: 600;
    border-bottom: 2px solid #4f7cff;
    margin-bottom: -2px;
}

.profile-card {
    background: #fff;
    padding: 24px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
    max-width: 600px;
}
.profile-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}
.profile-row:last-of-type { border-bottom: none; }
.profile-label {
    color: #888;
    font-size: 14px;
}

/* ===== Аватарки ===== */
.avatar-block {
    text-align: center;
    margin-bottom: 20px;
}
.avatar-big {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    display: inline-block;
    background: #e6e8ec;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.avatar-big.avatar-empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: #98a0ad;
}

.avatar-mini {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
    margin-right: 6px;
    display: inline-block;
    background: #e6e8ec;
}
.avatar-mini.avatar-empty-mini {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #98a0ad;
}

/* ===== История просмотров ===== */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.history-item {
    display: flex;
    gap: 14px;
    background: #fff;
    padding: 10px;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 6px rgba(0,0,0,.05);
    transition: background .15s;
    align-items: center;
}
.history-item:hover { background: #f7f9fc; }
.history-item img,
.history-item .no-thumb-mini {
    width: 140px;
    height: 79px;
    border-radius: 6px;
    object-fit: cover;
    background: #dfe3ea;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: #98a0ad;
    flex-shrink: 0;
}
.history-info {
    flex: 1;
    min-width: 0;
}
.history-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
}
.history-time {
    font-size: 13px;
    color: #999;
    margin-top: 4px;
}

/* ===== Юридические страницы ===== */
.legal {
    max-width: 800px;
    background: #fff;
    padding: 32px 40px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
    line-height: 1.7;
}
.legal h1 {
    margin-top: 0;
    font-size: 28px;
}
.legal h2 {
    margin-top: 32px;
    font-size: 20px;
    color: #1e1f24;
}
.legal p, .legal li {
    font-size: 15px;
    color: #333;
}
.legal ol, .legal ul {
    padding-left: 24px;
}
.legal li {
    margin-bottom: 8px;
}
.legal code {
    background: #f0f2f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
    color: #c7254e;
}
.legal a {
    color: #4f7cff;
    text-decoration: none;
}
.legal a:hover { text-decoration: underline; }

/* ===== Мобильная адаптация ===== */
@media (max-width: 600px) {
    header {
        flex-direction: column;
        align-items: stretch;
    }
    .header-right {
        align-items: stretch;
    }
    .search {
        width: 100%;
    }
    .search input {
        min-width: 0;
        flex: 1;
    }
    .user-bar {
        justify-content: flex-end;
    }
    .grid {
        grid-template-columns: 1fr;
    }
    .history-item img,
    .history-item .no-thumb-mini {
        width: 100px;
        height: 56px;
    }
    .profile-row {
        flex-direction: column;
        gap: 2px;
        align-items: flex-start;
    }
    .comment-reply {
        margin-left: 16px;
    }
    .legal {
        padding: 20px;
    }
}

/* ===== Cookie-баннер ===== */
.cookie-banner {
    position: fixed;
    left: 20px;
    right: 20px;
    bottom: 20px;
    z-index: 9999;
    background: #1e1f24;
    color: #fff;
    padding: 16px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
    max-width: 900px;
    margin: 0 auto;
    animation: cookieSlideUp .3s ease-out;
}

@keyframes cookieSlideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.cookie-banner__text {
    font-size: 14px;
    line-height: 1.5;
    flex: 1;
}
.cookie-banner__text a {
    color: #cfd8ff;
    text-decoration: underline;
}
.cookie-banner__text a:hover { color: #fff; }

.cookie-banner__btn {
    padding: 10px 22px;
    background: #4f7cff;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: background .15s;
}
.cookie-banner__btn:hover { background: #3b66e0; }

@media (max-width: 600px) {
    .cookie-banner {
        flex-direction: column;
        align-items: stretch;
        left: 12px;
        right: 12px;
        bottom: 12px;
        padding: 14px;
        gap: 12px;
    }
    .cookie-banner__btn {
        width: 100%;
    }
}