/* Общий контейнер тегов */

.tags-wrapper {

    width: 100%;

    max-width: 100%;

    box-sizing: border-box;

    margin: 0;

}



/* Шапка с заголовком и кнопками сортировки */



.tags-header {

    display: flex;

    justify-content: space-between;

    align-items: flex-start;

    margin-bottom: 20px;

    border-bottom: 1px solid #eee;

    flex-wrap: wrap;

}



.tags-title h3 {

    font-size: 24px;
    border-radius: 4px;
    color: #1e293b;

    margin: 0 0 8px 0;

}



.tags-subtitle {

    color: #64748b;

    font-size: 14px;

}



.sort-controls {

    display: flex;

    gap: 10px;

}



.sort-btn {

    display: inline-flex;

    align-items: center;

    gap: 8px;
    border-radius: 4px;
    padding: 10px 16px;

    border: 1px solid #e2e8f0;

    border-radius: 4px;

    background: #fff;

    color: #64748b;

    border-radius: 4px;

    cursor: pointer;

    transition: all 0.2s ease;

}



.sort-btn:hover {

    border-color: #6366f1;

    color: #6366f1;

    background: #f8fafc;

}



.sort-btn.active {

    background: #6366f1;

    border-color: #6366f1;

    color: #fff;

}



/* Сетка тегов */

.tags-grid {

    display: grid;

    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));

    gap: 16px;

    width: 100%;

    box-sizing: border-box;

    margin: 0;

    padding: 0;

}



/* Карточка тега */

.tag-card {

    position: relative;

    background: #ffffff;

    border: 1px solid #e5e7eb;

    border-radius: 4px;

    padding: 16px;

    width: 100%;

    box-sizing: border-box;

    margin: 0;

    overflow: hidden;

}



.tag-card::before {

    position: absolute;

    inset: 0;

    border-radius: 4px;

    padding: 2px;

    background: linear-gradient(135deg, #6366f1, #8b5cf6);

    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);

    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);

    border-radius: 4px;
    ite: xor;

    mask-composite: exclude;

    opacity: 0;

    transition: opacity 0.3s;

}



.tag-card:hover {

    transform: translateY(-4px);

    box-shadow: 0 12px 24px -8px rgba(99, 102, 241, 0.15);

}



.tag-card:hover::before {

    opacity: 1;

}



/* Заголовок карточки */

.tag-card-header {

    display: flex;

    justify-content: space-between;

    align-items: flex-start;

    margin-bottom: 20px;

    flex-wrap: wrap;

}



.tag-name {

    font-size: 18px;

    font-weight: 600;

    color: #1e293b;

    text-decoration: none;

    display: flex;

    align-items: center;

    gap: 6px;

}



.tag-hash {

    color: #6366f1;

}



.usage-count {

    display: inline-flex;

    align-items: center;

    gap: 6px;

    padding: 6px 12px;

    background: #f8fafc;

    border-radius: 20px;

    font-size: 14px;

    color: #64748b;

}



/* Контент карточки */

.tag-content {

    /* width: 100%; */

    max-width: 100%;

    overflow: hidden;

}



.recent-articles h4 {

    font-size: 14px;

    color: #64748b;

    margin: 0 0 12px;

    display: flex;

    align-items: center;

    gap: 8px;

}



.articles-list {

    width: 100%;

    max-width: 100%;

    overflow: hidden;

    list-style: none;

    padding: 0;

    margin: 0;

}



.articles-list li {

    width: 100%;

    max-width: 100%;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;

    padding: 10px;

    border-bottom: 1px dashed #e2e8f0;

    color: #475569;

    font-size: 14px;

    transition: all 0.2s;

}



.articles-list li:last-child {

    border-bottom: none;

}



.articles-list li:hover {

    background: #f1f5f9;

    border-radius: 4px;

    padding-left: 16px;

}



/* Подвал карточки */

.tag-card-footer {

    display: flex;

    justify-content: space-between;

    align-items: center;

    margin-top: 16px;

    padding-top: 16px;

    border-top: 1px solid #f1f5f9;

}



.last-used {

    display: flex;

    align-items: center;

    gap: 6px;

    color: #94a3b8;

    font-size: 13px;

}



.view-all {

    display: flex;

    align-items: center;

    gap: 6px;

    color: #6366f1;

    font-size: 14px;

    text-decoration: none;

    transition: transform 0.2s;

}



.view-all:hover {

    transform: translateX(4px);

}



/* Адаптивность */

