/* 
 * 评论协作系统样式 (Comments System CSS)
 * 风格：Linear (Precision & Engineered)
 */

/* 1. 悬浮工具栏 (Floating Toolbar) */
.comment-toolbar {
    position: fixed;
    bottom: 32px;
    right: 32px;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 999px; /* 胶囊形 */
    padding: 6px;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(0, 0, 0, 0.02);
    z-index: 10000;
    transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.comment-toolbar:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.12),
        0 0 0 1px rgba(0, 0, 0, 0.02);
}

.toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.toolbar-btn:hover {
    color: var(--color-text-primary);
    background-color: rgba(0, 0, 0, 0.04);
}

.toolbar-btn.active {
    color: #FFFFFF;
    background-color: var(--color-accent);
}

.toolbar-separator {
    width: 1px;
    height: 20px;
    background-color: rgba(0, 0, 0, 0.1);
    margin: 0 6px;
}

/* Tooltip */
.toolbar-btn[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 10px;
    padding: 6px 10px;
    background-color: #1A1D21;
    color: #FFFFFF;
    font-size: 12px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 1;
    pointer-events: none;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(4px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* 2. 元素高亮 (Highlighting) */
.comment-highlight {
    outline: 2px solid var(--color-accent) !important;
    outline-offset: -2px;
    cursor: crosshair !important;
    position: relative;
}

.comment-highlight::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 86, 210, 0.05);
    pointer-events: none;
    z-index: 9998;
}

/* 3. 评论 Pin (Marker) */
.comment-pin {
    position: absolute;
    width: 28px;
    height: 28px;
    background-color: var(--color-accent);
    border: 2px solid #FFFFFF;
    border-radius: 50% 50% 50% 0; /* 水滴形 */
    transform: rotate(-45deg) translate(-50%, -100%); /* 定位修正 */
    transform-origin: bottom left;
    box-shadow: 0 4px 12px rgba(0, 86, 210, 0.4);
    z-index: 20000; /* Increased z-index to be above sticky headers/sidebars */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.comment-pin span {
    transform: rotate(45deg); /* 文字转正 */
    color: #FFFFFF;
    font-size: 12px;
    font-weight: 700;
}

.comment-pin:hover, .comment-pin.active {
    transform: rotate(-45deg) scale(1.1) translate(-50%, -100%);
    z-index: 20002;
}

/* 4. 评论输入框与详情 (Popover) */
.comment-popover {
    position: absolute;
    width: 320px;
    background: #FFFFFF;
    border-radius: 12px;
    box-shadow: 
        0 12px 32px rgba(0, 0, 0, 0.12),
        0 0 0 1px rgba(0, 0, 0, 0.06);
    padding: 16px;
    z-index: 20001; /* Above Pins but below active Pin */
    animation: popIn 0.2s cubic-bezier(0.2, 0, 0, 1);
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--color-text-tertiary);
}

.comment-textarea {
    width: 100%;
    min-height: 80px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 10px;
    font-family: inherit;
    font-size: 14px;
    resize: none;
    outline: none;
    margin-bottom: 12px;
    background-color: var(--color-bg-secondary);
    transition: all 0.2s;
}

.comment-textarea:focus {
    background-color: #FFFFFF;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px rgba(0, 86, 210, 0.1);
}

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

.comment-btn {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-cancel {
    background: transparent;
    color: var(--color-text-secondary);
}

.btn-cancel:hover {
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
}

.btn-submit {
    background: var(--color-accent);
    color: #FFFFFF;
}

.btn-submit:hover {
    background: var(--color-accent-hover);
}

/* 查看模式 */
.comment-view-content {
    font-size: 14px;
    color: var(--color-text-primary);
    line-height: 1.5;
    margin-bottom: 16px;
}

.comment-meta {
    font-size: 12px;
    color: var(--color-text-tertiary);
    margin-bottom: 12px;
}

.comment-view-actions {
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid var(--color-border);
    padding-top: 12px;
}

.btn-delete {
    color: #EF4444; /* Red */
    background: transparent;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    border: none;
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* 隐藏文件输入框 */
#import-file-input {
    display: none;
}

/* Toast 提示 */
.comment-toast {
    position: fixed;
    bottom: 90px;
    right: 32px;
    background-color: #1A1D21;
    color: #FFFFFF;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10005;
    animation: slideUp 0.3s cubic-bezier(0.2, 0, 0, 1);
    display: flex;
    align-items: center;
    gap: 8px;
}

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