/* Goodigy Theme v3 - Complete CSS */

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --text-color: #333;
    --bg-color: #fff;
    --sidebar-bg: #f8f9fa;
    --border-color: #e1e4e8;
    --link-color: #0366d6;
    --link-hover: #0056b3;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Шапка */
.header {
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo a {
    display: flex;
    align-items: center;
}

.logo-img {
    height: 50px;
    width: auto;
    display: block;
}

.main-nav a {
    margin-left: 25px;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
}

.main-nav a:hover {
    color: var(--secondary-color);
}

/* Основная структура */
.content-wrapper {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
    margin-bottom: 60px;
}

/* Боковое меню */
.sidebar {
    background: var(--sidebar-bg);
    padding: 20px;
    border-radius: 8px;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.sidebar-section {
    margin-bottom: 30px;
}

.sidebar-section h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: var(--primary-color);
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 8px;
}

.posts-list {
    list-style: none;
}

.posts-list li {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.posts-list li:last-child {
    border-bottom: none;
}

.posts-list a {
    color: var(--link-color);
    text-decoration: none;
    font-size: 14px;
    display: block;
    margin-bottom: 4px;
}

.posts-list a:hover,
.posts-list a.active {
    color: var(--link-hover);
    text-decoration: underline;
}

.post-date {
    font-size: 12px;
    color: #6a737d;
}

/* Облако тегов */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tags-cloud .tag {
    background: #e1e4e8;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    color: var(--text-color);
    text-decoration: none;
    white-space: nowrap;
}

.tags-cloud .tag:hover {
    background: var(--secondary-color);
    color: white;
}

/* Основной контент */
.main-content {
    min-width: 0;
}

/* Статья */
.post {
    background: white;
}

.post-header {
    margin-bottom: 30px;
}

.post-header h1 {
    font-size: 32px;
    line-height: 1.3;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.post-meta {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: #6a737d;
    margin-bottom: 15px;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.post-tags .tag {
    background: #f1f8ff;
    color: var(--secondary-color);
    padding: 4px 12px;
    border-radius: 12px;
    text-decoration: none;
    font-size: 14px;
}

.post-tags .tag:hover {
    background: var(--secondary-color);
    color: white;
}

/* Контент статьи */
.post-content {
    font-size: 16px;
    line-height: 1.8;
}

.post-content h2 {
    font-size: 26px;
    margin-top: 40px;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.post-content h3 {
    font-size: 22px;
    margin-top: 30px;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.post-content p {
    margin-bottom: 20px;
}

/* ИСПРАВЛЕНО: Картинки отображаются как картинки */
.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 20px 0;
    display: block;
}

.post-content a img {
    border: 2px solid var(--border-color);
}

.post-content a img:hover {
    border-color: var(--secondary-color);
}

.post-content a {
    color: var(--link-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.post-content a:hover {
    border-bottom-color: var(--link-color);
}

/* Не подчеркивать ссылки-картинки */
.post-content a:has(img) {
    border-bottom: none !important;
}

.post-content ul, .post-content ol {
    margin: 20px 0;
    padding-left: 30px;
}

.post-content li {
    margin-bottom: 10px;
}

.post-content pre {
    background: #f6f8fa;
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 20px 0;
}

.post-content code {
    background: #f6f8fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.post-content pre code {
    background: none;
    padding: 0;
}

.post-content blockquote {
    border-left: 4px solid var(--secondary-color);
    padding-left: 20px;
    margin: 20px 0;
    color: #6a737d;
    font-style: italic;
}

.post-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 20px 0;
}

.post-content table th,
.post-content table td {
    border: 1px solid var(--border-color);
    padding: 10px;
    text-align: left;
}

.post-content table th {
    background: var(--sidebar-bg);
    font-weight: bold;
}

/* Список статей */
.posts-archive h1 {
    font-size: 36px;
    margin-bottom: 40px;
    color: var(--primary-color);
}

.year-heading {
    font-size: 28px;
    margin: 40px 0 20px 0;
    color: var(--primary-color);
}

.posts-list-full {
    list-style: none;
}

.post-item {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}

.post-item:last-child {
    border-bottom: none;
}

.post-item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 10px;
    gap: 20px;
}

.post-item h3 {
    font-size: 22px;
    margin: 0;
    flex: 1;
}

.post-item h3 a {
    color: var(--primary-color);
    text-decoration: none;
}

.post-item h3 a:hover {
    color: var(--secondary-color);
}

.post-excerpt {
    color: #6a737d;
    margin-bottom: 10px;
}

.post-tags-small {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-small {
    background: #f1f8ff;
    color: var(--secondary-color);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
}

/* Пагинация */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 40px 0;
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
}

.pagination ul {
    display: flex;
    gap: 10px;
    list-style: none;
}

.pagination li {
    list-style: none;
}

.pagination a,
.pagination span {
    display: block;
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--link-color);
    text-decoration: none;
    transition: all 0.2s;
    min-width: 40px;
    text-align: center;
}

.pagination a:hover {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.pagination .active {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.pagination .disabled {
    color: #999;
    border-color: var(--border-color);
    cursor: not-allowed;
    opacity: 0.5;
}

/* Подвал */
.footer {
    border-top: 1px solid var(--border-color);
    padding: 30px 0;
    text-align: center;
    color: #6a737d;
    font-size: 14px;
}

/* Адаптивность */
@media (max-width: 968px) {
    .content-wrapper {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        max-height: none;
        order: 2;
    }

    .main-content {
        order: 1;
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        align-items: flex-start;
    }

    .logo-img {
        height: 40px;
    }

    .main-nav {
        margin-top: 15px;
    }

    .main-nav a {
        margin-left: 0;
        margin-right: 20px;
    }

    .post-header h1 {
        font-size: 26px;
    }

    .post-item-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .container {
        padding: 0 15px;
    }

    .pagination {
        flex-wrap: wrap;
    }

    .pagination a,
    .pagination span {
        padding: 6px 12px;
        font-size: 14px;
    }
}


/* Страница 404 */
.error-404 {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 50vh;
    padding: 40px 20px;
}

.error-content {
    text-align: center;
    max-width: 600px;
}

.error-title {
    font-size: 120px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 20px;
    line-height: 1;
}

.error-subtitle {
    font-size: 32px;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.error-text {
    font-size: 18px;
    color: #6a737d;
    margin-bottom: 40px;
}

.error-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 50px;
}

.btn-primary,
.btn-secondary {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--secondary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--link-hover);
    transform: translateY(-2px);
}

.btn-secondary {
    background: transparent;
    color: var(--link-color);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.error-search {
    margin-top: 50px;
    text-align: left;
    padding: 30px;
    background: var(--sidebar-bg);
    border-radius: 8px;
}

.error-search h3 {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.popular-posts {
    list-style: none;
    padding: 0;
}

.popular-posts li {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.popular-posts li:last-child {
    border-bottom: none;
}

.popular-posts a {
    color: var(--link-color);
    text-decoration: none;
    flex: 1;
}

.popular-posts a:hover {
    color: var(--secondary-color);
}

.popular-posts .post-date {
    font-size: 12px;
    color: #6a737d;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .error-title {
        font-size: 80px;
    }

    .error-subtitle {
        font-size: 24px;
    }

    .error-actions {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
    }

    .popular-posts li {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Страница 404 */
.error-404 {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 50vh;
    padding: 40px 20px;
}

.error-content {
    text-align: center;
    max-width: 600px;
}

.error-title {
    font-size: 120px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 20px;
    line-height: 1;
}

.error-subtitle {
    font-size: 32px;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.error-text {
    font-size: 18px;
    color: #6a737d;
    margin-bottom: 40px;
}

.error-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 50px;
}

.btn-primary,
.btn-secondary {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--secondary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--link-hover);
    transform: translateY(-2px);
}

.btn-secondary {
    background: transparent;
    color: var(--link-color);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.error-search {
    margin-top: 50px;
    text-align: left;
    padding: 30px;
    background: var(--sidebar-bg);
    border-radius: 8px;
}

.error-search h3 {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.popular-posts {
    list-style: none;
    padding: 0;
}

.popular-posts li {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.popular-posts li:last-child {
    border-bottom: none;
}

.popular-posts a {
    color: var(--link-color);
    text-decoration: none;
    flex: 1;
}

.popular-posts a:hover {
    color: var(--secondary-color);
}

.popular-posts .post-date {
    font-size: 12px;
    color: #6a737d;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .error-title {
        font-size: 80px;
    }

    .error-subtitle {
        font-size: 24px;
    }

    .error-actions {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
    }

    .popular-posts li {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Поиск */
.search-page {
    max-width: 800px;
}

.search-page h1 {
    font-size: 36px;
    margin-bottom: 30px;
    color: var(--primary-color);
}

.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 40px;
}

#search-input {
    flex: 1;
    padding: 12px 20px;
    font-size: 16px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    outline: none;
    transition: border-color 0.3s;
}

#search-input:focus {
    border-color: var(--secondary-color);
}

#search-button {
    padding: 12px 24px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

#search-button:hover {
    background: var(--link-hover);
}

.search-info {
    color: #6a737d;
    font-size: 16px;
    margin-bottom: 20px;
}

.search-results-list {
    list-style: none;
    padding: 0;
}

.search-result-item {
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item h3 {
    font-size: 22px;
    margin: 0 0 8px 0;
}

.search-result-item h3 a {
    color: var(--primary-color);
    text-decoration: none;
}

.search-result-item h3 a:hover {
    color: var(--secondary-color);
}

.result-date {
    font-size: 14px;
    color: #6a737d;
    margin-bottom: 10px;
    display: inline-block;
}

.result-snippet {
    color: var(--text-color);
    line-height: 1.6;
    margin: 10px 0;
}

.result-snippet mark {
    background: #fff3cd;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
}

.result-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

/* Виджет поиска в сайдбаре */
.sidebar-search {
    margin-bottom: 30px;
}

.search-form {
    display: flex;
    gap: 5px;
}

.search-input-small {
    flex: 1;
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    outline: none;
}

.search-input-small:focus {
    border-color: var(--secondary-color);
}

.search-btn-small {
    padding: 8px 12px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.search-btn-small:hover {
    background: var(--link-hover);
}

@media (max-width: 768px) {
    .search-box {
        flex-direction: column;
    }

    #search-button {
        width: 100%;
    }
}