
.btn, .modal-btn, .fixed-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    transition: background-color 0.3s, box-shadow 0.3s, transform 0.2s;
    box-shadow: 0 2px 4px var(--shadow-color);
    box-sizing: border-box;
}

.btn:hover, .modal-btn:hover, .fixed-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px var(--shadow-color);
}

.btn:active, .modal-btn:active, .fixed-action-btn:active {
    transform: translateY(0);
    box-shadow: 1px 1px 2px var(--shadow-color);
}

.btn .material-symbols-outlined,
.modal-btn .material-symbols-outlined {
    margin-right: 8px;
    font-size: 20px;
}

.btn-primary, .modal-btn-register {
    background-color: var(--primary-color);
    color: #ffffff;
	display: flex;
    justify-content: center;
    align-items: center;
}



.btn-primary:hover, .modal-btn-register:hover {
    background-color: var(--primary-color-dark);
}

.btn-secondary, .modal-btn-secondary {
    background-color: var(--text-secondary);
    color: #ffffff;
}

.btn-secondary:hover, .modal-btn-secondary:hover {
    background-color: #555555;
}

.btn-outline {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: #ffffff;
}


/* This rule can be general for all fixed buttons */
.fixed-action-btn {
    position: fixed;
    z-index: 1000;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    padding: 0;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s, opacity 0.3s, visibility 0.3s;
    /* Remove 'display: none;' here, it should only be set on a specific condition */
}

/* This is the button for the logged-out user, you can keep the styles here */
#mobileCopyTemplateBtn {
    bottom: 140px;
    right: 30px;
    background-color: var(--primary-color);
	display: none;
}

/* Add a specific rule for the logged-in user's button */
#mobileGoToTemplateBtn {
    bottom: 140px;
    right: 30px; /* Or whatever position you want */
	background-color: var(--primary-color);
    display: flex; /* Or 'block' to make it visible */
}



.fixed-action-btn .material-symbols-outlined {
    margin-right: 0;
    font-size: 28px;
    color: white;
}

.btn-copy-template {
    width: 100%;
	margin-bottom: 5px;
    background-color: var(--primary-color);
    color: #fff;
    box-shadow: var(--shadow-md);
    z-index: 1000;
}

.btn-copy-template:hover {
    background-color: var(--primary-color-dark);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.btn-copy-template .material-symbols-outlined { 
    font-size: 1.25rem; 
    margin-right: 8px; 
}

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--card-background);
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 500px;
    position: relative;
    animation-name: modalopen;
    animation-duration: 0.4s;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
    text-align: center;
}

