/**
 * Taoh Function Toolkit - Comment Engine CSS
 * Lightweight, responsive comment system styles
 */

/* Comment Container */
.taoh-comments-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    max-width: 100%;
    margin: 20px auto;
    padding: 15px;
}

/* Comment Form */
.taoh-comment-form {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.taoh-comment-form h3 {
    font-size: 1.25rem;
    margin-bottom: 15px;
    color: #212529;
}

.taoh-comment-form textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    resize: vertical;
    font-family: inherit;
    margin-bottom: 10px;
}

.taoh-comment-form textarea:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.taoh-comment-form button {
    background: #0d6efd;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.taoh-comment-form button:hover {
    background: #0b5ed7;
}

.taoh-comment-form button:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* Comments List */
.taoh-comments-list {
    margin-top: 20px;
}

.taoh-comments-header {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: #212529;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.taoh-collapse-btn {
    background: transparent;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.taoh-collapse-btn:hover {
    background: #f8f9fa;
    border-color: #ced4da;
}

.taoh-collapse-icon {
    transition: transform 0.3s ease;
    color: #6c757d;
}

.taoh-comments-wrapper {
    overflow: hidden;
}

/* Individual Comment */
.taoh-comment {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    transition: box-shadow 0.2s;
}

.taoh-comment:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.taoh-comment.taoh-comment-deleted {
    opacity: 0.6;
    background: #f8f9fa;
}

.taoh-comment.taoh-comment-reported {
    border-color: #ffc107;
    background: #fff8e1;
}

/* Comment Header */
.taoh-comment-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.taoh-comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 12px;
    object-fit: cover;
}

.taoh-comment-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 12px;
    background: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
}

.taoh-comment-author {
    flex: 1;
}

.taoh-comment-author-name {
    font-weight: 600;
    color: #212529;
    text-decoration: none;
    font-size: 14px;
}

.taoh-comment-author-name:hover {
    color: #0d6efd;
}

.taoh-comment-time {
    font-size: 12px;
    color: #6c757d;
    margin-top: 2px;
}

.taoh-comment-edited {
    font-size: 11px;
    color: #6c757d;
    font-style: italic;
    margin-left: 5px;
}

/* Comment Body */
.taoh-comment-body {
    margin-bottom: 12px;
    color: #495057;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
}

/* Comment Actions */
.taoh-comment-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.taoh-comment-action {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    font-size: 13px;
    padding: 5px 10px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}

.taoh-comment-action:hover {
    background: #f8f9fa;
    color: #212529;
}

.taoh-comment-action.active {
    color: #0d6efd;
}

.taoh-comment-action svg {
    width: 16px;
    height: 16px;
}

/* Nested Replies */
.taoh-comment-replies {
    margin-left: 52px;
    margin-top: 15px;
}

.taoh-comment-reply-form {
    margin-left: 52px;
    margin-top: 15px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
}

.taoh-comment-reply-form textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 13px;
    resize: vertical;
    font-family: inherit;
    margin-bottom: 10px;
}

.taoh-comment-reply-form textarea:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.taoh-reply-actions {
    display: flex;
    gap: 10px;
}

.taoh-reply-actions button {
    padding: 6px 15px;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.taoh-reply-actions .btn-submit {
    background: #0d6efd;
    color: white;
}

.taoh-reply-actions .btn-submit:hover {
    background: #0b5ed7;
}

.taoh-reply-actions .btn-cancel {
    background: #6c757d;
    color: white;
}

.taoh-reply-actions .btn-cancel:hover {
    background: #5c636a;
}

/* Edit Form */
.taoh-comment-edit-form {
    margin-top: 10px;
}

.taoh-comment-edit-form textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    resize: vertical;
    font-family: inherit;
    margin-bottom: 10px;
}

.taoh-comment-edit-form textarea:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Pagination */
.taoh-comments-pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
}

.taoh-comments-pagination button {
    padding: 8px 16px;
    border: 1px solid #dee2e6;
    background: white;
    color: #495057;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.taoh-comments-pagination button:hover:not(:disabled) {
    background: #f8f9fa;
    border-color: #0d6efd;
    color: #0d6efd;
}

.taoh-comments-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.taoh-comments-pagination .page-info {
    display: flex;
    align-items: center;
    padding: 0 15px;
    color: #6c757d;
    font-size: 14px;
}

/* Loading State */
.taoh-comments-loading {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.taoh-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0d6efd;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: taoh-spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

/* Empty State */
.taoh-comments-empty {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .taoh-comments-container {
        padding: 10px;
    }

    .taoh-comment-replies {
        margin-left: 30px;
    }

    .taoh-comment-reply-form {
        margin-left: 30px;
    }

    .taoh-comment-avatar,
    .taoh-comment-avatar-placeholder {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .taoh-comment-actions {
        flex-wrap: wrap;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .taoh-comment-replies {
        margin-left: 15px;
    }

    .taoh-comment-reply-form {
        margin-left: 15px;
    }

    .taoh-comment-form,
    .taoh-comment {
        padding: 12px;
    }
}

/* Hide like and dislike buttons */
.taoh-comment-like,
.taoh-comment-dislike {
    display: none !important;
}

/* Reply Count */
.taoh-reply-count {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
    margin-bottom: 8px;
    padding: 4px 10px;
    background: #f8f9fa;
    border-radius: 12px;
    font-size: 13px;
    color: #6c757d;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.taoh-reply-count:hover {
    background: #e9ecef;
    color: #495057;
}

.taoh-reply-count svg {
    color: #6c757d;
}

.taoh-reply-toggle-icon {
    transition: transform 0.3s ease;
    margin-left: 2px;
}

/* Hide replies by default */
.taoh-replies-collapsed {
    display: none;
}

/* Login Overlay Styles */
.taoh-form-disabled {
    position: relative;
    pointer-events: none;
}

.taoh-form-disabled textarea,
.taoh-form-disabled button {
    opacity: 0.5;
    cursor: not-allowed;
}

.taoh-login-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    pointer-events: all;
    z-index: 10;
}

.taoh-login-message {
    text-align: center;
    padding: 30px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    max-width: 300px;
}

.taoh-login-message svg {
    color: #6c757d;
    margin-bottom: 15px;
}

.taoh-login-message p {
    font-size: 16px;
    color: #495057;
    margin: 0 0 20px 0;
    font-weight: 500;
}

.taoh-login-btn {
    background: #0d6efd;
    color: white;
    border: none;
    padding: 10px 30px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer !important;
    pointer-events: auto !important;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.3);
    text-decoration: none;
    display: inline-block;
}

.taoh-login-btn:hover {
    background: #0b5ed7;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.4);
}

.taoh-login-btn:active {
    transform: translateY(0);
    color: white !important;
}

.taoh-login-btn:visited {
    color: white !important;
}
