/* Advanced Comments System Styles */

.comments-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #e1e5e9;
}

.comments-header {
    margin-bottom: 2rem;
}

.comments-header h3 {
    font-size: 1.5rem;
    color: #2c3e50;
    margin: 0;
    font-weight: 600;
}

/* Comment Form */
.comment-form-container {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border: 1px solid #e9ecef;
}

.comment-form-container h3 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
    font-size: 1.2rem;
}

.comment-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.comment-form .form-group {
    display: flex;
    flex-direction: column;
}

.comment-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.comment-form textarea {
    min-height: 100px;
    padding: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    transition: border-color 0.2s ease;
}

.comment-form textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.comment-form input[type="text"],
.comment-form input[type="email"] {
    padding: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
}

.comment-form input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.comment-form .form-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.comment-form .form-actions small {
    color: #6c757d;
    font-size: 0.8rem;
}

.login-prompt {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 1rem;
    text-align: center;
}

.login-prompt p {
    margin: 0;
    color: #856404;
}

.login-prompt a {
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
}

.login-prompt a:hover {
    text-decoration: underline;
}

.comments-disabled {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    color: #6c757d;
}

/* Comments List */
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.no-comments {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.no-comments i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-comments p {
    margin: 0;
    font-size: 1.1rem;
}

/* Individual Comment */
.comment {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1.5rem;
    transition: box-shadow 0.2s ease;
}

.comment:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.comment-author {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.author-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.author-avatar i {
    color: #6c757d;
    font-size: 1.2rem;
}

.author-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.author-name {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.95rem;
}

.comment-date {
    font-size: 0.8rem;
    color: #6c757d;
}

.comment-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-like,
.btn-reply {
    background: none;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.btn-like:hover,
.btn-reply:hover {
    background: #f8f9fa;
    border-color: #ced4da;
    color: #495057;
}

.btn-like.liked {
    background: #007bff;
    border-color: #007bff;
    color: #fff;
}

.btn-like.liked:hover {
    background: #0056b3;
    border-color: #0056b3;
}

.comment-content {
    margin-bottom: 1rem;
}

.comment-content p {
    margin: 0;
    line-height: 1.6;
    color: #2c3e50;
}

/* Reply Form */
.reply-form {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.reply-form .comment-form {
    margin: 0;
}

.reply-form textarea {
    min-height: 80px;
}

/* Comment Replies */
.comment-replies {
    margin-left: 2rem;
    margin-top: 1rem;
    padding-left: 1rem;
    border-left: 2px solid #e9ecef;
}

.comment-replies .comment {
    background: #f8f9fa;
    border-color: #e9ecef;
}

.comment-replies .comment-replies {
    margin-left: 1.5rem;
    padding-left: 0.75rem;
}

.comment-replies .comment-replies .comment {
    background: #fff;
}

/* Recent Comments Widget */
.widget.recent-comments {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.widget.recent-comments h4 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
    font-size: 1.1rem;
    font-weight: 600;
}

.widget.recent-comments ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.widget.recent-comments li {
    padding: 0.75rem 0;
    border-bottom: 1px solid #f1f3f4;
}

.widget.recent-comments li:last-child {
    border-bottom: none;
}

.widget.recent-comments .comment-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.widget.recent-comments .author {
    font-weight: 600;
    color: #2c3e50;
}

.widget.recent-comments .on {
    color: #6c757d;
}

.widget.recent-comments a {
    color: #007bff;
    text-decoration: none;
}

.widget.recent-comments a:hover {
    text-decoration: underline;
}

.widget.recent-comments .comment-excerpt {
    font-size: 0.8rem;
    color: #6c757d;
    line-height: 1.4;
}

/* Responsive Design */
@media (max-width: 768px) {
    .comment-form .form-row {
        grid-template-columns: 1fr;
    }
    
    .comment-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .comment-actions {
        align-self: flex-end;
    }
    
    .comment-replies {
        margin-left: 1rem;
        padding-left: 0.5rem;
    }
    
    .comment-replies .comment-replies {
        margin-left: 0.75rem;
        padding-left: 0.5rem;
    }
}

@media (max-width: 480px) {
    .comment {
        padding: 1rem;
    }
    
    .comment-form-container {
        padding: 1rem;
    }
    
    .author-avatar {
        width: 32px;
        height: 32px;
    }
    
    .comment-actions {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .btn-like,
    .btn-reply {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }
}

/* Animation for new comments */
.comment.new-comment {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading states */
.comment-form.loading {
    opacity: 0.6;
    pointer-events: none;
}

.comment-form.loading button {
    position: relative;
}

.comment-form.loading button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Success/Error messages */
.comment-message {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.comment-message.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.comment-message.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}
