/**
 * iBestContentBuilder Plugin Styles
 * 整合 TinyMCE 上架神器版型插件的所有樣式
 * 
 * @version 1.0.0
 * @author iBest Tech Team
 */

/* ========================================
 * 側邊欄主容器
 * ======================================== */
.ibest-contentbuilder-sidebar {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 350px;
    background: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* ========================================
 * 標題區域
 * ======================================== */
.ibest-contentbuilder-sidebar .sidebar-header {
    padding: 16px;
    border-bottom: 1px solid #e0e0e0;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ibest-contentbuilder-sidebar .sidebar-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333333;
    flex: 1;
}

/* 關閉按鈕 */
.ibest-contentbuilder-sidebar .sidebar-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    margin-left: 12px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    background: #ffffff;
    color: #666666;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.ibest-contentbuilder-sidebar .sidebar-close-btn:hover {
    background: #f0f0f0;
    border-color: #999999;
    color: #333333;
}

.ibest-contentbuilder-sidebar .sidebar-close-btn:active {
    background: #e0e0e0;
    transform: scale(0.95);
}

.ibest-contentbuilder-sidebar .sidebar-close-btn svg {
    display: block;
    pointer-events: none;
}

/* ========================================
 * 篩選區域
 * ======================================== */
.ibest-contentbuilder-sidebar .sidebar-filters {
    padding: 12px 16px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fafafa;
}

.ibest-contentbuilder-sidebar .category-select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    background: #ffffff;
    font-size: 14px;
    color: #333333;
    cursor: pointer;
    transition: border-color 0.2s;
}

.ibest-contentbuilder-sidebar .category-select:hover {
    border-color: #999999;
}

.ibest-contentbuilder-sidebar .category-select:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1);
}

.ibest-contentbuilder-sidebar .category-select:disabled {
    background: #f0f0f0;
    cursor: not-allowed;
    opacity: 0.6;
}

.ibest-contentbuilder-sidebar .template-count {
    font-size: 12px;
    color: #666666;
    white-space: nowrap;
}

/* ========================================
 * 內容區域
 * ======================================== */
.ibest-contentbuilder-sidebar .sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    contain: layout style paint;
    /* 效能優化 */
    transform: translateZ(0);
    /* 創建合成層 */
    will-change: scroll-position;
}

/* 自訂滾動條 */
.ibest-contentbuilder-sidebar .sidebar-content::-webkit-scrollbar {
    width: 8px;
}

.ibest-contentbuilder-sidebar .sidebar-content::-webkit-scrollbar-track {
    background: #f0f0f0;
}

.ibest-contentbuilder-sidebar .sidebar-content::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-radius: 4px;
}

.ibest-contentbuilder-sidebar .sidebar-content::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

/* Safari 14 以下降級樣式 */
@supports not (contain: layout) {
    .ibest-contentbuilder-sidebar .sidebar-content {
        overflow: hidden;
    }
}

/* ========================================
 * 版型網格
 * ======================================== */
.ibest-contentbuilder-sidebar .templates-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
}

/* ========================================
 * 版型項目
 * ======================================== */
.ibest-contentbuilder-sidebar .template-item {
    position: relative; /* 為浮動按鈕提供定位基準 */
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    background: #ffffff;
    contain: layout style;
    /* 效能優化 */
    transform: translateZ(0);
    /* 創建合成層 */
    will-change: transform;
}

.ibest-contentbuilder-sidebar .template-item:hover {
    border-color: #0066cc;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.ibest-contentbuilder-sidebar .template-item:active {
    transform: translateY(0);
}

/* 圖片容器 */
.ibest-contentbuilder-sidebar .template-item-image {
    position: relative;
    width: 100%;
    height: 120px;
    overflow: hidden;
}

.ibest-contentbuilder-sidebar .template-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: #f5f5f5;
}

.ibest-contentbuilder-sidebar .template-name {
    padding: 8px;
    font-size: 13px;
    color: #333333;
    text-align: center;
    background: #fafafa;
    border-top: 1px solid #e0e0e0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 插入按鈕 - 漂浮在圖片上方 */
.ibest-contentbuilder-sidebar .template-insert-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    background: rgba(0, 102, 204, 0.95);
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10;
    white-space: nowrap;
}