.modal-text {
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: 24px;
    text-align: center;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.modal-buttons.justify-content-center {
    justify-content: center;
}

.modal-benefits-list {
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
    text-align: left;
}

.modal-benefits-list li {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    font-size: 15px;
    color: var(--text-primary);
}

.modal-benefits-list li .material-symbols-outlined {
    color: var(--secondary-color);
    margin-right: 10px;
    font-size: 20px;
}

.close-button {
    color: var(--text-secondary);
    font-size: 30px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 15px;
    cursor: pointer;
    transition: color 0.2s;
}

.close-button:hover {
    color: var(--text-primary);
}

@keyframes modalopen {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.page-wrapper {
    display: flex;
    justify-content: center;
    max-width: 1200px;
    margin: 50px auto 24px;
    gap: 20px;
    flex-wrap: wrap;
  
}

.custom-module-main-content {
    flex: 3;
    min-width: 800px;
    padding: 5px;
    border-radius: 8px;
    
}

.custom-module-sidebar {
    flex: 1;
    min-width: 300px;
    padding: 20px;
    border-radius: 8px;
}

.public-template-card, .sidebar-card {
    border: none !important;
    box-shadow: none !important;
    border-radius: 12px;
}

.sidebar {
	position: sticky; 
    top: 70px;
}

.highlight-text {
	margin-top: 10px;
    padding: 10px;
    background-color: #edeff5;
    color: #2c3e50;
    border-radius: 4px;
}

.template-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 24px;
    object-fit: cover;
    aspect-ratio: 16 / 9;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  font-size: 14px;
  color: #666;
}

.breadcrumb a {

  color: #007bff;         /* синий цвет ссылок */
  transition: color 0.2s; /* плавное наведение */
}

.breadcrumb a:hover {
  color: #0056b3;         /* темнее при наведении */
  text-decoration: none;
}

.breadcrumb a + a::before {
  content: "\203A"; /* вместо "›" */
  margin: 0 6px;
  color: #999;
}

		
/* ========================================================== */
/* СТИЛИ ДЛЯ ТОП ШАБЛОНОВ (ВЕРТИКАЛЬНЫЙ СПИСОК В САЙДБАРЕ)  */
/* ========================================================== */

/* Контейнер-список, который управляет расположением карточек */
.top-templates-grid {
    list-style: none; /* Убираем маркеры списка */
    padding: 0;
    margin: 0;
    display: flex; /* Используем Flexbox */
    flex-direction: column; /* Располагаем элементы друг под другом */
	align-items: center;
    gap: 1rem; /* Отступ между карточками */
}

/* Стили для каждой отдельной карточки шаблона */
.template-card {
	width: 280px; /* Установите фиксированную ширину, если это необходимо */
    height: 100%; /* Используйте одно значение для высоты */
    overflow: hidden;
    border-radius: 16px 16px 0 0;
    background-color: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
     /* Карточка занимает всю доступную ширину родителя */
    /* УБЕРИТЕ ЛЮБЫЕ ДРУГИЕ ФИКСИРОВАННЫЕ ЗНАЧЕНИЯ ШИРИНЫ */
}

/* Эффект при наведении */
.template-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* Ссылка внутри карточки */
.template-card a {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}

/* Изображение и его контейнер */


.template-card-image img {
    width: 100%; /* Устанавливаем ширину изображения на 100% от ширины его родительского контейнера */
    height: 100%; /* Устанавливаем высоту изображения на 100% от высоты родительского контейнера */
    object-fit: cover; /* Это ключевое свойство. Оно гарантирует, что изображение заполнит весь контейнер, сохраняя при этом свои пропорции. Если изображение не вписывается, оно будет обрезано. */
    object-position: center; /* Выравнивает изображение по центру контейнера. Можно использовать другие значения, например, 'top' или 'left'. */
}

.template-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Блок с заголовком и статистикой */
.template-card-body {
    padding: 12px;
}

.template-card-title {
    font-weight: bold;
    font-size: 16px;
    color: var(--text-color);
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.template-card-stats {
    display: flex;
    gap: 12px;
    font-size: 14px;
    color: var(--secondary-text-color);
}

/* Базовые стили для мобильных устройств */

.template-image-wrapper {
    margin-bottom: 15px;
    text-align: center;
}

.template-image-main {
    max-width: 100%;
    height: auto;
    display: block;
}

.template-text-wrapper {
    text-align: left;
}

.template-title {
    font-size: 1.5rem;
    margin-top: 0;
    margin-bottom: 5px;
	margin-top: 5px;
	font-weight: bold;
}

/* Отредактированные стили для описания */
.template-description {
    font-size: 1rem; /* Размер шрифта как в чеклисте */
    font-weight: 400; /* Толщина шрифта как в чеклисте */
    line-height: 1.5; /* Увеличенный межстрочный интервал */
    margin: 0;
}



/* Стили для десктопов и планшетов */
@media (min-width: 768px) {
    .template-content-container {
        overflow: hidden;
        padding: 0;
		 padding-top: 5px;
    }
	

	
.btn-primary {
    background-color: var(--primary-color);
    color: #ffffff;
	display: flex;
	margin-top: 5px;
    justify-content: center;
    align-items: center;
}

.btn-primary:hover, .modal-btn-register:hover {
    background-color: var(--primary-color-dark);
}

.template-image-wrapper {
        float: left;
        width: 40%;
        margin-right: 5px;
        margin-bottom: 10px;
        max-width: 300px;
}

.template-title {
        font-size: 1.5rem;
        margin-top: 0;
		padding-top: 5px;
}
    
    /* Стили для описания на десктопе, аналогичные мобильным */
.template-description {
        font-size: 1rem; /* Размер шрифта как в чеклисте */
        font-weight: 400; /* Толщина шрифта как в чеклисте */
        line-height: 1.5; /* Увеличенный межстрочный интервал */
    }


}


@media (min-width: 768px) {
            .public-template-card .template-image-wrapper {
                display: none;
            }
        }

/* =================================================== */
/* 1. БАЗОВЫЕ СТИЛИ ФОРМЫ И КОНТЕЙНЕРОВ               */
/* =================================================== */

.comment-section {
    margin-bottom: 20px;
}

/* Настройка контейнера формы для позиционирования оверлея */
.comment-form-relative {
    position: relative;
    padding: 0; 
}

/* Стиль поля ввода */
.comment-textarea {
    width: 100%;
    /* Фиксированная высота для точного позиционирования оверлея */
    height: 40px; 
    min-height: 40px; 
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    resize: none; /* Запрет изменения размера */
    /* Визуальный эффект неактивного поля */
    background-color: #f7f7f7; 
}

/* Блок действий (чекбокс и кнопка) */
.comment-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

/* Скрытие блока действий для гостей */
.comment-actions.hidden-for-guest {
    display: none;
}

/* =================================================== */
/* 2. СТИЛИ ОВЕРЛЕЯ (ЭФФЕКТ YOUTUBE ДЛЯ ГОСТЕЙ)        */
/* =================================================== */

.login-prompt-overlay {
    position: absolute;
    top: 20;
    left: 0;
    width: 100%; 
    /* Должна совпадать с height .comment-textarea */
    height: 40px; 
    
    background: transparent; /* Делаем его невидимым */
    border-radius: 4px;
    z-index: 5; /* Важно: должен быть выше textarea */
    cursor: pointer; /* Курсор указывает на кликабельность */
    
    display: flex;
    justify-content: center;
    align-items: center;
    border: none !important;
}

/* Стиль текста/ссылки внутри оверлея */
.login-prompt-overlay p {
    margin: 0;
    padding: 2px 8px; /* Небольшой паддинг вокруг текста */
  
    font-size: 1em;
    font-weight: 500;
    /* Фон для лучшей читаемости */
  
    border-radius: 3px;
}
.login-prompt-overlay a {
    text-decoration: none; 
    font-weight: bold;
}

/* =================================================== */
/* 3. ВИЗУАЛЬНЫЙ ЭФФЕКТ DISABLED-ЭЛЕМЕНТОВ             */
/* =================================================== */

/* Общий стиль для неактивных элементов */
.comment-textarea[disabled],
.comment-submit-btn[disabled],
.comment-reward-checkbox input[type="checkbox"]:disabled + label {
    opacity: 0.6; 
    cursor: default !important;
}

/* Дополнительный стиль для textarea, чтобы нельзя было выделить текст */
.comment-textarea[disabled] {
    pointer-events: none; 
}

/* =================================================== */
/* 4. СТИЛИ СПИСКА КОММЕНТАРИЕВ И СОРТИРОВКИ           */
/* =================================================== */

.comments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0 15px;
    font-weight: bold;
    border-bottom: 1px solid #eee; /* Разделитель */
    padding-bottom: 5px;
}



/* Стиль отдельного комментария */

.comment-meta {
    margin-bottom: 5px;
}

.comment-author {
    font-weight: bold;
    font-size: 1em;
}

.comment-date {
    font-weight: normal;
    color: #999;
    font-size: 0.9em;
    margin-left: 10px;
}

.comment-text p {
    margin: 0;
    line-height: 1.4;
}

.vote-login-message .login-prompt-vote.visible {
    display: block !important;
    opacity: 1 !important;
}

.login-prompt-vote a {
	    text-decoration: none; 
    font-weight: bold;
}

/* Стиль пагинации */
.pagination {
    margin-top: 20px;
    text-align: center;
	width: fit-content;
	margin-left: auto; /* Автоматический отступ слева */
    margin-right: auto; /* Автоматический отступ справа */
}

.page-link {
    display: inline-block;
    padding: 6px 10px;
    margin: 0 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #007bff;
    transition: background-color 0.2s;
}

.page-link:hover {
    background-color: #f0f0f0;
}

.page-link.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}



