/* ==========================================================================
   ЛитПортал — основной стиль. Светлая, современная, ненагруженная тема.
   ========================================================================== */

:root {
    --accent: #5b67e8;
    --accent-dark: #4854d6;
    --accent-soft: #eef0fe;
    --ink: #20242e;
    --muted: #6b7280;
    --line: #e7eaf1;
    --bg: #f6f7fb;
    --card: #ffffff;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(20, 24, 46, .04), 0 8px 24px rgba(20, 24, 46, .05);
    --shadow-sm: 0 1px 2px rgba(20, 24, 46, .05);
}

* { box-sizing: border-box; }

body {
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }

h1, h2, h3, h4 { font-weight: 700; letter-spacing: -.01em; }

.container { max-width: 1180px; }

/* ---------- Кнопки ---------- */
.btn-accent {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    font-weight: 600;
}
.btn-accent:hover, .btn-accent:focus { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn { border-radius: 10px; }

.req { color: #e1495b; font-weight: 700; }

/* ---------- Навбар ---------- */
.site-navbar {
    background: rgba(255, 255, 255, .9);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--line);
    padding: .65rem 0;
}
.site-navbar .navbar-brand { font-weight: 800; font-size: 1.25rem; color: var(--ink); display: flex; align-items: center; gap: .5rem; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 9px;
    background: linear-gradient(135deg, var(--accent), #8a93f4);
    color: #fff; display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800;
}
.site-navbar .nav-link { color: #3a3f4b; font-weight: 500; border-radius: 8px; padding: .4rem .75rem; }
.site-navbar .nav-link:hover { color: var(--accent); background: var(--accent-soft); }

/* ---------- Hero ---------- */
.hero {
    background: linear-gradient(135deg, #eef1ff 0%, #f6f7fb 60%);
    border-bottom: 1px solid var(--line);
}
.hero-inner { padding: 3.2rem 0 2.6rem; }
.hero-title { font-size: 2.4rem; line-height: 1.15; margin-bottom: .6rem; }
.hero-title span { color: var(--accent); }
.hero-sub { color: var(--muted); font-size: 1.08rem; max-width: 620px; }
.hero-actions { margin-top: 1.4rem; display: flex; gap: .6rem; flex-wrap: wrap; }

/* ---------- Колонки главной ---------- */
.column-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.1rem 1.2rem 1.3rem;
    height: 100%;
}
.column-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: .9rem; padding-bottom: .6rem; border-bottom: 1px solid var(--line);
}
.column-head h2 { font-size: 1.05rem; margin: 0; display: flex; align-items: center; gap: .45rem; }
.column-head h2 i { color: var(--accent); }
.column-more { font-size: .82rem; color: var(--muted); }
.column-more:hover { color: var(--accent); }

/* ---------- Лента произведений ---------- */
.feed-item { padding: .7rem 0; border-bottom: 1px dashed var(--line); }
.feed-item:last-child { border-bottom: 0; }
.feed-title { font-weight: 600; color: var(--ink); display: block; }
.feed-title:hover { color: var(--accent); }
.feed-meta { font-size: .8rem; color: var(--muted); margin-top: .1rem; }
.feed-excerpt { font-size: .88rem; color: #51566180; color: #515661; margin-top: .25rem; }
.feed-stats { font-size: .78rem; color: var(--muted); display: inline-flex; gap: .8rem; margin-top: .25rem; }
.feed-stats i { color: #aab0bd; }

.badge-cat {
    display: inline-block; font-size: .72rem; font-weight: 600;
    color: var(--accent-dark); background: var(--accent-soft);
    padding: .15rem .55rem; border-radius: 999px;
}

/* ---------- Рейтинги (нумерованные списки) ---------- */
.rank-item { display: flex; align-items: flex-start; gap: .7rem; padding: .6rem 0; border-bottom: 1px dashed var(--line); }
.rank-item:last-child { border-bottom: 0; }
.rank-num {
    flex: 0 0 26px; width: 26px; height: 26px; border-radius: 8px;
    background: var(--accent-soft); color: var(--accent-dark);
    font-weight: 700; font-size: .8rem; display: inline-flex; align-items: center; justify-content: center;
}

/* ---------- Лента комментариев на главной ---------- */
.comment-feed-item { padding: .6rem 0; border-bottom: 1px dashed var(--line); }
.comment-feed-item:last-child { border-bottom: 0; }
.comment-feed-text { font-size: .88rem; color: #515661; }
.comment-feed-meta { font-size: .78rem; color: var(--muted); margin-top: .15rem; }

/* ---------- Авторы ---------- */
.author-item { display: flex; align-items: center; gap: .7rem; padding: .55rem 0; border-bottom: 1px dashed var(--line); }
.author-item:last-child { border-bottom: 0; }
.author-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--accent-soft); }
.author-name { font-weight: 600; color: var(--ink); }
.author-name:hover { color: var(--accent); }
.author-country { font-size: .78rem; color: var(--muted); }

.rating-badge {
    display: inline-flex; align-items: center; gap: .25rem;
    font-size: .8rem; font-weight: 700; color: #b8860b;
    background: #fff6e0; padding: .12rem .5rem; border-radius: 999px;
}
.rating-badge i { font-size: .72rem; }

/* ---------- Новости ---------- */
.news-item { padding: .6rem 0; border-bottom: 1px dashed var(--line); }
.news-item:last-child { border-bottom: 0; }

/* ---------- Подвал ---------- */
.site-footer { background: #fff; border-top: 1px solid var(--line); margin-top: 3rem; padding: 2rem 0 1.4rem; }
.footer-brand { font-weight: 800; font-size: 1.1rem; }
.footer-links a { display: block; color: var(--muted); padding: .15rem 0; }
.footer-links a:hover { color: var(--accent); }
.footer-bottom { border-top: 1px solid var(--line); margin-top: 1.2rem; padding-top: 1rem; color: var(--muted); font-size: .82rem; }

/* ---------- Авторизация ---------- */
.auth-body { background: linear-gradient(135deg, #eef1ff, #f6f7fb); min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }
.auth-card {
    background: #fff; border: 1px solid var(--line); border-radius: 18px;
    box-shadow: var(--shadow); padding: 2.2rem; width: 100%; max-width: 440px;
}
.auth-brand { display: flex; align-items: center; justify-content: center; gap: .5rem; font-weight: 800; font-size: 1.3rem; margin-bottom: 1.2rem; color: var(--ink); }
.auth-title { font-size: 1.4rem; margin-bottom: .25rem; }
.auth-lead { color: var(--muted); margin-bottom: 1.4rem; }
.auth-switch { text-align: center; margin-top: 1.2rem; color: var(--muted); font-size: .9rem; }
.auth-back { display: inline-block; margin-top: 1rem; color: var(--muted); font-size: .85rem; }

/* ---------- Профиль ---------- */
.profile-header {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); padding: 1.6rem; display: flex; gap: 1.4rem; flex-wrap: wrap;
}
.profile-avatar { width: 110px; height: 110px; border-radius: 20px; object-fit: cover; background: var(--accent-soft); }
.profile-avatar-sm { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.profile-info { flex: 1; min-width: 220px; }
.profile-name { font-size: 1.6rem; margin-bottom: .1rem; }
.profile-realname { color: var(--muted); }
.profile-meta { color: var(--muted); font-size: .9rem; margin-top: .35rem; display: flex; gap: 1rem; flex-wrap: wrap; }
.profile-bio { margin-top: .8rem; color: #444a57; }
.profile-link { margin-top: .4rem; font-size: .9rem; }
.profile-stats { display: flex; gap: 1.6rem; margin-top: 1rem; }
.pstat { text-align: center; }
.pstat-num { font-size: 1.4rem; font-weight: 800; color: var(--accent); line-height: 1; }
.pstat-label { font-size: .76rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.section-title { font-size: 1.25rem; margin: 1.8rem 0 1rem; }

/* ---------- Карточки произведений ---------- */
.work-card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); padding: 1.1rem 1.2rem; height: 100%;
    transition: transform .15s ease, box-shadow .15s ease;
    display: block; color: inherit;
}
.work-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); color: inherit; }
.work-card h3 { font-size: 1.05rem; margin: .5rem 0 .3rem; }
.work-card .feed-excerpt { color: #515661; }
.work-hidden { opacity: .6; border-style: dashed; }

/* ---------- Формы-карточки / редактор ---------- */
.form-card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); padding: 1.8rem; max-width: 760px; margin: 0 auto;
}
.form-card h1 { font-size: 1.5rem; margin-bottom: 1.2rem; }
.form-control, .form-select { border-radius: 10px; border-color: var(--line); }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 .2rem rgba(91, 103, 232, .15); }
.work-editor { font-family: "Georgia", "Times New Roman", serif; font-size: 1.02rem; line-height: 1.7; }

.category-pick { display: flex; gap: 1rem; flex-wrap: wrap; }
.category-option {
    flex: 1; min-width: 160px; border: 1.5px solid var(--line); border-radius: 12px;
    padding: 1rem 1.2rem; cursor: pointer; transition: all .15s ease;
}
.category-option:hover { border-color: var(--accent); }
.category-option input { margin-right: .5rem; }
.category-option.active,
input:checked + .category-option { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Просмотр произведения ---------- */
.work-view {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); padding: 2rem 2.2rem; max-width: 820px; margin: 0 auto;
}
.work-view-head { border-bottom: 1px solid var(--line); padding-bottom: 1rem; margin-bottom: 1.4rem; }
.work-view-title { font-size: 1.9rem; margin: .5rem 0 .4rem; }
.work-view-meta { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; font-size: .9rem; }
.work-author { display: inline-flex; align-items: center; gap: .45rem; font-weight: 600; color: var(--ink); }
.work-author:hover { color: var(--accent); }
.author-avatar-sm { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.work-view-stats { display: inline-flex; gap: .9rem; color: var(--muted); margin-left: auto; }
.work-annotation { font-style: italic; color: #515661; font-size: 1.05rem; border-left: 3px solid var(--accent); padding-left: 1rem; }
.work-content { font-family: "Georgia", "Times New Roman", serif; font-size: 1.1rem; line-height: 1.85; color: #2c313c; white-space: normal; }

/* ---------- Комментарии ---------- */
.comments-section { max-width: 820px; margin: 2rem auto 0; }
.comment-form { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow-sm); }
.comment-item { }
.comment-avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; flex: 0 0 42px; background: var(--accent-soft); }

/* ---------- Каталог ---------- */
.catalog-filter { display: flex; gap: .5rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.filter-pill {
    border: 1px solid var(--line); background: #fff; border-radius: 999px;
    padding: .4rem 1.1rem; font-size: .9rem; font-weight: 500; color: #3a3f4b;
}
.filter-pill:hover { border-color: var(--accent); color: var(--accent); }
.filter-pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.pagination .page-link { color: var(--accent); border-radius: 8px; margin: 0 2px; border-color: var(--line); }
.pagination .active .page-link { background: var(--accent); border-color: var(--accent); }

/* ---------- Новость / страница ---------- */
.news-full, .page-article {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); padding: 2rem 2.2rem; max-width: 820px; margin: 0 auto;
}
.news-body, .page-body { font-size: 1.05rem; line-height: 1.8; color: #2c313c; margin-top: 1rem; }

/* ---------- Ошибки ---------- */
.error-page { text-align: center; padding: 5rem 1rem; }
.error-code { font-size: 5rem; font-weight: 800; color: var(--accent); line-height: 1; }

/* ==========================================================================
   Админка
   ========================================================================== */
.admin-body { background: #f2f4f8; }
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
    width: 240px; flex: 0 0 240px; background: #1f2430; color: #c7ccd8;
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.admin-logo { padding: 1.3rem 1.4rem; font-weight: 800; color: #fff; font-size: 1.15rem; display: flex; align-items: center; gap: .5rem; border-bottom: 1px solid #2c3340; }
.admin-nav { padding: .8rem 0; flex: 1; overflow-y: auto; }
.admin-nav a {
    display: flex; align-items: center; gap: .7rem; padding: .65rem 1.4rem;
    color: #c7ccd8; font-size: .92rem; border-left: 3px solid transparent;
}
.admin-nav a:hover { background: #2a3140; color: #fff; }
.admin-nav a.active { background: #2a3140; color: #fff; border-left-color: var(--accent); }
.admin-sidebar-foot { padding: 1rem 1.4rem; border-top: 1px solid #2c3340; font-size: .85rem; }
.admin-sidebar-foot a { color: #9aa2b1; }
.admin-sidebar-foot a:hover { color: #fff; }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-topbar {
    background: #fff; border-bottom: 1px solid var(--line); padding: .9rem 1.6rem;
    display: flex; align-items: center; justify-content: space-between;
}
.admin-topbar h1 { font-size: 1.2rem; margin: 0; }
.admin-content { padding: 1.6rem; }
.admin-panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 1.3rem 1.4rem; }
.admin-panel-title { font-size: 1.1rem; margin-bottom: 1rem; }
.admin-table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); border-bottom: 2px solid var(--line); }
.admin-table td { font-size: .92rem; }

.stat-card {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); padding: 1.2rem; display: block; text-align: left; color: var(--ink);
    transition: transform .15s ease, box-shadow .15s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); color: var(--ink); }
.stat-card i { font-size: 1.3rem; color: var(--accent); }
.stat-num { font-size: 1.8rem; font-weight: 800; line-height: 1.2; }
.stat-label { font-size: .8rem; color: var(--muted); }

.status-badge { font-size: .76rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; }
.status-badge.on { background: #e3f6ec; color: #1b8a52; }
.status-badge.off { background: #fdeaea; color: #c0392b; }

/* Простой бар-чарт */
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding-top: .5rem; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar { width: 70%; min-height: 2px; background: linear-gradient(180deg, var(--accent), #8a93f4); border-radius: 5px 5px 0 0; }
.bar-label { font-size: .65rem; color: var(--muted); margin-top: .35rem; transform: rotate(-45deg); white-space: nowrap; }

/* ---------- Адаптив ---------- */
@media (max-width: 991.98px) {
    .admin-sidebar { position: fixed; left: -240px; z-index: 1050; transition: left .2s ease; }
    .admin-sidebar.open { left: 0; }
    .hero-title { font-size: 1.9rem; }
}
