/**
 * Comments System Styles
 * CEO Collaboration Feature
 */

/* Comments Section Container */
.comments-section {
    background: var(--gray-50);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
}

.comments-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}

.comments-header h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.comments-header h4 i {
    color: var(--primary);
}

.comments-count {
    background: var(--primary);
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

/* Comments List */
.comments-list {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
}

/* Empty State */
.comments-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-500);
}

.comments-empty i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.comments-empty p {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
}

.comments-empty span {
    font-size: 14px;
}

/* Individual Comment */
.comment {
    display: flex;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid var(--gray-200);
}

.comment:last-child {
    border-bottom: none;
}

.comment-reply {
    margin-left: 52px;
    padding: 12px 0;
    border-bottom: none;
}

.comment-ceo {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-radius: 12px;
    padding: 16px;
    margin: 8px 0;
}

.comment-ceo .comment-text {
    background: rgba(255, 255, 255, 0.7);
    padding: 12px;
    border-radius: 8px;
}

/* Comment Avatar */
.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.comment-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.comment-avatar span {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
}

/* Comment Content */
.comment-content {
    flex: 1;
    min-width: 0;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.comment-author {
    font-weight: 600;
    color: var(--gray-800);
    font-size: 14px;
}

.comment-role-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.comment-role-badge.ceo {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.comment-role-badge.commercial {
    background: var(--primary-light);
    color: var(--primary);
}

.comment-date {
    font-size: 12px;
    color: var(--gray-500);
    margin-left: auto;
}

.comment-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.comment:hover .comment-actions {
    opacity: 1;
}

.comment-action {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.comment-action:hover {
    background: var(--gray-100);
    color: var(--gray-600);
}

.comment-action:hover i {
    color: var(--primary);
}

/* Comment Text */
.comment-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray-700);
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Comment Replies */
.comment-replies {
    margin-top: 12px;
    padding-left: 0;
}

.comment-reply-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    margin-top: 8px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.comment-reply-btn:hover {
    background: var(--primary-light);
}

/* Comment Forms */
.comments-form {
    border-top: 1px solid var(--gray-200);
    padding-top: 16px;
}

.comment-input-wrapper {
    display: flex;
    gap: 12px;
}

.comment-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.comment-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.comment-user-avatar span {
    font-size: 14px;
    font-weight: 600;
    color: white;
}

.comment-input-area {
    flex: 1;
}

.comment-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--gray-300);
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    transition: all 0.2s;
    background: white;
}

.comment-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.comment-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

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

.comment-edit-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
    margin-bottom: 8px;
}

.comment-edit-input:focus {
    outline: none;
    border-color: var(--primary);
}

.comment-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Reply Form */
.comment-reply-form {
    margin-top: 12px;
    padding: 12px;
    background: var(--gray-100);
    border-radius: 8px;
}

/* Button Styles */
.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* Scrollbar Styling */
.comments-list::-webkit-scrollbar {
    width: 6px;
}

.comments-list::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 3px;
}

.comments-list::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

.comments-list::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* Responsive */
@media (max-width: 640px) {
    .comments-section {
        padding: 16px;
    }

    .comment-reply {
        margin-left: 0;
        padding-left: 16px;
        border-left: 3px solid var(--gray-300);
    }

    .comment-actions {
        opacity: 1;
    }

    .comment-header {
        flex-wrap: wrap;
    }

    .comment-date {
        width: 100%;
        margin-left: 0;
        margin-top: 4px;
    }
}

/* CEO View Specific Styles */
body[data-user-role="ceo"] .comments-form {
    display: block;
    /* CEO can still comment */
}

body[data-user-role="ceo"] .comment-form-actions .btn-primary {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

body[data-user-role="ceo"] .comment-user-avatar {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

/* Tab Styles for Comments Section */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 20px;
}

.tab-btn {
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-600);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    color: var(--primary);
    background: var(--gray-50);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--primary-light);
}

.tab-badge {
    background: var(--primary);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Detail rows for lead/deal info */
.lead-detail-info,
.deal-detail-info {
    background: var(--gray-50);
    border-radius: 12px;
    padding: 20px;
}

.detail-row {
    display: flex;
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-200);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 600;
    color: var(--gray-600);
    width: 140px;
    flex-shrink: 0;
}

.detail-value {
    color: var(--gray-800);
    flex: 1;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}