.template-title { 
    font-size: 2.5rem; 
    color: var(--text-primary); 
}
.template-meta { 
    font-size: 0.9rem; 
    color: var(--text-secondary); 
    margin-bottom: 24px; 

    padding-top: 16px; 
}

.checklist-heading { 
    font-size: 1.5rem; 
    font-weight: 500; 
    margin-bottom: 16px; 
    color: var(--primary-color); 
}


.checklist-items-list {    
    list-style: none;
    padding: 0;
    margin: 0;
}

.checklist-items-list > li {
    position: relative;
    padding: 12px 0;
    margin: 0;

    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: none;
}

.checklist-item-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding-left: 0;
}

.checklist-items-list li:last-child {
    border-bottom: none;
}
 
.checklist-items-list li.checked .item-text {
    text-decoration: line-through;
    color: var(--text-secondary);
    opacity: 0.7;
}
 
.checklist-items-list > li > ul {
    list-style: none;
    padding-left: 36px;
    margin-top: 12px;
}
 
.checklist-items-list > li > ul > li {
    padding: 8px 0;
  
    display: flex;
    align-items: flex-start;
    gap: 12px;
    position: relative;
}
 
.checklist-items-list > li > ul > li:last-child {
    border-bottom: none;
}
 
.item-number {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1rem;
    min-width: 25px;
    text-align: right;
    user-select: none;
}

