/* 元素属性工具栏容器 - 浮动覆盖层 */
.element-toolbar-container {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 1260px;
    width: 320px;
    z-index: 1000;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: none;
}

/* 工具栏显示时 */
.element-toolbar-container.visible {
    display: block;
    animation: fadeInUp 0.3s ease;
}

/* 拖动把手 */
.drag-handle {
    position: absolute;
    top: 50%;
    left: -20px;
    width: 16px;
    height: 60px;
    background: #6c757d;
    border-radius: 4px 0 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: move;
    color: white;
    font-size: 12px;
    transform: translateY(-50%);
    transition: all 0.2s;
    z-index: 1001;
}

.drag-handle:hover {
    background: #495057;
    width: 20px;
    left: -24px;
}

.drag-handle i {
    transform: rotate(90deg);
    font-size: 12px;
}

/* 拖动状态 */
.element-toolbar-container.dragging {
    opacity: 0.9;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    cursor: move !important;
}

.element-toolbar-container.dragging * {
    pointer-events: none;
}

.element-toolbar-container.dragging .drag-handle {
    background: #0d6efd;
}

/* 工具栏主体 */
.element-toolbar {
    width: 100%;
    height: 100%;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 工具栏头部 */
.toolbar-header {
    padding: 12px 16px;
    background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: move;
    user-select: none;
    flex-shrink: 0;
}

.toolbar-header i {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
}

.element-type {
    font-weight: 600;
    font-size: 14px;
    flex-grow: 1;
    margin-left: 8px;
}

.btn-close-toolbar {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 18px;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    pointer-events: auto;
}

/* 头部除按钮外的部分可拖动 */
.toolbar-header>*:not(.btn-close-toolbar) {
    pointer-events: none;
}

.btn-close-toolbar:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* 工具栏标签页 */
.toolbar-tabs {
    display: flex;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
    flex-shrink: 0;
}

.tab-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: #6c757d;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
}

.tab-btn:hover {
    color: #495057;
    background: #e9ecef;
}

.tab-btn.active {
    color: #d63384;
    background: white;
    border-bottom-color: #d63384;
}

/* 标签页内容 */
.tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    min-height: 0;
}

.tab-pane {
    display: none;
}

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

/* 可折叠部分 */
.toolbar-section.collapsible {
    margin-bottom: 4px;
    /* 进一步减少小分类之间的间距 */
    padding-bottom: 0;
    border-radius: 4px;
    overflow: hidden;
}

/* 快速操作 */
.toolbar-section.quick-actions {
    margin-bottom: 8px;
    padding-bottom: 0;
}

.toolbar-section.quick-actions .section-title {
    font-size: 11px;
    margin-bottom: 6px;
    color: #495057;
}

.quick-actions-grid {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
}