/* Hover 時顯示按鈕 */
.ibest-contentbuilder-sidebar .template-item:hover .template-insert-btn {
    opacity: 1;
    pointer-events: auto;
}

.ibest-contentbuilder-sidebar .template-insert-btn:hover {
    background: rgba(0, 82, 163, 0.95);
    transform: translate(-50%, -50%) scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.ibest-contentbuilder-sidebar .template-insert-btn:active {
    background: rgba(0, 61, 122, 0.95);
    transform: translate(-50%, -50%) scale(0.98);
}

.ibest-contentbuilder-sidebar .template-insert-btn svg {
    display: block;
    flex-shrink: 0;
}

/* Hover 時圖片變暗效果 */
.ibest-contentbuilder-sidebar .template-item:hover .template-item-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    transition: background 0.3s ease;
    z-index: 5;
}

/* Safari 14 以下降級樣式 */
@supports not (contain: layout) {
    .ibest-contentbuilder-sidebar .template-item {
        isolation: isolate;
    }
}

/* ========================================
 * 載入中狀態
 * ======================================== */
.ibest-contentbuilder-sidebar .loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #666666;
}

.ibest-contentbuilder-sidebar .loading-state .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f0f0f0;
    border-top-color: #0066cc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.ibest-contentbuilder-sidebar .loading-state p {
    margin: 0;
    font-size: 14px;
}

/* ========================================
 * 空狀態
 * ======================================== */
.ibest-contentbuilder-sidebar .empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999999;
}

.ibest-contentbuilder-sidebar .empty-state p {
    margin: 0;
    font-size: 14px;
}

/* ========================================
 * 錯誤狀態
 * ======================================== */
.ibest-contentbuilder-sidebar .error-state {
    text-align: center;
    padding: 40px 20px;
    color: #cc0000;
}

.ibest-contentbuilder-sidebar .error-state .error-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.ibest-contentbuilder-sidebar .error-state p {
    margin: 0 0 16px 0;
    font-size: 14px;
}

.ibest-contentbuilder-sidebar .error-state .retry-button {
    padding: 8px 16px;
    border: 1px solid #cc0000;
    border-radius: 4px;
    background: #ffffff;
    color: #cc0000;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.ibest-contentbuilder-sidebar .error-state .retry-button:hover {
    background: #cc0000;
    color: #ffffff;
}

/* ========================================
 * 響應式調整
 * ======================================== */
@media (max-width: 480px) {
    .ibest-contentbuilder-sidebar .templates-grid {
        gap: 12px;
    }

    .ibest-contentbuilder-sidebar .template-item img {
        height: 100px;
    }
}

/* ========================================
 * 插入位置標示線
 * ======================================== */
/* 入場動畫：矩形從頂部向下展開 */
@keyframes cbIndicatorEnter {
    from {
        transform: scaleY(0);
        opacity: 0;
    }
    to {
        transform: scaleY(1);
        opacity: 1;
    }
}

/* 光暈流動：亮光從左向右掃過（用在頂部條）*/
@keyframes cbIndicatorShimmer {
    0%   { background-position:  -80% center; }
    100% { background-position: 180% center; }
}

.insert-indicator {
    position: absolute;
    left: 20px;
    right: 20px;
    height: 52px;
    /* 矩形主體：均勻淺藍底色，覆蓋重疊的內容也清晰可見 */
    background: rgba(220, 236, 255, 0.92);
    border: 1px solid rgba(0, 102, 204, 0.30);
    border-top: none; /* 頂部由 ::before 負責 */
    border-radius: 0 0 6px 6px;
    pointer-events: none;
    z-index: 1000;
    transition: top 0.08s ease-out;
    transform-origin: center top;  /* 從頂部展開 */
    will-change: top;
    box-shadow: 0 6px 18px rgba(0, 102, 204, 0.15);
    animation: cbIndicatorEnter 0.18s cubic-bezier(0.34, 1.3, 0.64, 1) forwards;
}