@media (max-width: 768px) {

    .tags-wrapper {

        padding: 0;

        margin: 0;

        border-radius: 0;

        width: 100%;

    }



    .tags-header {

        flex-direction: column;

        align-items: flex-start;

        gap: 12px;

        margin-bottom: 16px;

    }



    .tags-title h3 {

        font-size: 20px;

    }



    .sort-controls {

        width: 100%;

    }



    .sort-btn {

        padding: 8px;

        font-size: 13px;

    }



    .tags-grid {

        grid-template-columns: 1fr;
        gap: 10px !important;

    }



    .tag-card {

        width: 100%;

        margin: 0;

        padding: 8px !important;


    }



    .tag-card-header {

        flex-direction: column;

        gap: 8px;

    }



    .usage-count {

        width: 100%;

        justify-content: center;

        margin-top: 4px;

    }



    .tag-content {

        margin: 8px 0;

        padding: 10px;

    }



    .articles-list li {

        padding: 6px 8px;

    }

}



/* Добавляем стили для очень маленьких экранов */

@media (max-width: 360px) {

    .sort-btn {

        font-size: 12px;

        padding: 6px;

    }



    .tag-name {

        font-size: 16px;

    }



    .articles-list {

        font-size: 13px;

    }

}

/* ===== СТИЛИ ДЛЯ СТРАНИЦ ТЕГОВ ===== */
.tags-filters>.filters-form>.filters-group>.button-primary {
    padding: 10px 8px;
}

.tag-actions>a.button-secondary.button-small {
    width: auto;
}

/* Основные стили страницы тегов */
.tags-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.page-header {
    margin-bottom: 30px;
    text-align: center;
}

.page-header h1 {
    font-size: 2.5rem;
    color: #1f2937;
    margin-bottom: 10px;
}

.page-description {
    color: #6b7280;
    font-size: 1.1rem;
}