.quick-actions-grid .btn {
    flex: 1;
    min-width: 0;
    font-size: 11px;
    padding: 6px 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quick-actions-grid .btn i {
    font-size: 10px;
    margin-right: 4px;
}

.toolbar-section.collapsible .section-title {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    padding: 4px 8px;
    /* 进一步减少内边距 */
    transition: all 0.2s ease;
    font-size: 12px;
    /* 进一步减小字体大小 */
    min-height: 28px;
    /* 进一步减小最小高度 */
    line-height: 1;
    margin: 0;
}

.toolbar-section.collapsible .section-title:hover {
    color: #d63384;
    background: #fff5f7;
}

.toolbar-section.collapsible .section-title i {
    transition: transform 0.2s ease;
    font-size: 8px;
    /* 进一步减小图标大小 */
    color: #6c757d;
    margin-left: 4px;
}

.toolbar-section.collapsible.collapsed .section-title i {
    transform: rotate(-90deg);
}

.toolbar-section.collapsible .section-content {
    transition: all 0.3s ease;
    overflow: visible;
    max-height: 500px;
    padding: 8px;
    /* 进一步减少内边距 */
    background: #f8f9fa;
    margin: 0;
    border-top: 1px solid #e9ecef;
}

.toolbar-section.collapsible.collapsed .section-content {
    max-height: 0;
    margin: 0;
    padding: 0;
    border-top: none;
    min-height: 0;
    /* 确保完全折叠 */
    overflow: hidden;
}

/* 内容区域 - 使用Flexbox自动计算高度 */
.toolbar-sections {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    min-height: 0;
}

.toolbar-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.toolbar-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.section-title {
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 按钮网格 */
.btn-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-grid .btn-group {
    width: 100%;
}

/* 尺寸控制 */
.dimension-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.dimension-input-group label {
    display: block;
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 4px;
}

.rotation-control label {
    display: block;
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 8px;
}

.rotation-value {
    font-size: 12px;
    color: #495057;
    min-width: 32px;
    text-align: center;
}

/* 文字样式控制 */
.text-style-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.style-control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.style-control-group label {
    font-size: 12px;
    color: #6c757d;
}

.font-size-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.font-size-controls .btn-group {
    flex-grow: 1;
}

.font-size-unit {
    font-size: 12px;
    color: #6c757d;
    min-width: 20px;
}

/* 颜色选择器迷你版 */
.color-picker-mini {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.color-presets {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.color-option-mini {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid #ccc;
    transition: all 0.2s;
}

.color-option-mini:hover {
    transform: scale(1.1);
    border-color: #dee2e6;
}

.color-option-mini.active {
    border-color: #0d6efd;
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.25);
}

/* 透明色快捷色块的特殊样式 */
.color-option-mini.transparent-preset {
    background-image: linear-gradient(45deg, #999 25%, transparent 25%),
        linear-gradient(-45deg, #999 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #999 75%),
        linear-gradient(-45deg, transparent 75%, #999 75%) !important;
    background-size: 6px 6px !important;
    background-position: 0 0, 0 3px, 3px -3px, -3px 0px !important;
    border: 2px solid #ccc !important;
    background-color: transparent !important;
}

/* 透明色快捷色块激活状态 */
.color-option-mini.transparent-preset.active {
    border-color: #0d6efd !important;
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.25) !important;
}

.form-control-color {
    width: 100%;
    height: 32px;
    padding: 2px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

/* 装饰元素控制 */
.decoration-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 图片元素控制 */
.image-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.image-preview-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.image-thumbnail {
    width: 100px;
    height: 100px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #e9ecef;
}

.image-wrapper {
    width: 100%;
    height: 100%;
    background-image: linear-gradient(45deg, #f0f0f0 25%, transparent 25%),
                      linear-gradient(-45deg, #f0f0f0 25%, transparent 25%),
                      linear-gradient(45deg, transparent 75%, #f0f0f0 75%),
                      linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 10px 10px;
    background-position: 0 0, 0 5px, 5px -5px, -5px 0px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-wrapper img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.image-actions {
    display: flex;
    gap: 6px;
    height: 100px;
}

.action-column {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 90px;
}

.action-column:nth-child(2) {
    justify-content: flex-start;
}

.image-actions .btn {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8px;
    font-size: 11px;
    height: calc((100px - 12px) / 3); /* 所有按钮统一高度 */
}

.image-actions .btn i {
    font-size: 14px;
    margin-right: 6px;
    width: 16px;
    text-align: center;
}

.image-actions .btn span {
    line-height: 1.2;
}

.rotate-90 {
    transform: rotate(90deg);
    display: inline-block;
}

.shape-crop-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.shape-option,
.filter-option {
    flex: 1;
    min-width: 80px;
    text-align: center;
}

/* 确保工具栏不超出屏幕边界 */
.element-toolbar-container {
    min-width: 280px;
    max-width: 400px;
}

.element-toolbar-container:not(.dragging) {
    transition: left 0.15s ease-out;
}

/* 属性设置 */
.properties-section {
    margin-bottom: 1.5rem;
}

.properties-section h6.section-title i {
    font-size: 12px;
    transition: transform 0.2s ease;
}

.properties-section.collapsed h6.section-title i {
    transform: rotate(-90deg);
}

.properties-section .property-group {
    transition: all 0.3s ease;
}

.properties-section.collapsed .property-group {
    display: none;
}

.property-group {
    margin-bottom: 1rem;
}

.property-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #6c757d;
    margin-bottom: 0.25rem;
    display: block;
}