/*
 * УЛУЧШЕННЫЙ ДИЗАЙН БЛОКА КОММЕНТАРИЕВ
 * Современный, компактный и привлекательный дизайн для формы и списка комментариев
 */

/* ==========================================
   ОБЩИЕ СТИЛИ СЕКЦИИ КОММЕНТАРИЕВ
   ========================================== */

.comments-section {
    background: #f8fafc;
    padding: 3rem 0;
    margin-top: 3rem;
    border-top: 1px solid #e2e8f0;
}

.comments-area {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* ==========================================
   ЗАГОЛОВОК КОММЕНТАРИЕВ
   ========================================== */

.comments-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary, #2c3e50);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.comments-title::before {
    content: "💬";
    font-size: 1.2rem;
}

.comments-title .comments-count {
    background: var(--primary-color, #4a90e2);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* ==========================================
   ФОРМА КОММЕНТАРИЕВ - КОМПАКТНЫЙ ДИЗАЙН
   ========================================== */

#respond {
    background: linear-gradient(135deg, #f8faff, #eef7ff);
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
}

#reply-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary, #2c3e50);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#reply-title::before {
    content: "✍️";
    font-size: 1.1rem;
}

.comment-form {
    display: grid;
    gap: 1rem;
}

/* Компактное расположение полей имени и email */
.comment-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.comment-form .form-group {
    display: flex;
    flex-direction: column;
}

.comment-form input,
.comment-form textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background: white;
}

.comment-form input:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: var(--primary-color, #4a90e2);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
    transform: translateY(-1px);
}

.comment-form textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

/* Кнопка отправки */
.comment-form .btn {
    background: linear-gradient(135deg, var(--primary-color, #4a90e2), #357abd);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    justify-self: start;
    min-width: 180px;
    justify-content: center;
}

.comment-form .btn:hover {
    background: linear-gradient(135deg, #357abd, #2868a3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.comment-form .btn:active {
    transform: translateY(0);
}

/* ==========================================
   СПИСОК КОММЕНТАРИЕВ
   ========================================== */

.comment-list {
    list-style: none;
    padding: 0;
    margin: 2rem 0 0 0;
}

.comment-list .comment {
    background: #f9fafb;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--primary-color, #4a90e2);
    transition: all 0.3s ease;
}

.comment-list .comment:hover {
    background: #f1f5f9;
    transform: translateX(2px);
}

/* Мета информация комментария */
.comment-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.comment-author {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.comment-author .avatar {
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.comment-author .fn {
    font-weight: 600;
    color: var(--text-primary, #2c3e50);
    text-decoration: none;
}

.comment-metadata {
    color: var(--text-secondary, #6b7280);
    font-size: 0.85rem;
}

.comment-metadata a {
    color: inherit;
    text-decoration: none;
}

.comment-metadata a:hover {
    color: var(--primary-color, #4a90e2);
}

/* Содержимое комментария */
.comment-content {
    color: var(--text-primary, #2c3e50);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.comment-content p {
    margin-bottom: 1rem;
}

.comment-content p:last-child {
    margin-bottom: 0;
}

/* Ссылка ответа */
.reply {
    text-align: right;
}

.reply .comment-reply-link {
    color: var(--primary-color, #4a90e2);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    transition: all 0.3s ease;
}

.reply .comment-reply-link:hover {
    background: var(--primary-color, #4a90e2);
    color: white;
    transform: translateY(-1px);
}

.reply .comment-reply-link::before {
    content: "↩️";
    font-size: 0.8rem;
}

/* Вложенные комментарии */
.comment-list .children {
    margin-top: 1rem;
    margin-left: 2rem;
    padding-left: 1rem;
    border-left: 2px solid #e1e8ed;
}

.comment-list .children .comment {
    background: #ffffff;
    border-left-color: var(--secondary-color, #f39c12);
}

/* Сообщение об отсутствии комментариев */
.no-comments {
    text-align: center;
    color: var(--text-secondary, #6b7280);
    font-style: italic;
    padding: 2rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 2px dashed #e1e8ed;
}

/* ==========================================
   НАВИГАЦИЯ ПО КОММЕНТАРИЯМ
   ========================================== */

.comment-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2rem 0;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
}

.comment-navigation .nav-links {
    display: flex;
    gap: 1rem;
}

.comment-navigation a {
    color: var(--primary-color, #4a90e2);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.comment-navigation a:hover {
    background: var(--primary-color, #4a90e2);
    color: white;
}

/* ==========================================
   АДАПТИВНОСТЬ
   ========================================== */

@media (max-width: 768px) {
    .comments-area {
        margin: 0 1rem;
        padding: 1.5rem;
        border-radius: 12px;
    }
    
    #respond {
        padding: 1.5rem;
    }
    
    .comment-form .form-row {
        grid-template-columns: 1fr;
    }
    
    .comment-form .btn {
        justify-self: stretch;
    }
    
    .comment-list .children {
        margin-left: 1rem;
    }
    
    .comment-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .comments-title {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .comments-section {
        padding: 2rem 0;
    }
    
    .comments-area {
        margin: 0 0.5rem;
        padding: 1rem;
    }
    
    #respond {
        padding: 1rem;
    }
    
    .comment-list .comment {
        padding: 1rem;
    }
    
    .comment-list .children {
        margin-left: 0.5rem;
        padding-left: 0.5rem;
    }
}

/* ==========================================
   АНИМАЦИИ И ЭФФЕКТЫ
   ========================================== */

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.comment-list .comment {
    animation: slideIn 0.4s ease-out;
}

/* Эффект загрузки для формы */
.comment-form.submitting {
    opacity: 0.7;
    pointer-events: none;
}

.comment-form.submitting .btn::after {
    content: "";
    width: 16px;
    height: 16px;
    margin-left: 0.5rem;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================
   ТЕМНАЯ ТЕМА (ОПЦИОНАЛЬНО)
   ========================================== */

@media (prefers-color-scheme: dark) {
    .comments-section {
        background: #1a202c;
    }
    
    .comments-area {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    #respond {
        background: linear-gradient(135deg, #2d3748, #4a5568);
        border-color: #4a5568;
    }
    
    .comment-form input,
    .comment-form textarea {
        background: #1a202c;
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    .comment-list .comment {
        background: #1a202c;
        color: #e2e8f0;
    }
}