/* 頂部光暈條（3px，帶 shimmer 動畫）*/
.insert-indicator::before {
    content: '';
    position: absolute;
    top: -1px;   /* 與 border 無縫銜接 */
    left: -1px;
    right: -1px;
    height: 3px;
    background: linear-gradient(
        90deg,
        #0044bb 0%,
        #0066cc 25%,
        #80c8ff 50%,
        #0066cc 75%,
        #0044bb 100%
    );
    background-size: 300% 100%;
    border-radius: 3px 3px 0 0;
    box-shadow: 0 0 10px rgba(0, 102, 204, 0.5);
    animation: cbIndicatorShimmer 1.8s ease-in-out 0.1s infinite;
}

/* 矩形主體光帶：白色高光與頂部條同步掃過 */
.insert-indicator::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent               0%,
        transparent              28%,
        rgba(255, 255, 255, 0.5) 50%,
        transparent              72%,
        transparent             100%
    );
    background-size: 300% 100%;
    border-radius: 0 0 5px 5px;
    animation: cbIndicatorShimmer 1.8s ease-in-out 0.1s infinite;
}

/* 高對比模式支援 */
@media (prefers-contrast: high) {
    .insert-indicator {
        border: 2px solid #000000;
        background: rgba(0, 0, 0, 0.06);
    }
    .insert-indicator::before {
        background: #000000;
    }
}

/* ========================================
 * 插入位置提示標籤
 * ======================================== */
.insert-position-tooltip {
    position: absolute;
    padding: 6px 12px;
    background: rgba(0, 102, 204, 0.95);
    color: #ffffff;
    font-size: 12px;
    font-weight: 500;
    border-radius: 4px;
    pointer-events: none;
    z-index: 1001;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ========================================
 * 浮動排序按鈕
 * ======================================== */
.contentbuilder-floating-buttons {
    position: absolute;
    right: -50px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out;
    z-index: 1000;
}

.contentbuilder-floating-buttons.show {
    opacity: 1;
    pointer-events: auto;
}

.contentbuilder-floating-buttons button {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 6px;
    background: #0066cc;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.3);
}

.contentbuilder-floating-buttons button:hover:not(.disabled) {
    background: #0052a3;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.4);
}

.contentbuilder-floating-buttons button:active:not(.disabled) {
    transform: scale(0.95);
}

.contentbuilder-floating-buttons button.disabled {
    background: #cccccc;
    cursor: not-allowed;
    opacity: 0.5;
    box-shadow: none;
}

/* 原始碼編輯按鈕特殊樣式 */
.contentbuilder-floating-buttons .edit-source-btn {
    background: #6c757d;
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.3);
}

.contentbuilder-floating-buttons .edit-source-btn:hover {
    background: #5a6268;
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.4);
}

/* 複製區塊按鈕特殊樣式 - Bootstrap warning 黃色 */
.contentbuilder-floating-buttons .duplicate-block-btn {
    background: #ffc107;
    color: #000000;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
}

.contentbuilder-floating-buttons .duplicate-block-btn:hover {
    background: #ffca2c;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4);
}

.contentbuilder-floating-buttons .duplicate-block-btn:active {
    background: #e0a800;
}

/* 移除區塊按鈕特殊樣式 - 紅色 */
.contentbuilder-floating-buttons .remove-block-btn {
    background: #dc3545;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.contentbuilder-floating-buttons .remove-block-btn:hover {
    background: #c82333;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.contentbuilder-floating-buttons .remove-block-btn:active {
    background: #bd2130;
}

/* ========================================
 * 分隔線區塊 - 編輯器內特殊處理
 * 為 hr 添加足夠的高度讓懸浮按鈕可以顯示
 * ======================================== */
hr.contentBuilder,
hr.contentbuilder-block {
    /* 將 hr 轉為 block 並設定足夠高度 */
    display: block;
    position: relative;
    height: auto;
    min-height: 60px;
    margin: 0;
    padding: 25px 0;
    border: none;
    background: transparent;
    box-sizing: border-box;
}