.checklist-items-list > li > ul > li .item-number {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
    min-width: 35px;
}
 
.item-text {
    font-size: 1rem;
    line-height: 1.4;
    color: var(--text-primary);
    flex-grow: 1;
    display: block;
    user-select: none;
}
 
.item-description-block {
    margin-top: 0px;
    padding: 0 0 0 45px;
    border-left: none;
    background-color: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    white-space: pre-wrap;
	overflow-wrap: break-word; 
}

.checkbox-container {
    height: 20px;
    width: 20px;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;

    height: 100%; 
    width: 100%;
    top: 0;
    left: 0;

    z-index: 1; 
}

.checkbox-container .checkmark {
    height: 20px;
    width: 20px;
    background-color: #fff;
    border: 2px solid var(--border-color); /* Изначальный цвет */
    border-radius: 6px;
    display: block;
    transition: border-color 0.2s ease;
}


.checklist-item-content label.item-text-label {
    flex-grow: 1; /* Растягивается, чтобы заполнить оставшееся место */
    cursor: pointer; /* Обязательно для юзабилити */
}

/* Изменение рамки чекбокса при наведении на ВЕСЬ пункт 
   (даже если курсор не находится прямо над ним) */
.checklist-items-list > li:hover .checkmark {
    border-color: var(--accent-color, #007bff); /* Меняем цвет рамки на акцентный */
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 20px;
    width: 20px;
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    transition: all 0.2s ease;
}
 
.checkbox-container input:checked ~ .checkmark {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkmark:after {
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.comment-prompt-empty {
    /* Layout and Spacing */
    text-align: center;
    padding: 30px 20px; /* Ample padding for a clean, centered look */
    margin: 20px 0;    /* Separates it from other content */
    border-radius: 12px;

}


/* Контейнер для центрирования по вертикали и горизонтали */
.error-message-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(70vh - 120px); /* Учитывает высоту шапки и футера, скорректируйте если нужно */
    padding: 20px;
}

/* Карточка с сообщением об ошибке */
.error-message-card {
    background-color: #ffffff;
    border-radius: 12px;
    padding: 30px;
    text-align: center;
}

/* Текст ошибки */
.error-text {
    font-size: 1.25rem;
    color: #000; /* Красный цвет для акцента ошибки */
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Кнопка возврата */
.error-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 8px;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.error-btn:hover {
    background-color: #0056b3; /* Темнее при наведении */
    transform: translateY(-2px);
}

.error-btn:active {
    transform: translateY(0);
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .error-message-card {
        padding: 20px;
        max-width: 90%;
    }

    .error-text {
        font-size: 1.1rem;
    }

    .error-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

/* ========================================================== */
/* ОБНОВЛЕННЫЕ СТИЛИ ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ       */
/* ========================================================== */

@media (max-width: 992px) {
    .page-wrapper {
        flex-direction: column;
        max-width: 100%; /* Убираем фиксированную ширину, чтобы избежать скролла */
       padding: 10px 10px 0;
        margin: 40px auto 0;
    }

    .custom-module-main-content {
        min-width: unset;
        width: 100%; /* Занимает всю доступную ширину */
        max-width: 100%;
        padding: 0; /* Убираем внутренние отступы, если они есть */
        text-align: left; /* Убеждаемся, что текст выровнен по левому краю */
    }

    .custom-module-sidebar {
        width: 100%;
        padding: 0;
    }

    .sidebar-card {
        padding: 24px;
    }


    .item-description-block {
        padding-left: 45px;
    }
}

@media (max-width: 768px) {
    /* Дополнительные стили, если нужны, но обычно достаточно предыдущего медиазапроса */
    .custom-module-main-content {
        min-width: 0;
    }
}

/* ========================================================== */
/* ОБЯЗАТЕЛЬНО ПРОВЕРЬТЕ ЭТОТ БЛОК!                  */
/* ========================================================== */

/* Убедитесь, что заголовки и параграфы не центрированы */
.custom-module-main-content h1,
.custom-module-main-content p,
.custom-module-main-content ul,
.custom-module-main-content ol {
    text-align: left;
}



    .public-template-card { 
        padding: 0 2px; 
        border-radius: 0; 
        box-shadow: none; 
    }
    .template-title { 
        font-size: 1.5rem; 
    }
    .template-meta { 
        margin-bottom: 16px; 
    }
    .template-description { 
        font-size: 0.95rem; 
    }
    .app-header { 
        box-shadow: 0 1px 2px rgba(0,0,0,0.08); 
    }


    .item-number { 
        min-width: 20px; 
    }
    .checklist-items-list > li > ul > li .item-number { 
        min-width: 30px; 
    }
    .fixed-action-btn {
        display: flex;
    }




/* Общие стили для сайдбара */
.sidebar-info-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 8px;
    background-color: var(--white-color);
    box-shadow: var(--shadow-small);
}

.author-info, .stats-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.author-info .material-symbols-outlined,
.stats-info .material-symbols-outlined {
    color: var(--primary-color);
}

.stats-info {
    justify-content: space-between;
}

.stats-info div {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
}

//* Container for the entire rating section */
/* Общий контейнер для всего блока оценки */

body .main-content .rating-card {
    background-color: #ffffff;
    border-radius: 12px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); /* Тень для эффекта "парящей" карточки */
    margin: 5px; /* Внешние отступы */

    max-width: 350px;
}

.rating-card {
    display: flex;
    flex-direction: column;
    align-items: center; 
    background: #fff;
    margin: 5px; /* Внешние отступы */
    text-align: center;

}
/* Заголовок блока */
.rating-title-md {
	margin: 10px;
    font-size: 1rem;
    font-weight: 500;
    color: #424242; /* Тёмно-серый цвет */
    margin-bottom: 1rem;
}

/* Контейнер для кнопок */
.rating-block {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
	margin: 10px;
}

/* Группа кнопок */
.vote-buttons {
    display: flex;
    align-items: center;
    gap: 0.75rem; /* Увеличиваем расстояние между кнопками */
    width: 100%;
	margin: 5px; 
}

/* Общий стиль кнопок */
.vote-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 48px; /* Увеличиваем высоту для удобства нажатия */
    flex-grow: 1;
    padding: 0 1rem;
    border-radius: 24px;
    border: none;
    background-color: #f0f0f0;
    color: #757575;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, transform 0.1s;
    font-size: 1rem;
    font-weight: 500;
}

/* Контейнер для иконки и текста внутри кнопки лайка */
.likes-count-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Иконки */
.vote-btn i {
    font-size: 1.25rem;
}

/* Счётчик лайков */
.likes-count {
    font-weight: 600;
}

/* Эффект при наведении на кнопку */
.vote-btn:hover {
    background-color: #e0e0e0;
}

/* Выбранное состояние для кнопки лайка */
.like-btn.selected {
    color: #1a73e8; /* Синий, как в Material Design */
    background-color: #e8f0fe;
}

/* Выбранное состояние для кнопки дизлайка */
.dislike-btn.selected {
    color: #db4437; /* Красный */
    background-color: #fce8e6;
}

/* Эффект нажатия */
.vote-btn:active {
    transform: scale(0.98);
}

/* Container for all metadata */
.template-meta-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem; /* Space between elements */
    color: #606060;
    font-size: 0.9rem;
    padding-bottom: 5px;
}