/* Фильтры и поиск */
.tags-filters {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.filters-form {
    display: flex;
    justify-content: center;
}

.filters-group {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    padding: 12px 45px 12px 15px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    width: 300px;
    transition: border-color 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-button {
    position: absolute;
    right: 5px;
    padding: 8px;
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    border-radius: 4px;
    transition: color 0.2s;
}

.search-button:hover {
    color: #374151;
}

.sort-wrapper {
    display: flex;
    gap: 10px;
}

.sort-select {
    padding: 12px 15px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

.sort-select:focus {
    outline: none;
    border-color: #6366f1;
}

/* Сетка тегов */
.tags-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.tag-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.2s;
    position: relative;
}

.tag-card:hover {
    border-color: #6366f1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.tag-link {
    text-decoration: none;
    color: inherit;
    display: block;
    margin-bottom: 15px;
}

.tag-name {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 10px 0;
    transition: color 0.2s;
}

.tag-link:hover .tag-name {
    color: #6366f1;
}

.tag-stats {
    color: #6b7280;
    font-size: 14px;
}

.articles-count {
    font-weight: 500;
    color: #000000;
}

.tag-actions {
    margin-top: 15px;
}

.button-small {
    padding: 8px 16px;
    font-size: 13px;
}

/* Страница отдельного тега */
.tag-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Хлебные крошки */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.breadcrumb a {
    color: #6366f1;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.separator {
    color: #9ca3af;
}

.current {
    color: #6b7280;
    font-weight: 500;
}

/* Информация о теге */
.tag-info {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    border-radius: 12px;
    margin-bottom: 40px;
    text-align: center;
}

.tag-title {
    font-size: 2.5rem;
    margin: 0 0 15px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.tag-icon {
    font-size: 2rem;
}

.tag-stats {
    display: flex;
    justify-content: left;
    gap: 30px;
    margin-bottom: 25px;
    font-size: 1.1rem;
    color: #ffffff;
}

.stat-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 5px;
}

.tag-actions {
    margin-top: 25px;
}

.tag-actions .button-primary {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 12px 24px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    flex-wrap: wrap;
}

.tag-actions .button-primary:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

/* Предварительный просмотр статей */
.tag-articles-preview {
    margin-bottom: 40px;
}

.tag-articles-preview h2 {
    font-size: 1.8rem;
    color: #1f2937;
    margin-bottom: 25px;
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.article-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.2s;
		margin: 10px 0;
}

.article-card:hover {
    border-color: #6366f1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.article-header {
    margin-bottom: 15px;
}

.article-title {
    margin: 0 0 10px 0;
}

.article-title a {
    color: #1f2937;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 600;
    transition: color 0.2s;
}

.article-title a:hover {
    color: #6366f1;
}

.article-meta {
    display: flex;
    /* justify-content: space-between; */
		flex-direction: row;
    justify-content: flex-start;
    font-size: 13px;
    color: #6b7280;
}

.article-excerpt {
    color: #4b5563;
    line-height: 1.6;
    margin-bottom: 15px;
}

.article-stats {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: #6b7280;
}

.stat {
    display: flex;
    align-items: center;
    gap: 5px;
}

.stat svg {
    stroke-width: 1.5;
}

/* Связанные теги */
.related-tags {
    background: #f9fafb;
    border-radius: 8px;
    padding: 25px;
    margin-top: 40px;
}

.related-tags h2 {
    font-size: 1.5rem;
    color: #1f2937;
    margin-bottom: 20px;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: 8px 16px;
    text-decoration: none;
    color: #374151;
    font-size: 14px;
    transition: all 0.2s;
}

.tag-item:hover {
    border-color: #6366f1;
    background: #f0f9ff;
    color: #1e40af;
}

.tag-count {
    background: #e5e7eb;
    color: #6b7280;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 500;
}

.tag-item:hover .tag-count {
    background: #dbeafe;
    color: #1e40af;
}

/* Показать больше */
.show-more {
    text-align: center;
    margin-top: 30px;
}

/* Пустое состояние */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 1.5rem;
    color: #374151;
    margin-bottom: 10px;
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.tag-page>.page-header>.tag-info>.tag-stats {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 1.1rem;
    color: #ffffff;
}

.tag-page>.page-header>.tag-info>.tag-actions>a.button-primary {
    width: auto;
}


@media (max-width: 768px) {

    .stat-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 5px;
    }

    .show-more {
        text-align: center;
        margin-top: 10px;
    }

    .tag-articles-preview {
        margin-bottom: 10px;
    }

    .related-tags>.tags-list {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
    }

    .show-more>a.button-primary {
        width: auto;
    }

    .button-primary,
    .button-secondary {
        /* width: auto!important; */
    }

    .related-tags {
        background: #f9fafb;
        padding: 10px;
        margin-top: 10px;
    }

    .tag-articles-preview h2 {
        font-size: 1rem;
        color: #1f2937;
        margin-bottom: 15px;
    }

    .tag-articles-preview>.articles-grid>article.article-card>.article-header>.article-meta {
        display: flex;
        justify-content: space-between;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .tag-articles-preview>.articles-grid>article.article-card>.article-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 5px;
        margin-bottom: 12px;
        flex-wrap: wrap;
    }

    .tag-page {
        max-width: 1200px;
        margin: 0 auto;
        padding: 0px;
    }

    .tag-articles-preview>.articles-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(100%, 1fr));
        gap: 10px;
        margin-bottom: 20px;
    }

    .tag-articles-preview>.articles-grid>.article-card {
        padding: 10px;
    }

    .tag-stats {
        display: flex;
        justify-content: left;
        gap: 10px;
        margin-bottom: 10px;
        font-size: 1.1rem;
        color: #ffffff;
    }

    .tag-actions {
        margin-top: 10px;
    }

    .tag-link {
        margin-bottom: 0px;
    }

    .tags-page {
        padding: 0;
    }

    .tags-grid {
        gap: 5px;
    }

    .page-header h1 {
        font-size: 1.5rem !important;
        margin-bottom: 10px;
    }

    /* Мобильные стили для фильтров */
    .tags-filters {
        padding: 15px;
        margin-bottom: 20px;
    }

    .filters-form {
        display: block;
    }

    .filters-group {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .search-wrapper {
        width: 100%;
    }

    .search-input {
        width: 100%;
        box-sizing: border-box;
        font-size: 16px;
        /* Предотвращает zoom на iOS */
    }

    .sort-wrapper {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }

    .sort-select {
        width: 100%;
        box-sizing: border-box;
        font-size: 16px;
        /* Предотвращает zoom на iOS */
    }

    .button-primary,
    .button-secondary {
        width: auto;
        text-align: center;
        justify-content: center;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .tags-filters {
        padding: 10px;
        margin-bottom: 15px;
    }

    .filters-group {
        gap: 12px;
    }

    .search-input,
    .sort-select {
        padding: 10px 12px;
        font-size: 16px;
    }

    .search-input {
        padding-right: 40px;
    }

    .search-button {
        right: 8px;
        padding: 6px;
    }
}