/**
 * Comments System Styles
 * Community comment threads with two-level nesting
 */

/* Main Section */
.comment-section {
    width: 100%;
}

/* Composer */
.comment-composer {
    margin-bottom: 24px;
}

.comment-composer textarea {
    font-family: inherit;
    line-height: 1.5;
}

.comment-composer textarea:focus {
    outline: none;
}

.character-count {
    font-size: 13px;
    color: #6B7280; /* gray-500 */
}

.character-count.over-limit {
    color: #EF4444; /* red-500 */
    font-weight: 600;
}

/* Comment Thread */
.comment-thread {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Comment Item */
.comment-item {
    position: relative;
}

.comment-item.own {
    /* Optional: Subtle highlight for user's own comments */
}

.comment-item.comment-pending {
    opacity: 0.7;
}

/* Comment Header */
.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.comment-header .font-semibold {
    color: #111827; /* gray-900 */
    font-size: 14px;
}

.comment-header .text-sm {
    color: #9CA3AF; /* gray-400 */
    font-size: 13px;
}

.comment-header .text-xs {
    color: #9CA3AF;
    font-size: 12px;
}

/* Comment Body */
.comment-body {
    color: #374151; /* gray-700 */
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
}

.comment-body p {
    margin-bottom: 8px;
}

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

.comment-body a {
    color: #3B82F6; /* blue-500 */
    text-decoration: underline;
}

.comment-body a:hover {
    color: #2563EB; /* blue-600 */
}

/* Comment Actions */
.comment-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
}

.comment-actions button {
    background: none;
    border: none;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.comment-actions button:hover {
    transform: translateY(-1px);
}

.comment-actions button:active {
    transform: translateY(0);
}

.comment-actions button i {
    margin-right: 4px;
}

/* Nested Replies */
.comment-replies {
    margin-left: 48px;
    margin-top: 16px;
    padding-left: 16px;
    border-left: 2px solid #E5E7EB; /* gray-200 */
}

@media (max-width: 640px) {
    .comment-replies {
        margin-left: 32px;
        padding-left: 12px;
    }
}

/* Inline Forms */
.reply-form-inline,
.edit-form-inline {
    margin-top: 12px;
}

.reply-form-inline textarea,
.edit-form-inline textarea {
    font-family: inherit;
    line-height: 1.5;
}

.edit-form-inline {
    padding: 12px;
    background-color: #F9FAFB; /* gray-50 */
    border-radius: 8px;
}

/* Form Buttons */
.btn-primary {
    background-color: #3B82F6; /* blue-600 */
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: #2563EB; /* blue-700 */
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: #E5E7EB; /* gray-200 */
    color: #374151; /* gray-700 */
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-secondary:hover {
    background-color: #D1D5DB; /* gray-300 */
}

/* Loading State */
.comment-loading {
    padding: 24px;
}

.comment-loading .animate-pulse > div {
    background-color: #E5E7EB; /* gray-200 */
    height: 16px;
    border-radius: 4px;
    margin-bottom: 8px;
}

/* Empty State */
.comment-empty {
    padding: 48px 24px;
    text-align: center;
}

.comment-empty i {
    font-size: 48px;
    color: #D1D5DB; /* gray-300 */
    margin-bottom: 16px;
}

.comment-empty p {
    color: #6B7280; /* gray-500 */
}

/* Error State */
.comment-error {
    padding: 16px;
    background-color: #FEE2E2; /* red-100 */
    border: 1px solid #FCA5A5; /* red-300 */
    border-radius: 8px;
    color: #991B1B; /* red-800 */
}

/* Pending State Animation */
.comment-pending {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 0.7; transform: translateY(0); }
}

/* Pagination */
.comment-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #E5E7EB;
}

.comment-pagination button {
    padding: 8px 16px;
    background-color: #E5E7EB;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 14px;
}

.comment-pagination button:hover:not(:disabled) {
    background-color: #D1D5DB;
}

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

/* Avatar Circles */
.comment-item .w-10.h-10 {
    flex-shrink: 0;
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
    .comment-composer textarea {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .comment-item {
        font-size: 14px;
    }
    
    .comment-actions {
        flex-wrap: wrap;
    }
    
    .comment-actions button {
        font-size: 12px;
        padding: 4px 6px;
    }
}

/* Focus States for Accessibility */
textarea:focus,
button:focus {
    outline: 2px solid #3B82F6; /* blue-500 */
    outline-offset: 2px;
}

/* Smooth Transitions */
.comment-item,
.reply-form-inline,
.edit-form-inline {
    transition: all 0.3s ease;
}

/* Success Animation */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Loading Skeleton */
@keyframes skeleton-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.skeleton {
    animation: skeleton-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