/* Styles for the author info */
.author-info {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.author-info .material-symbols-outlined {
    font-size: 1.1rem;
}

.author-name {
    max-width: 80px; /* Set a max-width */
    white-space: nowrap; /* Prevent line breaks */
    overflow: hidden; /* Hide extra text */
    text-overflow: ellipsis; /* Add the ellipsis */
}

/* Vertical separator style */
.meta-separator {
    width: 1px;
    height: 12px;
    background-color: #d1d1d1;
    margin: 0 0.5rem;
}

/* Styles for stat items */
.stats-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stats-item i {
    font-size: 1.1rem;
}

.stat-count {
    font-weight: 500;
}

        .mobile-template-image-wrapper {
            display: block; /* По умолчанию показываем на мобильных */
            width: 100%;
            margin-bottom: 20px;
        }
        .mobile-template-image-wrapper picture,
        .mobile-template-image-wrapper img {
            width: 100%;
            height: auto;
            border-radius: 8px;
        }

        .sidebar-template-image-wrapper {
            display: none; /* По умолчанию скрываем */
            width: 100%; /* Устанавливаем ширину для контейнера */
            max-width: 320px; /* Ограничиваем максимальную ширину изображения */
            margin-bottom: 20px;
            /* Выравнивание по центру, если сайдбар шире изображения */
            margin-left: auto;
            margin-right: auto;
        }

        .sidebar-template-image-wrapper img {
            width: 100%; /* Изображение занимает всю доступную ширину контейнера (до 320px) */
            height: auto;
            border-radius: 8px;
        }

        @media (min-width: 768px) {
            .mobile-template-image-wrapper {
                display: none; /* Скрываем на десктопе */
            }
            .sidebar-template-image-wrapper {
                display: block; /* Показываем в сайдбаре на десктопе */
            }
        }
		
	/* Общая секция комментариев */


/* Форма отправки комментария */

.comment-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-top: -5px;
    opacity: 0;
    visibility: hidden;
    height: 0;
    overflow: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, height 0.3s ease;
}