/* 使用偽元素繪製實際的分隔線 */
hr.contentBuilder::before,
hr.contentbuilder-block::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 1px;
    background-color: #ccc;
}

/* Hover 時顯示可操作區域提示 */
hr.contentBuilder:hover,
hr.contentbuilder-block:hover {
    background-color: rgba(0, 102, 204, 0.05);
}

/* ========================================
 * 區塊移動動畫
 * ======================================== */
/* 基礎 opacity transition — 確保拖曳結束後各區塊能平滑淡回 */
.contentbuilder-block {
    transition: opacity 0.15s ease;
}

.contentBuilder.block-moving,
.contentbuilder-block.block-moving {
    transition: transform 0.3s ease-out, opacity 0.15s ease;
}

.contentBuilder.has-floating-buttons,
.contentbuilder-block.has-floating-buttons {
    outline: 2px solid rgba(0, 102, 204, 0.3);
    outline-offset: 2px;
}

.contentBuilder.block-will-move,
.contentbuilder-block.block-will-move {
    animation: blockPulse 0.3s ease-in-out;
}

.contentBuilder.block-moved-highlight,
.contentbuilder-block.block-moved-highlight {
    animation: blockHighlight 1s ease-in-out;
}

/* 區塊移除動畫 */
.contentBuilder.block-removing,
.contentbuilder-block.block-removing {
    animation: blockRemove 0.3s ease-in-out forwards;
}

/* 移除動畫 - 淡出並縮小 */
@keyframes blockRemove {
    0% {
        opacity: 1;
        transform: scale(1);
        background-color: rgba(220, 53, 69, 0.1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.98);
        background-color: rgba(220, 53, 69, 0.2);
    }

    100% {
        opacity: 0;
        transform: scale(0.95);
        max-height: 0;
        padding: 0;
        margin: 0;
        overflow: hidden;
    }
}

/* 脈衝動畫 - 準備移動時 */
@keyframes blockPulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(0, 102, 204, 0);
    }

    50% {
        transform: scale(1.02);
        box-shadow: 0 0 0 8px rgba(0, 102, 204, 0.3);
    }
}

/* 高亮動畫 - 移動完成後 */
@keyframes blockHighlight {
    0% {
        background-color: rgba(0, 102, 204, 0.15);
        box-shadow: 0 0 0 0 rgba(0, 102, 204, 0.5);
    }

    25% {
        background-color: rgba(0, 102, 204, 0.25);
        box-shadow: 0 0 0 10px rgba(0, 102, 204, 0.3);
    }

    50% {
        background-color: rgba(0, 102, 204, 0.15);
        box-shadow: 0 0 0 15px rgba(0, 102, 204, 0.1);
    }

    100% {
        background-color: transparent;
        box-shadow: 0 0 0 20px rgba(0, 102, 204, 0);
    }
}

/* ========================================
 * 插入預覽區塊樣式
 * ======================================== */

