/* 工具栏样式 */
.toolbar {
    padding: 16px;
    background: #ecf0f1;
    height: 100%;
    overflow-y: auto;
}

.toolbar-section {
    margin-bottom: 14px;
}

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

.toolbar-section h3 {
    font-size: 11px;
    font-weight: 600;
    color: #7f8c8d;
    margin: 0 0 6px 0;
    padding: 0 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tool-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* 工具按钮样式 */
.tool-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: white;
    color: #2c3e50;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
    width: 100%;
    min-height: 36px;
    position: relative;
    overflow: hidden;
}

.tool-btn:hover {
    background: #f8f9fa;
    border-color: #dee2e6;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tool-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.tool-btn.active {
    background: #3498db;
    color: white;
    border-color: #2980b9;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.tool-btn.active:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.tool-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.3);
}

/* 工具图标 */
.tool-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 0;
}

.tool-icon svg {
    width: 16px;
    height: 16px;
    display: block;
}

.tool-label {
    flex: 1;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 操作按钮样式 */
.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    background: white;
    color: #2c3e50;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    width: 100%;
    min-height: 32px;
}

.action-btn:hover {
    background: #f8f9fa;
    border-color: #95a5a6;
}

.action-btn:active {
    background: #e9ecef;
}

.action-btn.danger {
    color: #e74c3c;
    border-color: #e74c3c;
}

.action-btn.danger:hover {
    background: #e74c3c;
    color: white;
}

/* 按钮组样式 */
.button-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.button-group.horizontal {
    flex-direction: row;
}

.button-group.horizontal .action-btn {
    flex: 1;
    min-width: 0;
}

/* 工具提示动画 */
.tool-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.tool-btn:hover::after {
    left: 100%;
}

.tool-btn.active::after {
    display: none;
}

/* 工具栏收缩状态 */
.toolbar.collapsed {
    width: 60px;
}

.toolbar.collapsed .tool-label {
    display: none;
}

.toolbar.collapsed .toolbar-section h3 {
    display: none;
}

.toolbar.collapsed .tool-btn {
    justify-content: center;
    padding: 8px;
}

.toolbar.collapsed .button-group {
    gap: 2px;
}

/* 工具栏切换按钮 */
.toolbar-toggle {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border: none;
    background: #bdc3c7;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
}

.toolbar:hover .toolbar-toggle {
    opacity: 1;
}

.toolbar-toggle:hover {
    background: #95a5a6;
}

/* Two-column layout for all tool groups */
.tool-group-2col {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px !important;
}

.tool-group-2col .tool-btn {
    padding: 6px 8px;
    min-height: 34px;
    font-size: 12px;
}

.tool-group-2col .tool-icon {
    font-size: 14px;
    width: 18px;
    height: 18px;
}

.tool-group-2col .tool-label {
    font-size: 12px;
}

/* Grid layout for alignment buttons */
.tool-group-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px !important;
}

.tool-btn-sm {
    min-height: 30px;
    padding: 4px !important;
    justify-content: center;
}

.tool-btn-sm .tool-icon {
    font-size: 14px;
    width: 16px;
    height: 16px;
}

/* 分隔线 */
.toolbar-divider {
    height: 1px;
    background: #bdc3c7;
    margin: 12px 0;
    opacity: 0.5;
}

/* 工具栏搜索 */
.toolbar-search {
    position: relative;
    margin-bottom: 16px;
}

.toolbar-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    font-size: 13px;
    background: white;
}

.toolbar-search input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.toolbar-search::after {
    content: '🔍';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
    pointer-events: none;
}

/* 响应式工具栏 */
@media (max-width: 768px) {
    .toolbar {
        padding: 12px;
    }
    
    .tool-group {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .tool-btn {
        flex: 1;
        min-width: calc(50% - 3px);
        padding: 10px 8px;
        font-size: 12px;
    }
    
    .tool-label {
        display: none;
    }
    
    .tool-icon {
        font-size: 18px;
    }
    
    .toolbar-section h3 {
        font-size: 12px;
        margin-bottom: 8px;
    }
}