.comment-reward-checkbox {
    display: flex;
	margin-left: 10px;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.comment-reward-checkbox input {
    width: 16px;
    height: 16px;
}

.comment-reward-checkbox label {
    cursor: pointer;
}

.comment-message {
    font-size: 14px;
    margin-top: 10px;
    color: var(--secondary-text-color);
}

/* Стили для списка комментариев */
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 12px; /* Уменьшаем отступ между комментариями */
}

.comment-item {
    background-color: var(--card-bg);
    border-radius: 16px;
  

}

.comment-date {
	color: #b7b7b7;
	font-weight: 300;
}

.comments-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 20px;
}



.sort-link {
    text-decoration: none;
    color: var(--secondary-text-color);
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.sort-link:hover {
    color: var(--text-color);
    border-color: var(--border-color);
}

.sort-link.active {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.sort-text {
    margin-right: 5px;
}

/* Стили для выпадающего списка */
#comment-sort-select {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--input-bg);
    color: var(--text-color);
    font-size: 14px;
    cursor: pointer;
    appearance: none; /* Убирает стандартную стрелку браузера */
}

/* Добавляем свою стрелку */
#comment-sort-select {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" fill="%23FFFFFF"><polygon points="0,0 10,0 5,10"/></svg>');
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 8px;
}

/* Общие стили для формы, как и ранее */
.comment-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 15px;
    background-color: var(--card-bg);
    border-radius: 16px;

}

/* Базовый стиль для textarea */
.comment-textarea {
    width: 100%;
    min-height: 40px; /* Минимальная высота как у строки */
    padding: 10px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background-color: var(--input-bg);
    color: var(--text-color);
    resize: none; /* Отключаем изменение размера */
    font-size: 16px;
    line-height: 1.4;
	box-sizing: border-box;
    transition: min-height 0.3s ease, border-color 0.1s ease;
}