/* 預覽區塊淡入動畫 */
@keyframes fadeInPreview {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 預覽內容區域 */
.contentbuilder-insert-preview .preview-content {
    padding: 16px;
}

/* 預覽標題區域 */
.contentbuilder-insert-preview .preview-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

/* 預覽圖示 */
.contentbuilder-insert-preview .preview-icon {
    font-size: 20px;
    margin-right: 12px;
    opacity: 0.8;
}

/* 預覽資訊 */
.contentbuilder-insert-preview .preview-info {
    flex: 1;
}

/* 預覽標題 */
.contentbuilder-insert-preview .preview-title {
    font-weight: bold;
    color: #0066cc;
    font-size: 14px;
    margin-bottom: 2px;
}

/* 預覽副標題 */
.contentbuilder-insert-preview .preview-subtitle {
    color: #666;
    font-size: 12px;
}

/* 預覽徽章 */
.contentbuilder-insert-preview .preview-badge {
    background: #0066cc;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
}

/* 預覽主體 */
.contentbuilder-insert-preview .preview-body {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    padding: 12px;
    border: 1px solid rgba(0, 102, 204, 0.2);
}

/* 預覽佔位元素容器 */
.contentbuilder-insert-preview .preview-placeholder {
    padding: 8px 0;
}

/* 佔位線條 */
.contentbuilder-insert-preview .placeholder-line {
    height: 8px;
    background: linear-gradient(90deg, #e0e0e0, #f0f0f0, #e0e0e0);
    border-radius: 4px;
    margin-bottom: 6px;
    animation: shimmer 1.5s infinite;
}

/* 佔位線條長度變化 */
.contentbuilder-insert-preview .placeholder-line.long {
    width: 85%;
}

.contentbuilder-insert-preview .placeholder-line.medium {
    width: 65%;
}

.contentbuilder-insert-preview .placeholder-line.short {
    width: 45%;
}

/* 佔位圖片 */
.contentbuilder-insert-preview .placeholder-image {
    width: 60px;
    height: 40px;
    background: linear-gradient(135deg, #e0e0e0, #f0f0f0);
    border-radius: 6px;
    margin-top: 8px;
    position: relative;
}

.contentbuilder-insert-preview .placeholder-image::before {
    content: '🖼️';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    opacity: 0.6;
}

/* 閃爍動畫 */
@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

/* ========================================
 * TinyMCE iframe body 定位基礎
 * 讓 insert-indicator (position:absolute) 能相對於 body 定位
 * ======================================== */
body.mce-content-body {
    position: relative;
}

/* ========================================
 * 拖曳排序 - 區塊把手 (Notion 風格)
 * ======================================== */
.cb-drag-handle {
    position: absolute;
    left: 4px;
    top: 8px;
    transform: none;
    width: 20px;
    height: 28px;
    cursor: grab;
    opacity: 0;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 3px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    transition: opacity 0.2s ease, color 0.15s ease;
    user-select: none;
    -webkit-user-drag: none;
}

.has-floating-buttons .cb-drag-handle {
    opacity: 1;
}

.cb-drag-handle:hover {
    color: #0066cc;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 102, 204, 0.2);
}

.cb-drag-handle:active {
    cursor: grabbing;
}

/* 拖曳排序進行中：全 body 強制 grabbing 手勢 */
.cb-pointer-dragging,
.cb-pointer-dragging * {
    cursor: grabbing !important;
}

/* ========================================
 * 拖曳排序 - 區塊拖曳中狀態
 * ======================================== */
.contentBuilder.cb-dragging,
.contentbuilder-block.cb-dragging {
    opacity: 0.4;
    outline: 2px dashed #0066cc;
    outline-offset: 2px;
}

.contentBuilder.cb-drop-target,
.contentbuilder-block.cb-drop-target {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
    background-color: rgba(0, 102, 204, 0.04);
}

/* ========================================
 * 拖曳排序 - 拖曳中全區塊降低透明度（UX 聚焦）
 * ======================================== */
/* 拖曳開始後：body 所有直接子元素（含散落的 <p> 等）降低透明度 */
/* cb-pointer-dragging：把手排序拖曳；cb-template-dragging：側邊欄模板拖曳 */
/* 排除 .cb-dragging，使被拖曳的區塊（opacity 0.4）與其他區塊有視覺區別 */
body.cb-pointer-dragging > *:not(.insert-indicator):not(.cb-dragging),
body.cb-template-dragging > *:not(.insert-indicator) {
    opacity: 0.2;
}

/* 插入位置提示矩形保持完全不透明 */
body.cb-pointer-dragging > .insert-indicator,
body.cb-template-dragging > .insert-indicator {
    opacity: 1;
}

/* ========================================
 * 插入指示器 - 空編輯器版本
 * ======================================== */
.insert-indicator--empty {
    position: absolute;
    inset: 20px;
    border: 2px dashed #0066cc;
    border-radius: 6px;
    background: rgba(0, 102, 204, 0.03);
    pointer-events: none;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0066cc;
    font-size: 13px;
    font-family: sans-serif;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
}


/* ========================================
 * 平滑滾動支援
 * ======================================== */
html {
    scroll-behavior: smooth;
}