/* ===== AdminToolbar — 共用浮動富文字工具列 ===== */

.tp-helper {
    position: fixed;
    top: 80px;
    right: 16px;
    width: 260px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    z-index: 1050;
    transition: left 0.3s, right 0.3s;
    user-select: none;
}

.tp-helper.docked-left {
    right: auto;
    left: 16px;
}

.tp-helper-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bs-primary);
    color: #fff;
    border-radius: 12px 12px 0 0;
    cursor: grab;
    font-weight: 600;
    font-size: 0.9rem;
}

.tp-helper-header:active { cursor: grabbing; }

.tp-helper-header .dock-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
    opacity: 0.8;
}

.tp-helper-header .dock-btn:hover { opacity: 1; background: rgba(255,255,255,0.15); }

.tp-helper-upload {
    padding: 0.75rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.tp-helper-dropzone {
    border: 2px dashed var(--bs-border-color);
    border-radius: 8px;
    padding: 1.25rem 0.75rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--bs-secondary-color);
    font-size: 0.8rem;
}

.tp-helper-dropzone:hover,
.tp-helper-dropzone.drag-over {
    border-color: var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), 0.05);
    color: var(--bs-primary);
}

.tp-helper-dropzone i {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 0.375rem;
}

.tp-helper-tools {
    padding: 0.75rem;
}

.tp-helper-tools .tool-group {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.tp-helper-tools .tool-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.tp-helper-tools .tool-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--bs-border-color);
    border-radius: 6px;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.15s;
    padding: 0;
}

.tp-helper-tools .tool-btn:hover {
    background: var(--bs-primary);
    color: #fff;
    border-color: var(--bs-primary);
}

.tp-helper-tools .tool-btn.active {
    background: var(--bs-primary);
    color: #fff;
}

.tp-helper-tools .tool-btn[disabled] {
    opacity: 0.4;
    pointer-events: none;
}

.tp-helper-tools .tool-select {
    height: 34px;
    font-size: 0.8rem;
    border-radius: 6px;
    border: 1px solid var(--bs-border-color);
    padding: 0 0.5rem;
    flex: 1;
    min-width: 0;
}

.tool-color-swatch {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid var(--bs-border-color);
    display: inline-block;
}

.tp-color-palette {
    position: absolute;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    z-index: 1060;
    display: grid;
    grid-template-columns: repeat(8, 24px);
    gap: 3px;
}

.tp-color-palette .color-cell {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.1s;
}

.tp-color-palette .color-cell:hover {
    transform: scale(1.2);
    z-index: 1;
}

.tp-separator-popup {
    position: absolute;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    z-index: 1060;
    width: 220px;
}

.tp-separator-popup label {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 4px;
    display: block;
}

.tp-cards-popup {
    position: absolute;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    z-index: 1060;
    display: flex;
    gap: 6px;
}

.tp-cards-popup .card-option {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--bs-border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.15s;
}

.tp-cards-popup .card-option:hover {
    background: var(--bs-primary);
    color: #fff;
    border-color: var(--bs-primary);
}

.tp-table-popup {
    position: absolute;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    z-index: 1060;
}

.tp-table-grid {
    display: grid;
    grid-template-columns: repeat(6, 22px);
    gap: 2px;
    margin-bottom: 8px;
}

.tp-table-grid .grid-cell {
    width: 22px;
    height: 22px;
    border: 1px solid var(--bs-border-color);
    border-radius: 2px;
    cursor: pointer;
    transition: background 0.1s;
}

.tp-table-grid .grid-cell.selected {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
}

.tp-table-info {
    text-align: center;
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
}

.tp-helper-actions {
    padding: 0.5rem 0.75rem;
    border-top: 1px solid var(--bs-border-color);
    display: flex;
    gap: 0.5rem;
}

.tp-helper-actions .action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.4rem 0;
    border: 1px solid var(--bs-border-color);
    border-radius: 6px;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.15s;
}

.tp-helper-actions .action-btn:hover:not([disabled]) {
    background: var(--bs-light);
}

.tp-helper-actions .action-btn[disabled] {
    opacity: 0.35;
    cursor: not-allowed;
}

.tp-helper-save {
    padding: 0.5rem 0.75rem 0.75rem;
}

.tp-helper-save .save-btn {
    width: 100%;
    padding: 0.5rem;
    border: none;
    border-radius: 8px;
    background: var(--bs-primary);
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.tp-helper-save .save-btn:hover { opacity: 0.9; }
.tp-helper-save .save-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.tp-helper-save .save-btn.saved {
    background: var(--bs-success);
}

.edit-mode-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--bs-primary), var(--bs-info), var(--bs-primary));
    background-size: 200% 100%;
    animation: editBannerSlide 2s linear infinite;
    z-index: 1060;
}

@keyframes editBannerSlide {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@media (max-width: 768px) {
    .tp-helper {
        width: calc(100% - 32px);
        right: 16px;
        left: 16px;
        top: auto;
        bottom: 16px;
        max-height: 50vh;
    }
    .tp-helper.docked-left {
        right: 16px;
        left: 16px;
    }
}