/* Стили для кнопки, изначально она скрыта */
.comment-submit-btn {
    display: none;
    align-self: flex-end; /* Прижимает кнопку к правому краю */
    padding: 12px 24px;
    font-weight: bold;
    border-radius: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.comment-textarea:focus {
    /* Removes the browser's default outline */
    outline: none;
    
    /* Adds a new border with your accent color */
    border-color: var(--accent-color); 
    
    /* Adds a soft shadow (the "glow" effect) with your accent color */
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.5);
    
    /* Also make sure this is set on the main form for the expansion effect */
    transition: all 0.3s ease;
}

/* Состояние при фокусе на любом элементе внутри формы */
.comment-form:focus-within .comment-textarea {
    min-height: 120px; /* Увеличиваем высоту */
    resize: vertical; /* Включаем изменение размера */
	border-color: #cccccc;
}

.comment-form:focus-within .comment-submit-btn {
    display: block;
    opacity: 1;
}

.comment-form:focus-within .comment-actions {
    opacity: 1;
    visibility: visible;
    height: auto;
    overflow: visible;
    margin-top: 5px; /* Возвращаем отступ, когда блок виден */
}


.comment-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--secondary-text-color);
    margin-bottom: 8px;
    flex-wrap: wrap; /* Для мобильных устройств */
}

.comment-author {
    font-weight: 600;
    color: var(--text-color);
    font-size: 15px;
}

.comment-text p {
    margin: 0;
    line-height: 1.6;
    font-size: 15px;
}

    .top-templates-list-card .template-card-title {
        /* Разрешаем перенос текста */
        word-wrap: break-word;
        white-space: normal;
        overflow: visible;
        height: auto;
        min-height: auto;
    }

/* ---------------------------------
   Адаптивность для мобильных устройств
   --------------------------------- */

@media (max-width: 768px) {

#mobileCopyTemplateBtn {
    bottom: 240px;
    right: 30px;
    background-color: var(--primary-color);
	display: flex;
}

/* Add a specific rule for the logged-in user's button */
#mobileGoToTemplateBtn {
    bottom: 240px;
    right: 30px; /* Or whatever position you want */
	background-color: var(--primary-color);
    display: flex; /* Or 'block' to make it visible */
}


    .top-templates-list-card .top-templates-grid {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    .top-templates-list-card .template-card {
        display: flex;
        align-items: center;
        padding: 12px;
        background: #f8f9fa;
        border-radius: 8px;
        border: 1px solid #e9ecef;
    }
    
    .top-templates-list-card .template-card-image {
        display: none !important;
    }
    
    .top-templates-list-card .template-card-body {
        flex: 1;
        padding: 0;
    }
    
    .top-templates-list-card .template-card-title {
        font-size: 14px;
        font-weight: 500;
        margin-bottom: 4px;
        line-height: 1.3;
    }
    
    .top-templates-list-card .template-card-stats {
        display: flex;
        gap: 12px;
        font-size: 12px;
        color: #6c757d;
    }
    
    .top-templates-list-card .stat-views,
    .top-templates-list-card .stat-copies {
        display: flex;
        align-items: center;
        gap: 4px;
    }

    .comment-form {
        padding: 15px;
    }
    
    .comments-list {
        margin-top: 20px;
        gap: 10px;
    }

    .comment-actions {
        flex-direction: column-reverse; /* Меняем порядок: кнопка сверху, галочка снизу */
        align-items: stretch;
    }

    .comment-reward-checkbox {
        justify-content: flex-start; /* Выравниваем галочку слева */
    }

    .comment-meta {
        
        align-items: flex-start;
        gap: 4px;
    }

    .pagination {
        gap: 6px;
        margin-top: 20px;
    }

    .page-link {
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {

    .comment-author, .comment-text p {
        font-size: 14px;
    }

    .comment-textarea {
        font-size: 14px;
        min-height: 80px;
    }
}

.template-description2 {
  padding: 16px;
  border-radius: 12px;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.95rem;
  color: #222;
  background: linear-gradient(135deg, #f3f3f3 0%, #f1f7ff 100%);
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
  transition: transform .25s ease, box-shadow .25s ease;
  max-width: 700px;
  margin: 10px auto;
}

@media (prefers-color-scheme: dark) {
  .template-description2 {
    background: linear-gradient(135deg, #1b1f27 0%, #232834 100%);
    color: #f3f4f6;
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
  }
}
