@import url('https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,400;14..32,500;14..32,600;14..32,700&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background: #f0f4f8;
    color: #1e293b;
    line-height: 1.7;
    padding: 20px;
    min-height: 100vh;
}

.wrapper {
    max-width: 1300px;
    margin: 0 auto;
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(12px);
    border-radius: 32px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.15);
    overflow: hidden;
    padding: 30px 35px;
    display: flex;
    flex-direction: column;
    min-height: 90vh;
}

.header {
    text-align: center;
    padding: 20px 0 25px;
    border-bottom: 2px solid rgba(255,255,255,0.5);
    margin-bottom: 30px;
}
.header h1 {
    font-size: 2.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #0f172a, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}
.header .sub {
    color: #64748b;
    font-size: 1.1rem;
}

.main-grid {
    display: flex;
    gap: 35px;
    flex: 1;
}

.content {
    flex: 1;
    background: #ffffff;
    border-radius: 24px;
    padding: 35px 40px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.04);
    border: 1px solid rgba(255,255,255,0.7);
}
.content h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 20px;
    border-bottom: 4px solid #eef2f6;
    padding-bottom: 15px;
}
.content h2 { font-size: 1.7rem; margin: 25px 0 12px; color: #1e293b; }
.content p { margin-bottom: 18px; font-size: 1.05rem; color: #334155; }
.content ul, .content ol { margin: 12px 0 18px 25px; }
.content code { background: #f1f5f9; padding: 2px 8px; border-radius: 6px; font-size: 0.9rem; }
.content hr { border: none; height: 2px; background: linear-gradient(to right, #e2e8f0, transparent); margin: 30px 0; }

/* Кнопки поделиться */
.share-buttons {
    margin: 30px 0 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 30px;
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: 0.2s;
    border: none;
    cursor: pointer;
}
.share-btn:hover {
    opacity: 0.85;
    transform: translateY(-2px);
}
.share-btn.vk { background: #0077ff; }
.share-btn.tg { background: #0088cc; }
.share-btn.tw { background: #1da1f2; }
.share-btn.fb { background: #1877f2; }
.share-btn.wa { background: #25d366; }

/* Похожие страницы */
.similar-pages {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #eef2f6;
}
.similar-pages h4 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: #0f172a;
}
.similar-pages ul {
    list-style: none;
    padding: 0;
}
.similar-pages ul li {
    margin-bottom: 6px;
}
.similar-pages ul li a {
    color: #3b82f6;
    text-decoration: none;
}
.similar-pages ul li a:hover {
    text-decoration: underline;
}

/* Комментарии (без изменений) */
.comments-section {
    margin-top: 40px;
    border-top: 2px solid #eef2f6;
    padding-top: 30px;
}
.comments-section h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #0f172a;
}
.comment-item {
    background: #f8fafc;
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 15px;
    border-left: 4px solid #3b82f6;
}
.comment-item .comment-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: #64748b;
}
.comment-item .comment-meta img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e2e8f0;
}
.comment-item .comment-meta .author {
    font-weight: 600;
    color: #0f172a;
}
.comment-item .comment-text p {
    margin-bottom: 6px;
}
.comment-form {
    background: #f8fafc;
    border-radius: 16px;
    padding: 20px 25px;
    margin-top: 25px;
}
.comment-form label {
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
    font-size: 0.9rem;
}
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    margin-bottom: 12px;
    background: #fff;
}
.comment-form textarea {
    min-height: 100px;
    resize: vertical;
}
.comment-form .row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}
.comment-form .row > div {
    flex: 1;
}
.comment-form .captcha {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.comment-form .captcha input {
    width: 60px;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    text-align: center;
}
.comment-form .captcha span {
    font-weight: 600;
    color: #0f172a;
}
.comment-form button {
    background: #3b82f6;
    color: #fff;
    border: none;
    padding: 10px 30px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
}
.comment-form button:hover {
    background: #2563eb;
}
.comment-msg {
    padding: 10px 16px;
    border-radius: 12px;
    margin-bottom: 15px;
}
.comment-msg.success {
    background: #dcfce7;
    color: #166534;
}
.comment-msg.error {
    background: #fee2e2;
    color: #991b1b;
}

.sidebar {
    width: 260px;
    flex-shrink: 0;
    background: #ffffff;
    border-radius: 24px;
    padding: 20px 0;
    box-shadow: 0 8px 30px rgba(0,0,0,0.04);
    border: 1px solid rgba(255,255,255,0.7);
    position: sticky;
    top: 20px;
    align-self: flex-start;
}
.sidebar .menu-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #94a3b8;
    padding: 0 24px 14px 24px;
    border-bottom: 2px solid #f1f5f9;
    font-weight: 600;
}
.sidebar ul {
    list-style: none;
    padding: 12px 0;
}
.sidebar ul li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    color: #475569;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.98rem;
    transition: all 0.2s;
    border-right: 4px solid transparent;
    border-radius: 0 12px 12px 0;
    margin-right: 12px;
}
.sidebar ul li a .icon { font-size: 1.2rem; width: 28px; text-align: center; }
.sidebar ul li a:hover {
    background: #f8fafc;
    color: #0f172a;
    border-right-color: #3b82f6;
    transform: translateX(-4px);
}
.sidebar ul li a.active {
    background: #eff6ff;
    color: #1d4ed8;
    border-right-color: #2563eb;
    font-weight: 600;
}

.search-box {
    padding: 0 20px;
    margin-top: 15px;
    border-top: 1px solid #f1f5f9;
    padding-top: 15px;
}
.search-box form {
    display: flex;
    gap: 6px;
}
.search-box input[type="text"] {
    flex: 1;
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-size: 0.85rem;
    outline: none;
}
.search-box input[type="text"]:focus {
    border-color: #3b82f6;
}
.search-box button {
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: 0.2s;
}
.search-box button:hover {
    background: #2563eb;
}

.admin-link {
    display: block;
    margin: 20px 20px 0;
    padding: 10px 0;
    border-top: 1px solid #f1f5f9;
    text-align: center;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.85rem;
    transition: 0.2s;
}
.admin-link:hover { color: #3b82f6; }

.footer {
    margin-top: 40px;
    padding-top: 20px;
    text-align: center;
    color: #94a3b8;
    font-size: 0.9rem;
    border-top: 2px solid rgba(255,255,255,0.5);
}
.footer span { color: #3b82f6; }

@media (max-width: 900px) {
    .main-grid { flex-direction: column; }
    .sidebar {
        width: 100%;
        position: static;
        margin-bottom: 20px;
    }
    .sidebar ul { display: flex; flex-wrap: wrap; justify-content: center; padding: 6px 0; }
    .sidebar ul li a {
        border-right: none;
        border-bottom: 3px solid transparent;
        border-radius: 20px;
        margin: 0 6px;
        padding: 8px 16px;
        font-size: 0.9rem;
    }
    .sidebar ul li a:hover { transform: none; border-bottom-color: #3b82f6; }
    .sidebar ul li a.active { border-bottom-color: #2563eb; background: #eff6ff; }
    .content { padding: 25px 20px; }
    .header h1 { font-size: 2rem; }
    .wrapper { padding: 15px; }
    .search-box form { flex-direction: row; }
    .comment-form .row { flex-direction: column; }
}
@media (max-width: 480px) {
    .sidebar ul li a { font-size: 0.8rem; padding: 6px 12px; }
    .content h1 { font-size: 1.6rem; }
}

/* ===== КНОПКА "НАВЕРХ" ===== */
.to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
    transition: all 0.3s ease;
    font-family: inherit;
}
.to-top.show {
    display: flex;
}
.to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(59, 130, 246, 0.5);
}
.to-top:active {
    transform: translateY(-1px);
}

/* На мобильных — чуть меньше и ближе к краю */
@media (max-width: 600px) {
    .to-top {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
        bottom: 20px;
        right: 20px;
    }
}

/* ===== КРАСИВАЯ 404 ===== */
.page-404 {
    text-align: center;
    padding: 40px 20px;
}
.page-404 .code-404 {
    font-size: 8rem;
    font-weight: 800;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 20px;
    letter-spacing: -0.05em;
}
.page-404 h1 {
    font-size: 1.8rem;
    color: #0f172a;
    margin-bottom: 12px;
    border: none;
    padding: 0;
}
.page-404 > p {
    color: #64748b;
    font-size: 1.05rem;
    margin-bottom: 30px;
}
.page-404 .btn-home {
    display: inline-block;
    padding: 14px 32px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    text-decoration: none;
    border-radius: 30px;
    font-weight: 600;
    font-size: 1rem;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
    transition: all 0.2s;
    margin-bottom: 40px;
}
.page-404 .btn-home:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(59, 130, 246, 0.4);
}
.page-404 .links-404 {
    border-top: 2px solid #eef2f6;
    padding-top: 25px;
    margin-top: 20px;
}
.page-404 .links-404 p {
    color: #94a3b8;
    font-size: 0.85rem;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
}
.page-404 .links-404 a {
    display: inline-block;
    margin: 6px 8px;
    padding: 10px 20px;
    background: #f8fafc;
    color: #475569;
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid #e2e8f0;
}
.page-404 .links-404 a:hover {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
    transform: translateY(-2px);
}
@media (max-width: 600px) {
    .page-404 { padding: 20px 10px; }
    .page-404 .code-404 { font-size: 5rem; margin-bottom: 15px; }
    .page-404 h1 { font-size: 1.3rem; }
    .page-404 > p { font-size: 0.95rem; margin-bottom: 20px; }
    .page-404 .btn-home { padding: 12px 24px; font-size: 0.95rem; }
    .page-404 .links-404 a { font-size: 0.85rem; padding: 8px 16px; }
}