/* static/css/comment/paragraph-comment.css */

/* ===== 圖片預覽容器 ===== */
.preview-container {
    position: relative;
    display: inline-block;
}

.preview-container img {
    max-width: 100px;
    max-height: 100px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.remove-image-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #f44336;
    color: white;
    border: 2px solid white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s;
    padding: 0;
    line-height: 1;
}

.remove-image-btn:hover {
    background: #d32f2f;
    transform: scale(1.1);
}

/* ===== 閱讀器段落樣式 ===== */
.paragraph-wrapper {
    position: relative;
    margin-bottom: 25px;
}

.paragraph-text {
    margin: 0;
    padding-right: 80px;
    font-size: inherit !important;
    line-height: inherit !important;
}

.paragraph-wrapper p {
    font-size: inherit !important;
    line-height: inherit !important;
}

/* ===== 段落評論數字標籤 ===== */
.paragraph-comment-badge {
    position: absolute;
    right: 0;
    top: 0;
    background: #f0f0f0;
    color: #666;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.paragraph-comment-badge:hover {
    background: #ff6b6b;
    color: white;
}

.paragraph-comment-badge.has-comments {
    background: #ff6b6b;
    color: white;
}

/* ===== 右側評論面板 ===== */
.comment-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.comment-panel.open {
    right: 0;
    z-index: 100000 !important;
}

.comment-panel-header {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.comment-panel-header h3 {
    margin: 0;
    font-size: 18px;
}

.close-panel {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
}

.close-panel:hover {
    color: #dc3545;
}

/* ===== 遮罩層 ===== */
.panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.3);
    z-index: 99999;
    display: none;
}

.panel-overlay.show {
    display: block;
}

/* ===== 評論列表 ===== */
.comment-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.comment-item {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.comment-item.reply {
    margin-left: 34px;
    padding-left: 12px;
    border-left: 2px solid #dee2e6;
}

.comment-header {
    display: flex;
    align-items: flex-start;
    margin-bottom: 8px;
}

.comment-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    margin-right: 8px;
}

.comment-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.comment-avatar-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.comment-header-content {
    flex: 1;
    min-width: 0;
}

.comment-user-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 2px;
}

.comment-user-info {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.comment-user {
    font-weight: 600;
    font-size: 13px;
    color: #212529;
}

.comment-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.reply-hint {
    font-size: 11px;
    color: #1976d2;
    background: #e3f2fd;
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.comment-time {
    font-size: 11px;
    color: #adb5bd;
    white-space: nowrap;
    flex-shrink: 0;
}

.comment-item .fan-badge,
.comment-item .reader-badge,
.comment-item .author-badge {
    font-size: 11px;
    padding: 3px 8px;
    display: inline-block;
    line-height: 1.4;
    white-space: nowrap;
    border-radius: 12px;
    margin-left: 4px;
}

.comment-content {
    font-size: 14px;
    line-height: 1.6;
    margin: 8px 0;
    word-wrap: break-word;
}

.mention {
    background-color: #e3f2fd;
    color: #1976d2;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 500;
}

.comment-image {
    margin: 8px 0;
}

.comment-image img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 4px;
}

.comment-footer {
    display: flex;
    gap: 15px;
    margin-top: 8px;
}

.comment-action {
    background: none;
    border: none;
    color: #6c757d;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0;
}

.comment-action:hover {
    color: #1976d2;
}

.comment-action.liked {
    color: #dc3545;
}

/* ===== 評論輸入區 ===== */
.comment-input-area {
    padding: 16px;
    border-top: 1px solid #e0e0e0;
    background: #fafafa;
}

.comment-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    resize: vertical;
    font-size: 14px;
    line-height: 1.5;
    transition: border-color 0.2s;
    box-sizing: border-box;
    margin-bottom: 0;
}

.comment-textarea:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.1);
}

/* ===== 回覆提示條 ===== */
.reply-hint-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #e3f2fd;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #1976d2;
    border-left: 3px solid #1976d2;
}

.reply-hint-bar span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.reply-hint-bar span::before {
    content: "💬";
    margin-right: 4px;
}

.cancel-reply-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.cancel-reply-btn:hover {
    background: #ffebee;
    color: #d32f2f;
}

/* ===== 工具欄 ===== */
.comment-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

.image-upload-btn {
    cursor: pointer;
    color: #555;
    padding: 8px 12px;
    border-radius: 6px;
    background: #f0f0f0;
    font-size: 13px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.image-upload-btn:hover {
    background: #e0e0e0;
}

.image-upload-btn i {
    font-size: 14px;
}

.submit-btn {
    padding: 8px 20px;
    background: #1976d2;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    min-width: 100px;
}

.submit-btn:hover {
    background: #1565c0;
}

.submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.7;
}

/* ===== 圖片預覽 ===== */
.image-preview {
    margin-top: 10px;
}

.image-preview img {
    max-width: 100px;
    max-height: 100px;
    border-radius: 4px;
}

/* ===== 未登入提示 ===== */
.login-to-comment {
    text-align: center;
    padding: 20px 16px;
    color: #666;
}

.login-to-comment i {
    display: block;
    margin-bottom: 8px;
    color: #ccc;
}

.login-to-comment p {
    margin-bottom: 12px;
    font-size: 14px;
}

.login-to-comment .btn {
    display: inline-block;
    padding: 8px 20px;
    background: #1976d2;
    color: white;
    border-radius: 20px;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s;
}

.login-to-comment .btn:hover {
    background: #1565c0;
}

/* ===== 排序按鈕 ===== */
.sort-buttons {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.sort-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.sort-btn:hover {
    background: #f5f5f5;
}

.sort-btn.active {
    background: #1976d2;
    color: white;
    border-color: #1976d2;
}

/* ===== 載入狀態 ===== */
.loading {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.loading.error {
    color: #dc3545;
}

/* ===== 空狀態 ===== */
.empty-comments {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* ===== 模態框層級 ===== */
.modal {
    z-index: 100001 !important;
}

.modal-backdrop {
    z-index: 100000 !important;
}

.report-link {
    text-decoration: none;
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 4px;
}

.report-link:hover {
    color: #dc3545;
}



/* 段評用戶連結 */
.comment-user-link {
    text-decoration: none;
    color: inherit;
}

.comment-user-link:hover {
    color: #667eea;
}

/* 頭像連結 */
.comment-avatar a {
    display: block;
    text-decoration: none;
}

.comment-avatar a:hover {
    opacity: 0.9;
}

/* 回覆提示中的 mention */
.reply-hint {
    font-size: 11px;
    color: #1976d2;
    background: #e3f2fd;
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 舉報連結 */
.report-link {
    text-decoration: none;
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 4px;
}

.report-link:hover {
    color: #dc3545;
}

/* 禁言提示樣式 */
.muted-notice {
    background: #fff3cd;
    border-top: 1px solid #ffc107;
    padding: 1rem;
    text-align: center;
}

.muted-notice i {
    color: #dc3545;
}

.muted-notice p {
    margin-bottom: 0.25rem;
}